1 From: Tiger Yang <tiger.yang@oracle.com>
2 Date: Thu, 5 Mar 2009 11:06:15 +0800
3 Subject: [PATCH] ocfs2: tweak to get the maximum inline data size with xattr
6 Replace max_inline_data with max_inline_data_with_xattr
7 to ensure it correct when xattr inlined.
9 Signed-off-by: Tiger Yang <tiger.yang@oracle.com>
10 Acked-by: Joel Becker <joel.becker@oracle.com>
11 Signed-off-by: Mark Fasheh <mfasheh@suse.com>
13 fs/ocfs2/aops.c | 7 +++++--
14 fs/ocfs2/namei.c | 3 ++-
15 fs/ocfs2/ocfs2_fs.h | 6 ------
16 3 files changed, 7 insertions(+), 9 deletions(-)
18 Index: linux-2.6.27-sle11_ocfs2_update2/fs/ocfs2/aops.c
19 ===================================================================
20 --- linux-2.6.27-sle11_ocfs2_update2.orig/fs/ocfs2/aops.c
21 +++ linux-2.6.27-sle11_ocfs2_update2/fs/ocfs2/aops.c
22 @@ -234,7 +234,7 @@ int ocfs2_read_inline_data(struct inode
23 size = i_size_read(inode);
25 if (size > PAGE_CACHE_SIZE ||
26 - size > ocfs2_max_inline_data(inode->i_sb)) {
27 + size > ocfs2_max_inline_data_with_xattr(inode->i_sb, di)) {
28 ocfs2_error(inode->i_sb,
29 "Inode %llu has with inline data has bad size: %Lu",
30 (unsigned long long)OCFS2_I(inode)->ip_blkno,
31 @@ -1575,6 +1575,7 @@ static int ocfs2_try_to_write_inline_dat
33 loff_t end = pos + len;
34 struct ocfs2_inode_info *oi = OCFS2_I(inode);
35 + struct ocfs2_dinode *di = NULL;
37 mlog(0, "Inode %llu, write of %u bytes at off %llu. features: 0x%x\n",
38 (unsigned long long)oi->ip_blkno, len, (unsigned long long)pos,
39 @@ -1607,7 +1608,9 @@ static int ocfs2_try_to_write_inline_dat
41 * Check whether the write can fit.
43 - if (mmap_page || end > ocfs2_max_inline_data(inode->i_sb))
44 + di = (struct ocfs2_dinode *)wc->w_di_bh->b_data;
46 + end > ocfs2_max_inline_data_with_xattr(inode->i_sb, di))
50 Index: linux-2.6.27-sle11_ocfs2_update2/fs/ocfs2/namei.c
51 ===================================================================
52 --- linux-2.6.27-sle11_ocfs2_update2.orig/fs/ocfs2/namei.c
53 +++ linux-2.6.27-sle11_ocfs2_update2/fs/ocfs2/namei.c
54 @@ -532,7 +532,8 @@ static int ocfs2_mknod_locked(struct ocf
56 fe->i_dyn_features = cpu_to_le16(feat | OCFS2_INLINE_DATA_FL);
58 - fe->id2.i_data.id_count = cpu_to_le16(ocfs2_max_inline_data(osb->sb));
59 + fe->id2.i_data.id_count = cpu_to_le16(
60 + ocfs2_max_inline_data_with_xattr(osb->sb, fe));
62 fel = &fe->id2.i_list;
63 fel->l_tree_depth = 0;
64 Index: linux-2.6.27-sle11_ocfs2_update2/fs/ocfs2/ocfs2_fs.h
65 ===================================================================
66 --- linux-2.6.27-sle11_ocfs2_update2.orig/fs/ocfs2/ocfs2_fs.h
67 +++ linux-2.6.27-sle11_ocfs2_update2/fs/ocfs2/ocfs2_fs.h
68 @@ -987,12 +987,6 @@ static inline int ocfs2_fast_symlink_cha
69 offsetof(struct ocfs2_dinode, id2.i_symlink);
72 -static inline int ocfs2_max_inline_data(struct super_block *sb)
74 - return sb->s_blocksize -
75 - offsetof(struct ocfs2_dinode, id2.i_data.id_data);
78 static inline int ocfs2_max_inline_data_with_xattr(struct super_block *sb,
79 struct ocfs2_dinode *di)