]>
Commit | Line | Data |
---|---|---|
00e5a55c BS |
1 | From: Joel Becker <joel.becker@oracle.com> |
2 | Date: Fri, 24 Oct 2008 18:54:43 -0700 | |
3 | Subject: ocfs2: Copy xattr buckets with a dedicated function. | |
4 | Patch-mainline: 2.6.29 | |
5 | ||
6 | Now that the places that copy whole buckets are using struct | |
7 | ocfs2_xattr_bucket, we can do the copy in a dedicated function. | |
8 | ||
9 | Signed-off-by: Joel Becker <joel.becker@oracle.com> | |
10 | Signed-off-by: Mark Fasheh <mfasheh@suse.com> | |
11 | --- | |
12 | fs/ocfs2/xattr.c | 26 ++++++++++++++++---------- | |
13 | 1 files changed, 16 insertions(+), 10 deletions(-) | |
14 | ||
15 | diff --git a/fs/ocfs2/xattr.c b/fs/ocfs2/xattr.c | |
16 | index 99aefe4..71d9e7b 100644 | |
17 | --- a/fs/ocfs2/xattr.c | |
18 | +++ b/fs/ocfs2/xattr.c | |
19 | @@ -240,6 +240,19 @@ static void ocfs2_xattr_bucket_journal_dirty(handle_t *handle, | |
20 | ocfs2_journal_dirty(handle, bucket->bu_bhs[i]); | |
21 | } | |
22 | ||
23 | +static void ocfs2_xattr_bucket_copy_data(struct inode *inode, | |
24 | + struct ocfs2_xattr_bucket *dest, | |
25 | + struct ocfs2_xattr_bucket *src) | |
26 | +{ | |
27 | + int i; | |
28 | + int blocksize = inode->i_sb->s_blocksize; | |
29 | + int blks = ocfs2_blocks_per_xattr_bucket(inode->i_sb); | |
30 | + | |
31 | + for (i = 0; i < blks; i++) { | |
32 | + memcpy(bucket_block(dest, i), bucket_block(src, i), | |
33 | + blocksize); | |
34 | + } | |
35 | +} | |
36 | ||
37 | static inline const char *ocfs2_xattr_prefix(int name_index) | |
38 | { | |
39 | @@ -3299,9 +3312,7 @@ static int ocfs2_divide_xattr_bucket(struct inode *inode, | |
40 | } | |
41 | ||
42 | /* copy the whole bucket to the new first. */ | |
43 | - for (i = 0; i < blk_per_bucket; i++) | |
44 | - memcpy(bucket_block(&t_bucket, i), bucket_block(&s_bucket, i), | |
45 | - blocksize); | |
46 | + ocfs2_xattr_bucket_copy_data(inode, &t_bucket, &s_bucket); | |
47 | ||
48 | /* update the new bucket. */ | |
49 | xh = bucket_xh(&t_bucket); | |
50 | @@ -3410,9 +3421,7 @@ static int ocfs2_cp_xattr_bucket(struct inode *inode, | |
51 | u64 t_blkno, | |
52 | int t_is_new) | |
53 | { | |
54 | - int ret, i; | |
55 | - int blk_per_bucket = ocfs2_blocks_per_xattr_bucket(inode->i_sb); | |
56 | - int blocksize = inode->i_sb->s_blocksize; | |
57 | + int ret; | |
58 | struct ocfs2_xattr_bucket s_bucket, t_bucket; | |
59 | ||
60 | BUG_ON(s_blkno == t_blkno); | |
61 | @@ -3443,10 +3452,7 @@ static int ocfs2_cp_xattr_bucket(struct inode *inode, | |
62 | if (ret) | |
63 | goto out; | |
64 | ||
65 | - for (i = 0; i < blk_per_bucket; i++) { | |
66 | - memcpy(bucket_block(&t_bucket, i), bucket_block(&s_bucket, i), | |
67 | - blocksize); | |
68 | - } | |
69 | + ocfs2_xattr_bucket_copy_data(inode, &t_bucket, &s_bucket); | |
70 | ocfs2_xattr_bucket_journal_dirty(handle, inode, &t_bucket); | |
71 | ||
72 | out: | |
73 | -- | |
74 | 1.5.6 | |
75 |