From: Alex Elder <elder@dreamhost.com>
To: ceph-devel@vger.kernel.org
Subject: [PATCH 6/6] ceph: make ceph_setxattr() and ceph_removexattr() more alike
Date: Tue, 28 Feb 2012 19:21:55 -0800 [thread overview]
Message-ID: <4F4D99D3.8070501@dreamhost.com> (raw)
In-Reply-To: <4F4D98D5.1010506@dreamhost.com>
This patch just rearranges a few bits of code to make more
portions of ceph_setxattr() and ceph_removexattr() identical.
Signed-off-by: Alex Elder <elder@dreamhost.com>
---
fs/ceph/xattr.c | 15 ++++++++-------
1 files changed, 8 insertions(+), 7 deletions(-)
diff --git a/fs/ceph/xattr.c b/fs/ceph/xattr.c
index 984c863..3fccd3b 100644
--- a/fs/ceph/xattr.c
+++ b/fs/ceph/xattr.c
@@ -764,15 +764,15 @@ int ceph_setxattr(struct dentry *dentry, const
char *name,
struct inode *inode = dentry->d_inode;
struct ceph_vxattr *vxattr;
struct ceph_inode_info *ci = ceph_inode(inode);
+ int issued;
int err;
+ int dirty;
int name_len = strlen(name);
int val_len = size;
char *newname = NULL;
char *newval = NULL;
struct ceph_inode_xattr *xattr = NULL;
- int issued;
int required_blob_size;
- int dirty;
if (ceph_snap(inode) != CEPH_NOSNAP)
return -EROFS;
@@ -803,6 +803,7 @@ int ceph_setxattr(struct dentry *dentry, const char
*name,
spin_lock(&ci->i_ceph_lock);
retry:
issued = __ceph_caps_issued(ci, NULL);
+ dout("setxattr %p issued %s\n", inode, ceph_cap_string(issued));
if (!(issued & CEPH_CAP_XATTR_EXCL))
goto do_sync;
__build_xattrs(inode);
@@ -811,7 +812,7 @@ retry:
if (!ci->i_xattrs.prealloc_blob ||
required_blob_size > ci->i_xattrs.prealloc_blob->alloc_len) {
- struct ceph_buffer *blob = NULL;
+ struct ceph_buffer *blob;
spin_unlock(&ci->i_ceph_lock);
dout(" preaallocating new blob size=%d\n", required_blob_size);
@@ -825,12 +826,13 @@ retry:
goto retry;
}
- dout("setxattr %p issued %s\n", inode, ceph_cap_string(issued));
err = __set_xattr(ci, newname, name_len, newval,
val_len, 1, 1, 1, &xattr);
+
dirty = __ceph_mark_dirty_caps(ci, CEPH_CAP_XATTR_EXCL);
ci->i_xattrs.dirty = true;
inode->i_ctime = CURRENT_TIME;
+
spin_unlock(&ci->i_ceph_lock);
if (dirty)
__mark_inode_dirty(inode, dirty);
@@ -892,18 +894,17 @@ int ceph_removexattr(struct dentry *dentry, const
char *name)
return -EOPNOTSUPP;
spin_lock(&ci->i_ceph_lock);
- __build_xattrs(inode);
issued = __ceph_caps_issued(ci, NULL);
dout("removexattr %p issued %s\n", inode, ceph_cap_string(issued));
-
if (!(issued & CEPH_CAP_XATTR_EXCL))
goto do_sync;
+ __build_xattrs(inode);
err = __remove_xattr_by_name(ceph_inode(inode), name);
+
dirty = __ceph_mark_dirty_caps(ci, CEPH_CAP_XATTR_EXCL);
ci->i_xattrs.dirty = true;
inode->i_ctime = CURRENT_TIME;
-
spin_unlock(&ci->i_ceph_lock);
if (dirty)
__mark_inode_dirty(inode, dirty);
--
1.7.5.4
next prev parent reply other threads:[~2012-02-29 3:21 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-02-29 3:17 [PATCH 0/6] ceph: virtual extended attribute cleanup Alex Elder
2012-02-29 3:21 ` [PATCH 1/6] ceph: use a symbolic name for "ceph." extended attribute namespace Alex Elder
2012-02-29 3:21 ` [PATCH 2/6] ceph: use macros to normalize vxattr table definitions Alex Elder
2012-02-29 3:21 ` [PATCH 3/6] ceph: drop "_cb" from name of struct ceph_vxattr_cb Alex Elder
2012-02-29 3:21 ` [PATCH 4/6] ceph: encode type in vxattr callback routines Alex Elder
2012-02-29 3:21 ` [PATCH 5/6] ceph: avoid repeatedly computing the size of constant vxattr names Alex Elder
2012-02-29 4:47 ` Yehuda Sadeh Weinraub
2012-02-29 5:19 ` Alex Elder
2012-02-29 3:21 ` Alex Elder [this message]
2012-03-02 19:35 ` [PATCH 6/6] ceph: make ceph_setxattr() and ceph_removexattr() more alike Sage Weil
2012-03-03 4:17 ` Alex Elder
2012-02-29 4:20 ` [PATCH 0/6] ceph: virtual extended attribute cleanup Christoph Hellwig
2012-02-29 5:15 ` Alex Elder
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4F4D99D3.8070501@dreamhost.com \
--to=elder@dreamhost.com \
--cc=ceph-devel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.