diff options
author | Mark Fasheh <mfasheh@suse.com> | 2008-08-05 18:32:46 (GMT) |
---|---|---|
committer | Mark Fasheh <mfasheh@suse.com> | 2008-08-22 18:09:02 (GMT) |
commit | 9780eb6cfaf7d2d5ccc061eaf94e7aec6a17791e (patch) | |
tree | 103ce3e47f06adcf3825902d406d06e6a76fd065 /fs/ocfs2/dir.c | |
parent | 83cab5338fa8c74f979223698c8d4cc88f2ab68e (diff) | |
download | linux-9780eb6cfaf7d2d5ccc061eaf94e7aec6a17791e.tar.xz |
ocfs2: correctly set i_blocks after inline dir gets expanded
We were setting i_blocks based on allocation before the extent insert, which
is wrong as the value is a calculation based on ip_clusters which gets
updated as a result of the insert. This patch moves the line in question
to just after the call to ocfs2_insert_extent().
Without this fix, inline directories were temporarily having an i_blocks
value of zero immediately after expansion to extents.
Reported-and-tested-by: Tristan Ye <tristan.ye@oracle.com>
Signed-off-by: Mark Fasheh <mfasheh@suse.com>
Diffstat (limited to 'fs/ocfs2/dir.c')
-rw-r--r-- | fs/ocfs2/dir.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/fs/ocfs2/dir.c b/fs/ocfs2/dir.c index 8e9c4a4..9cce563 100644 --- a/fs/ocfs2/dir.c +++ b/fs/ocfs2/dir.c @@ -1300,7 +1300,6 @@ static int ocfs2_expand_inline_dir(struct inode *dir, struct buffer_head *di_bh, di->i_size = cpu_to_le64(sb->s_blocksize); di->i_ctime = di->i_mtime = cpu_to_le64(dir->i_ctime.tv_sec); di->i_ctime_nsec = di->i_mtime_nsec = cpu_to_le32(dir->i_ctime.tv_nsec); - dir->i_blocks = ocfs2_inode_sector_count(dir); /* * This should never fail as our extent list is empty and all @@ -1313,6 +1312,12 @@ static int ocfs2_expand_inline_dir(struct inode *dir, struct buffer_head *di_bh, goto out_commit; } + /* + * Set i_blocks after the extent insert for the most up to + * date ip_clusters value. + */ + dir->i_blocks = ocfs2_inode_sector_count(dir); + ret = ocfs2_journal_dirty(handle, di_bh); if (ret) { mlog_errno(ret); |