diff options
author | Daniel Phillips <daniel@tux3.org> | 2014-02-19 03:08:11 +0900 |
---|---|---|
committer | Daniel Phillips <daniel@tux3.org> | 2014-02-19 03:08:11 +0900 |
commit | 6474f14bf188127b0c1773b06c9cdc794af87b99 (patch) | |
tree | 34ae5e1ac434d2be116be7a97e237465eed6d3ba | |
parent | 693b8b6f5c9e3827cc35f156bc5d5e788490b1e1 (diff) | |
download | linux-tux3-6474f14bf188127b0c1773b06c9cdc794af87b99.tar.gz |
tux3: Release buffer in create_entry caller
Refactoring towards choosing inode after creating directory entry.
Now that caller has the buffer, release it there instead of the low level
directory entry create.
Signed-off-by: Daniel Phillips <d.phillips@partner.samsung.com>
Signed-off-by: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
-rw-r--r-- | fs/tux3/dir.c | 15 | ||||
-rw-r--r-- | fs/tux3/tux3.h | 2 | ||||
-rw-r--r-- | fs/tux3/xattr.c | 3 |
3 files changed, 12 insertions, 8 deletions
diff --git a/fs/tux3/dir.c b/fs/tux3/dir.c index 0a0bc8e3757383..2139012cef2191 100644 --- a/fs/tux3/dir.c +++ b/fs/tux3/dir.c @@ -96,11 +96,13 @@ static unsigned char tux_type_by_mode[S_IFMT >> STAT_SHIFT] = { "zero length entry at inum %Lu, block %Lu", \ tux_inode(dir)->inum, block) -static void tux_set_entry(struct buffer_head *buffer, tux_dirent *entry, - inum_t inum, umode_t mode) +void tux_set_entry(struct buffer_head *buffer, tux_dirent *entry, + inum_t inum, umode_t mode) { entry->inum = cpu_to_be64(inum); entry->type = tux_type_by_mode[(mode & S_IFMT) >> STAT_SHIFT]; + mark_buffer_dirty_non(buffer); + blockput(buffer); } /* @@ -111,8 +113,6 @@ void tux_update_dirent(struct inode *dir, struct buffer_head *buffer, tux_dirent *entry, struct inode *inode) { tux_set_entry(buffer, entry, tux_inode(inode)->inum, inode->i_mode); - mark_buffer_dirty_non(buffer); - blockput(buffer); tux3_iattrdirty(dir); dir->i_mtime = dir->i_ctime = gettime(); @@ -195,10 +195,6 @@ create: memcpy(entry->name, name, len); offset = (void *)entry - bufdata(clone); - tux_set_entry(clone, entry, inum, mode); - mark_buffer_dirty_non(clone); - blockput(clone); - *hold = clone; return (block << sb->blockbits) + offset; /* only for xattr create */ } @@ -216,6 +212,9 @@ int tux_create_dirent(struct inode *dir, const struct qstr *qstr, inum_t inum, if (where < 0) return where; + /* This releases buffer */ + tux_set_entry(buffer, bufdata(buffer) + (where & tux_sb(dir->i_sb)->blockmask), inum, mode); + tux3_iattrdirty(dir); if (dir->i_size != i_size) i_size_write(dir, i_size); diff --git a/fs/tux3/tux3.h b/fs/tux3/tux3.h index 78f6d87f0bf85d..e86becb1683481 100644 --- a/fs/tux3/tux3.h +++ b/fs/tux3/tux3.h @@ -783,6 +783,8 @@ void change_end_if_needed(struct sb *sb); #include "commit_flusher.h" /* dir.c */ +void tux_set_entry(struct buffer_head *buffer, tux_dirent *entry, + inum_t inum, umode_t mode); void tux_update_dirent(struct inode *dir, struct buffer_head *buffer, tux_dirent *entry, struct inode *new_inode); loff_t tux_create_entry(struct inode *dir, const char *name, unsigned len, diff --git a/fs/tux3/xattr.c b/fs/tux3/xattr.c index e5c8d4369831af..d20e6a14b3b26c 100644 --- a/fs/tux3/xattr.c +++ b/fs/tux3/xattr.c @@ -253,6 +253,9 @@ static int make_atom(struct inode *atable, const char *name, unsigned len, /* FIXME: better set a flag that unatom broke or something!!! */ return where; } + /* This releases buffer */ + tux_set_entry(buffer, bufdata(buffer) + (where & sb->blockmask), + *atom, 0); /* Enter into reverse map - maybe verify zero refs? */ where = unatom_dict_write(atable, *atom, where); |