* [PATCH 1/2] Btrfs: skip adding an acl attribute if we don't have to
@ 2012-11-28 10:43 Liu Bo
2012-11-28 10:43 ` [PATCH 2/2] Btrfs: don't add a NULL extended attribute Liu Bo
0 siblings, 1 reply; 2+ messages in thread
From: Liu Bo @ 2012-11-28 10:43 UTC (permalink / raw)
To: linux-btrfs; +Cc: David Arendt
If the acl can be exactly represented in the traditional file
mode permission bits, we don't set another acl attribute.
Signed-off-by: Liu Bo <bo.li.liu@oracle.com>
---
fs/btrfs/acl.c | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/fs/btrfs/acl.c b/fs/btrfs/acl.c
index 0c16e3d..e15d2b0 100644
--- a/fs/btrfs/acl.c
+++ b/fs/btrfs/acl.c
@@ -121,6 +121,8 @@ static int btrfs_set_acl(struct btrfs_trans_handle *trans,
ret = posix_acl_equiv_mode(acl, &inode->i_mode);
if (ret < 0)
return ret;
+ if (ret == 0)
+ acl = NULL;
}
ret = 0;
break;
--
1.7.7.6
^ permalink raw reply related [flat|nested] 2+ messages in thread
* [PATCH 2/2] Btrfs: don't add a NULL extended attribute
2012-11-28 10:43 [PATCH 1/2] Btrfs: skip adding an acl attribute if we don't have to Liu Bo
@ 2012-11-28 10:43 ` Liu Bo
0 siblings, 0 replies; 2+ messages in thread
From: Liu Bo @ 2012-11-28 10:43 UTC (permalink / raw)
To: linux-btrfs; +Cc: David Arendt
Passing a null extended attribute value means to remove the attribute,
but we don't have to add a new NULL extended attribute.
Signed-off-by: Liu Bo <bo.li.liu@oracle.com>
---
fs/btrfs/xattr.c | 10 ++++++++++
1 files changed, 10 insertions(+), 0 deletions(-)
diff --git a/fs/btrfs/xattr.c b/fs/btrfs/xattr.c
index 3f4e2d6..be8376a 100644
--- a/fs/btrfs/xattr.c
+++ b/fs/btrfs/xattr.c
@@ -122,6 +122,16 @@ static int do_setxattr(struct btrfs_trans_handle *trans,
*/
if (!value)
goto out;
+ } else {
+ di = btrfs_lookup_xattr(NULL, root, path, btrfs_ino(inode),
+ name, name_len, 0);
+ if (IS_ERR(di)) {
+ ret = PTR_ERR(di);
+ goto out;
+ }
+ if (!di && !value)
+ goto out;
+ btrfs_release_path(path);
}
again:
--
1.7.7.6
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2012-11-28 10:45 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-11-28 10:43 [PATCH 1/2] Btrfs: skip adding an acl attribute if we don't have to Liu Bo
2012-11-28 10:43 ` [PATCH 2/2] Btrfs: don't add a NULL extended attribute Liu Bo
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).