]> git.ipfire.org Git - people/pmueller/ipfire-2.x.git/blob - src/patches/suse-2.6.27.25/patches.fixes/ocfs2-set-gap-to-seperate-entry-and-value-when-xatt.patch
Updated xen patches taken from suse.
[people/pmueller/ipfire-2.x.git] / src / patches / suse-2.6.27.25 / patches.fixes / ocfs2-set-gap-to-seperate-entry-and-value-when-xatt.patch
1 From: Tiger Yang <tiger.yang@oracle.com>
2 Date: Fri, 20 Feb 2009 11:11:50 +0800
3 Subject: [PATCH] ocfs2: set gap to seperate entry and value when xattr in bucket
4 Patch-mainline: 2.6.29
5
6 This patch set a gap (4 bytes) between xattr entry and
7 name/value when xattr in bucket. This gap use to seperate
8 entry and name/value when a bucket is full. It had already
9 been set when xattr in inode/block.
10
11 Signed-off-by: Tiger Yang <tiger.yang@oracle.com>
12 Signed-off-by: Mark Fasheh <mfasheh@suse.com>
13 ---
14 fs/ocfs2/xattr.c | 18 ++++++++++--------
15 1 files changed, 10 insertions(+), 8 deletions(-)
16
17 Index: linux-2.6.27-sle11_ocfs2_update2/fs/ocfs2/xattr.c
18 ===================================================================
19 --- linux-2.6.27-sle11_ocfs2_update2.orig/fs/ocfs2/xattr.c
20 +++ linux-2.6.27-sle11_ocfs2_update2/fs/ocfs2/xattr.c
21 @@ -81,13 +81,14 @@ struct ocfs2_xattr_set_ctxt {
22
23 #define OCFS2_XATTR_ROOT_SIZE (sizeof(struct ocfs2_xattr_def_value_root))
24 #define OCFS2_XATTR_INLINE_SIZE 80
25 +#define OCFS2_XATTR_HEADER_GAP 4
26 #define OCFS2_XATTR_FREE_IN_IBODY (OCFS2_MIN_XATTR_INLINE_SIZE \
27 - sizeof(struct ocfs2_xattr_header) \
28 - - sizeof(__u32))
29 + - OCFS2_XATTR_HEADER_GAP)
30 #define OCFS2_XATTR_FREE_IN_BLOCK(ptr) ((ptr)->i_sb->s_blocksize \
31 - sizeof(struct ocfs2_xattr_block) \
32 - sizeof(struct ocfs2_xattr_header) \
33 - - sizeof(__u32))
34 + - OCFS2_XATTR_HEADER_GAP)
35
36 static struct ocfs2_xattr_def_value_root def_xv = {
37 .xv.xr_list.l_count = cpu_to_le16(1),
38 @@ -1411,7 +1412,7 @@ static int ocfs2_xattr_set_entry(struct
39 last += 1;
40 }
41
42 - free = min_offs - ((void *)last - xs->base) - sizeof(__u32);
43 + free = min_offs - ((void *)last - xs->base) - OCFS2_XATTR_HEADER_GAP;
44 if (free < 0)
45 return -EIO;
46
47 @@ -2101,7 +2102,7 @@ static int ocfs2_xattr_can_be_in_inode(s
48 last += 1;
49 }
50
51 - free = min_offs - ((void *)last - xs->base) - sizeof(__u32);
52 + free = min_offs - ((void *)last - xs->base) - OCFS2_XATTR_HEADER_GAP;
53 if (free < 0)
54 return 0;
55
56 @@ -4919,8 +4920,8 @@ try_again:
57 xh_free_start = le16_to_cpu(xh->xh_free_start);
58 header_size = sizeof(struct ocfs2_xattr_header) +
59 count * sizeof(struct ocfs2_xattr_entry);
60 - max_free = OCFS2_XATTR_BUCKET_SIZE -
61 - le16_to_cpu(xh->xh_name_value_len) - header_size;
62 + max_free = OCFS2_XATTR_BUCKET_SIZE - header_size -
63 + le16_to_cpu(xh->xh_name_value_len) - OCFS2_XATTR_HEADER_GAP;
64
65 mlog_bug_on_msg(header_size > blocksize, "bucket %llu has header size "
66 "of %u which exceed block size\n",
67 @@ -4953,7 +4954,7 @@ try_again:
68 need = 0;
69 }
70
71 - free = xh_free_start - header_size;
72 + free = xh_free_start - header_size - OCFS2_XATTR_HEADER_GAP;
73 /*
74 * We need to make sure the new name/value pair
75 * can exist in the same block.
76 @@ -4986,7 +4987,8 @@ try_again:
77 }
78
79 xh_free_start = le16_to_cpu(xh->xh_free_start);
80 - free = xh_free_start - header_size;
81 + free = xh_free_start - header_size
82 + - OCFS2_XATTR_HEADER_GAP;
83 if (xh_free_start % blocksize < need)
84 free -= xh_free_start % blocksize;
85