Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 125904
b: refs/heads/master
c: 0e445b6
h: refs/heads/master
v: v3
  • Loading branch information
Tiger Yang authored and Mark Fasheh committed Jan 5, 2009
1 parent 43bcc74 commit 2272a0d
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 15 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 90cb546cada68bb8c2278afdb4b65c2ac11f2877
refs/heads/master: 0e445b6fe93c723fe8093fd04ddfeb11ae2de082
40 changes: 26 additions & 14 deletions trunk/fs/ocfs2/xattr.c
Original file line number Diff line number Diff line change
Expand Up @@ -490,9 +490,14 @@ int ocfs2_calc_security_init(struct inode *dir,
}

/* reserve clusters for xattr value which will be set in B tree*/
if (si->value_len > OCFS2_XATTR_INLINE_SIZE)
*want_clusters += ocfs2_clusters_for_bytes(dir->i_sb,
si->value_len);
if (si->value_len > OCFS2_XATTR_INLINE_SIZE) {
int new_clusters = ocfs2_clusters_for_bytes(dir->i_sb,
si->value_len);

*xattr_credits += ocfs2_clusters_to_blocks(dir->i_sb,
new_clusters);
*want_clusters += new_clusters;
}
return ret;
}

Expand All @@ -506,9 +511,7 @@ int ocfs2_calc_xattr_init(struct inode *dir,
{
int ret = 0;
struct ocfs2_super *osb = OCFS2_SB(dir->i_sb);
int s_size = 0;
int a_size = 0;
int acl_len = 0;
int s_size = 0, a_size = 0, acl_len = 0, new_clusters;

if (si->enable)
s_size = ocfs2_xattr_entry_real_size(strlen(si->name),
Expand Down Expand Up @@ -556,16 +559,25 @@ int ocfs2_calc_xattr_init(struct inode *dir,
*xattr_credits += ocfs2_blocks_per_xattr_bucket(dir->i_sb);
}

/* reserve clusters for xattr value which will be set in B tree*/
if (si->enable && si->value_len > OCFS2_XATTR_INLINE_SIZE)
*want_clusters += ocfs2_clusters_for_bytes(dir->i_sb,
si->value_len);
/*
* reserve credits and clusters for xattrs which has large value
* and have to be set outside
*/
if (si->enable && si->value_len > OCFS2_XATTR_INLINE_SIZE) {
new_clusters = ocfs2_clusters_for_bytes(dir->i_sb,
si->value_len);
*xattr_credits += ocfs2_clusters_to_blocks(dir->i_sb,
new_clusters);
*want_clusters += new_clusters;
}
if (osb->s_mount_opt & OCFS2_MOUNT_POSIX_ACL &&
acl_len > OCFS2_XATTR_INLINE_SIZE) {
*want_clusters += ocfs2_clusters_for_bytes(dir->i_sb, acl_len);
if (S_ISDIR(mode))
*want_clusters += ocfs2_clusters_for_bytes(dir->i_sb,
acl_len);
/* for directory, it has DEFAULT and ACCESS two types of acls */
new_clusters = (S_ISDIR(mode) ? 2 : 1) *
ocfs2_clusters_for_bytes(dir->i_sb, acl_len);
*xattr_credits += ocfs2_clusters_to_blocks(dir->i_sb,
new_clusters);
*want_clusters += new_clusters;
}

return ret;
Expand Down

0 comments on commit 2272a0d

Please sign in to comment.