diff options
author | Joel Becker <joel.becker@oracle.com> | 2008-11-25 22:00:15 -0500 |
---|---|---|
committer | Mark Fasheh <mfasheh@suse.com> | 2009-01-05 11:40:27 -0500 |
commit | 2b656c1d6fc5ba7791a360766780a212faed5705 (patch) | |
tree | ea1ec010e7c3af013f3fe2cbbbed180ad20b73b8 | |
parent | 15d609293d1954465a4788b9b182214323c6a2a1 (diff) |
ocfs2: Explain t_is_new in ocfs2_cp_xattr_cluster().
I was unsure of the JOURNAL_ACCESS parameters in
ocfs2_cp_xattr_cluster(). They're based on the function argument
't_is_new', but I couldn't quite figure out how t_is_new mapped to
allocation. ocfs2_cp_xattr_cluster() actually overwrites the target,
regardless of t_is_new.
Well, I just figured it out. So I'm adding a big fat comment for those
who come after me. ocfs2_divide_xattr_cluster() has the same behavior.
Signed-off-by: Joel Becker <joel.becker@oracle.com>
Signed-off-by: Mark Fasheh <mfasheh@suse.com>
-rw-r--r-- | fs/ocfs2/xattr.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/fs/ocfs2/xattr.c b/fs/ocfs2/xattr.c index 4dba34758827..5efcf4e85d7c 100644 --- a/fs/ocfs2/xattr.c +++ b/fs/ocfs2/xattr.c | |||
@@ -3747,6 +3747,11 @@ static int ocfs2_divide_xattr_bucket(struct inode *inode, | |||
3747 | goto out; | 3747 | goto out; |
3748 | } | 3748 | } |
3749 | 3749 | ||
3750 | /* | ||
3751 | * Hey, if we're overwriting t_bucket, what difference does | ||
3752 | * ACCESS_CREATE vs ACCESS_WRITE make? See the comment in the | ||
3753 | * same part of ocfs2_cp_xattr_bucket(). | ||
3754 | */ | ||
3750 | ret = ocfs2_xattr_bucket_journal_access(handle, t_bucket, | 3755 | ret = ocfs2_xattr_bucket_journal_access(handle, t_bucket, |
3751 | new_bucket_head ? | 3756 | new_bucket_head ? |
3752 | OCFS2_JOURNAL_ACCESS_CREATE : | 3757 | OCFS2_JOURNAL_ACCESS_CREATE : |
@@ -3918,6 +3923,18 @@ static int ocfs2_cp_xattr_bucket(struct inode *inode, | |||
3918 | if (ret) | 3923 | if (ret) |
3919 | goto out; | 3924 | goto out; |
3920 | 3925 | ||
3926 | /* | ||
3927 | * Hey, if we're overwriting t_bucket, what difference does | ||
3928 | * ACCESS_CREATE vs ACCESS_WRITE make? Well, if we allocated a new | ||
3929 | * cluster to fill, we came here from ocfs2_cp_xattr_cluster(), and | ||
3930 | * it is really new - ACCESS_CREATE is required. But we also | ||
3931 | * might have moved data out of t_bucket before extending back | ||
3932 | * into it. ocfs2_add_new_xattr_bucket() can do this - its call | ||
3933 | * to ocfs2_add_new_xattr_cluster() may have created a new extent | ||
3934 | * and copied out the end of the old extent. Then it re-extends | ||
3935 | * the old extent back to create space for new xattrs. That's | ||
3936 | * how we get here, and the bucket isn't really new. | ||
3937 | */ | ||
3921 | ret = ocfs2_xattr_bucket_journal_access(handle, t_bucket, | 3938 | ret = ocfs2_xattr_bucket_journal_access(handle, t_bucket, |
3922 | t_is_new ? | 3939 | t_is_new ? |
3923 | OCFS2_JOURNAL_ACCESS_CREATE : | 3940 | OCFS2_JOURNAL_ACCESS_CREATE : |