]> git.ipfire.org Git - ipfire-2.x.git/blobdiff - src/patches/suse-2.6.27.39/patches.fixes/ocfs2-tweak-to-get-the-maximum-inline-data-size-wit.patch
Imported linux-2.6.27.39 suse/xen patches.
[ipfire-2.x.git] / src / patches / suse-2.6.27.39 / patches.fixes / ocfs2-tweak-to-get-the-maximum-inline-data-size-wit.patch
diff --git a/src/patches/suse-2.6.27.39/patches.fixes/ocfs2-tweak-to-get-the-maximum-inline-data-size-wit.patch b/src/patches/suse-2.6.27.39/patches.fixes/ocfs2-tweak-to-get-the-maximum-inline-data-size-wit.patch
new file mode 100644 (file)
index 0000000..592e1ff
--- /dev/null
@@ -0,0 +1,80 @@
+From: Tiger Yang <tiger.yang@oracle.com>
+Date: Thu, 5 Mar 2009 11:06:15 +0800
+Subject: [PATCH] ocfs2: tweak to get the maximum inline data size with xattr
+Patch-mainline: 2.6.29
+
+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>
+---
+ fs/ocfs2/aops.c     |    7 +++++--
+ fs/ocfs2/namei.c    |    3 ++-
+ fs/ocfs2/ocfs2_fs.h |    6 ------
+ 3 files changed, 7 insertions(+), 9 deletions(-)
+
+Index: linux-2.6.27-sle11_ocfs2_update2/fs/ocfs2/aops.c
+===================================================================
+--- linux-2.6.27-sle11_ocfs2_update2.orig/fs/ocfs2/aops.c
++++ linux-2.6.27-sle11_ocfs2_update2/fs/ocfs2/aops.c
+@@ -234,7 +234,7 @@ int ocfs2_read_inline_data(struct inode
+       size = i_size_read(inode);
+       if (size > PAGE_CACHE_SIZE ||
+-          size > ocfs2_max_inline_data(inode->i_sb)) {
++          size > ocfs2_max_inline_data_with_xattr(inode->i_sb, di)) {
+               ocfs2_error(inode->i_sb,
+                           "Inode %llu has with inline data has bad size: %Lu",
+                           (unsigned long long)OCFS2_I(inode)->ip_blkno,
+@@ -1575,6 +1575,7 @@ static int ocfs2_try_to_write_inline_dat
+       int ret, written = 0;
+       loff_t end = pos + len;
+       struct ocfs2_inode_info *oi = OCFS2_I(inode);
++      struct ocfs2_dinode *di = NULL;
+       mlog(0, "Inode %llu, write of %u bytes at off %llu. features: 0x%x\n",
+            (unsigned long long)oi->ip_blkno, len, (unsigned long long)pos,
+@@ -1607,7 +1608,9 @@ static int ocfs2_try_to_write_inline_dat
+       /*
+        * Check whether the write can fit.
+        */
+-      if (mmap_page || end > ocfs2_max_inline_data(inode->i_sb))
++      di = (struct ocfs2_dinode *)wc->w_di_bh->b_data;
++      if (mmap_page ||
++          end > ocfs2_max_inline_data_with_xattr(inode->i_sb, di))
+               return 0;
+ do_inline_write:
+Index: linux-2.6.27-sle11_ocfs2_update2/fs/ocfs2/namei.c
+===================================================================
+--- linux-2.6.27-sle11_ocfs2_update2.orig/fs/ocfs2/namei.c
++++ linux-2.6.27-sle11_ocfs2_update2/fs/ocfs2/namei.c
+@@ -532,7 +532,8 @@ static int ocfs2_mknod_locked(struct ocf
+               fe->i_dyn_features = cpu_to_le16(feat | OCFS2_INLINE_DATA_FL);
+-              fe->id2.i_data.id_count = cpu_to_le16(ocfs2_max_inline_data(osb->sb));
++              fe->id2.i_data.id_count = cpu_to_le16(
++                              ocfs2_max_inline_data_with_xattr(osb->sb, fe));
+       } else {
+               fel = &fe->id2.i_list;
+               fel->l_tree_depth = 0;
+Index: linux-2.6.27-sle11_ocfs2_update2/fs/ocfs2/ocfs2_fs.h
+===================================================================
+--- linux-2.6.27-sle11_ocfs2_update2.orig/fs/ocfs2/ocfs2_fs.h
++++ linux-2.6.27-sle11_ocfs2_update2/fs/ocfs2/ocfs2_fs.h
+@@ -987,12 +987,6 @@ static inline int ocfs2_fast_symlink_cha
+                offsetof(struct ocfs2_dinode, id2.i_symlink);
+ }
+-static inline int ocfs2_max_inline_data(struct super_block *sb)
+-{
+-      return sb->s_blocksize -
+-              offsetof(struct ocfs2_dinode, id2.i_data.id_data);
+-}
+-
+ static inline int ocfs2_max_inline_data_with_xattr(struct super_block *sb,
+                                                  struct ocfs2_dinode *di)
+ {