diff options
author | Tiger Yang <tiger.yang@oracle.com> | 2009-03-04 22:06:15 -0500 |
---|---|---|
committer | Mark Fasheh <mfasheh@suse.com> | 2009-03-12 19:45:46 -0400 |
commit | d9ae49d6e2b1ac9166e58ae3c9345135604beaa6 (patch) | |
tree | e6d5bbc8160a8c810534dc699e79f2b2a7792000 /fs | |
parent | 6c9fd1dc0a597e575617a7de7086c8a3efa8f524 (diff) |
ocfs2: tweak to get the maximum inline data size with xattr
Replace max_inline_data with max_inline_data_with_xattr
to ensure it correct when xattr inlined.
Signed-off-by: Tiger Yang <tiger.yang@oracle.com>
Acked-by: Joel Becker <joel.becker@oracle.com>
Signed-off-by: Mark Fasheh <mfasheh@suse.com>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/ocfs2/aops.c | 7 | ||||
-rw-r--r-- | fs/ocfs2/namei.c | 3 | ||||
-rw-r--r-- | fs/ocfs2/ocfs2_fs.h | 6 |
3 files changed, 7 insertions, 9 deletions
diff --git a/fs/ocfs2/aops.c b/fs/ocfs2/aops.c index a067a6cffb01..8e1709a679b7 100644 --- a/fs/ocfs2/aops.c +++ b/fs/ocfs2/aops.c | |||
@@ -227,7 +227,7 @@ int ocfs2_read_inline_data(struct inode *inode, struct page *page, | |||
227 | size = i_size_read(inode); | 227 | size = i_size_read(inode); |
228 | 228 | ||
229 | if (size > PAGE_CACHE_SIZE || | 229 | if (size > PAGE_CACHE_SIZE || |
230 | size > ocfs2_max_inline_data(inode->i_sb)) { | 230 | size > ocfs2_max_inline_data_with_xattr(inode->i_sb, di)) { |
231 | ocfs2_error(inode->i_sb, | 231 | ocfs2_error(inode->i_sb, |
232 | "Inode %llu has with inline data has bad size: %Lu", | 232 | "Inode %llu has with inline data has bad size: %Lu", |
233 | (unsigned long long)OCFS2_I(inode)->ip_blkno, | 233 | (unsigned long long)OCFS2_I(inode)->ip_blkno, |
@@ -1555,6 +1555,7 @@ static int ocfs2_try_to_write_inline_data(struct address_space *mapping, | |||
1555 | int ret, written = 0; | 1555 | int ret, written = 0; |
1556 | loff_t end = pos + len; | 1556 | loff_t end = pos + len; |
1557 | struct ocfs2_inode_info *oi = OCFS2_I(inode); | 1557 | struct ocfs2_inode_info *oi = OCFS2_I(inode); |
1558 | struct ocfs2_dinode *di = NULL; | ||
1558 | 1559 | ||
1559 | mlog(0, "Inode %llu, write of %u bytes at off %llu. features: 0x%x\n", | 1560 | mlog(0, "Inode %llu, write of %u bytes at off %llu. features: 0x%x\n", |
1560 | (unsigned long long)oi->ip_blkno, len, (unsigned long long)pos, | 1561 | (unsigned long long)oi->ip_blkno, len, (unsigned long long)pos, |
@@ -1587,7 +1588,9 @@ static int ocfs2_try_to_write_inline_data(struct address_space *mapping, | |||
1587 | /* | 1588 | /* |
1588 | * Check whether the write can fit. | 1589 | * Check whether the write can fit. |
1589 | */ | 1590 | */ |
1590 | if (mmap_page || end > ocfs2_max_inline_data(inode->i_sb)) | 1591 | di = (struct ocfs2_dinode *)wc->w_di_bh->b_data; |
1592 | if (mmap_page || | ||
1593 | end > ocfs2_max_inline_data_with_xattr(inode->i_sb, di)) | ||
1591 | return 0; | 1594 | return 0; |
1592 | 1595 | ||
1593 | do_inline_write: | 1596 | do_inline_write: |
diff --git a/fs/ocfs2/namei.c b/fs/ocfs2/namei.c index 084aba86c3b2..4b11762f249e 100644 --- a/fs/ocfs2/namei.c +++ b/fs/ocfs2/namei.c | |||
@@ -532,7 +532,8 @@ static int ocfs2_mknod_locked(struct ocfs2_super *osb, | |||
532 | 532 | ||
533 | fe->i_dyn_features = cpu_to_le16(feat | OCFS2_INLINE_DATA_FL); | 533 | fe->i_dyn_features = cpu_to_le16(feat | OCFS2_INLINE_DATA_FL); |
534 | 534 | ||
535 | fe->id2.i_data.id_count = cpu_to_le16(ocfs2_max_inline_data(osb->sb)); | 535 | fe->id2.i_data.id_count = cpu_to_le16( |
536 | ocfs2_max_inline_data_with_xattr(osb->sb, fe)); | ||
536 | } else { | 537 | } else { |
537 | fel = &fe->id2.i_list; | 538 | fel = &fe->id2.i_list; |
538 | fel->l_tree_depth = 0; | 539 | fel->l_tree_depth = 0; |
diff --git a/fs/ocfs2/ocfs2_fs.h b/fs/ocfs2/ocfs2_fs.h index c7ae45aaa36c..2332ef740f4f 100644 --- a/fs/ocfs2/ocfs2_fs.h +++ b/fs/ocfs2/ocfs2_fs.h | |||
@@ -1070,12 +1070,6 @@ static inline int ocfs2_fast_symlink_chars(struct super_block *sb) | |||
1070 | offsetof(struct ocfs2_dinode, id2.i_symlink); | 1070 | offsetof(struct ocfs2_dinode, id2.i_symlink); |
1071 | } | 1071 | } |
1072 | 1072 | ||
1073 | static inline int ocfs2_max_inline_data(struct super_block *sb) | ||
1074 | { | ||
1075 | return sb->s_blocksize - | ||
1076 | offsetof(struct ocfs2_dinode, id2.i_data.id_data); | ||
1077 | } | ||
1078 | |||
1079 | static inline int ocfs2_max_inline_data_with_xattr(struct super_block *sb, | 1073 | static inline int ocfs2_max_inline_data_with_xattr(struct super_block *sb, |
1080 | struct ocfs2_dinode *di) | 1074 | struct ocfs2_dinode *di) |
1081 | { | 1075 | { |