Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

ceph: make ceph_setxattr() and ceph_removexattr() more alike

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>
Signed-off-by: Sage Weil <sage@newdream.net>

+8 -6
+8 -6
fs/ceph/xattr.c
··· 765 765 struct inode *inode = dentry->d_inode; 766 766 struct ceph_vxattr *vxattr; 767 767 struct ceph_inode_info *ci = ceph_inode(inode); 768 + int issued; 768 769 int err; 770 + int dirty; 769 771 int name_len = strlen(name); 770 772 int val_len = size; 771 773 char *newname = NULL; 772 774 char *newval = NULL; 773 775 struct ceph_inode_xattr *xattr = NULL; 774 - int issued; 775 776 int required_blob_size; 776 - int dirty; 777 777 778 778 if (ceph_snap(inode) != CEPH_NOSNAP) 779 779 return -EROFS; ··· 804 804 spin_lock(&ci->i_ceph_lock); 805 805 retry: 806 806 issued = __ceph_caps_issued(ci, NULL); 807 + dout("setxattr %p issued %s\n", inode, ceph_cap_string(issued)); 807 808 if (!(issued & CEPH_CAP_XATTR_EXCL)) 808 809 goto do_sync; 809 810 __build_xattrs(inode); ··· 813 812 814 813 if (!ci->i_xattrs.prealloc_blob || 815 814 required_blob_size > ci->i_xattrs.prealloc_blob->alloc_len) { 816 - struct ceph_buffer *blob = NULL; 815 + struct ceph_buffer *blob; 817 816 818 817 spin_unlock(&ci->i_ceph_lock); 819 818 dout(" preaallocating new blob size=%d\n", required_blob_size); ··· 827 826 goto retry; 828 827 } 829 828 830 - dout("setxattr %p issued %s\n", inode, ceph_cap_string(issued)); 831 829 err = __set_xattr(ci, newname, name_len, newval, 832 830 val_len, 1, 1, 1, &xattr); 831 + 833 832 dirty = __ceph_mark_dirty_caps(ci, CEPH_CAP_XATTR_EXCL); 834 833 ci->i_xattrs.dirty = true; 835 834 inode->i_ctime = CURRENT_TIME; 835 + 836 836 spin_unlock(&ci->i_ceph_lock); 837 837 if (dirty) 838 838 __mark_inode_dirty(inode, dirty); ··· 897 895 898 896 err = -ENOMEM; 899 897 spin_lock(&ci->i_ceph_lock); 900 - __build_xattrs(inode); 901 898 retry: 902 899 issued = __ceph_caps_issued(ci, NULL); 903 900 dout("removexattr %p issued %s\n", inode, ceph_cap_string(issued)); 904 901 905 902 if (!(issued & CEPH_CAP_XATTR_EXCL)) 906 903 goto do_sync; 904 + __build_xattrs(inode); 907 905 908 906 required_blob_size = __get_required_blob_size(ci, 0, 0); 909 907 ··· 924 922 } 925 923 926 924 err = __remove_xattr_by_name(ceph_inode(inode), name); 925 + 927 926 dirty = __ceph_mark_dirty_caps(ci, CEPH_CAP_XATTR_EXCL); 928 927 ci->i_xattrs.dirty = true; 929 928 inode->i_ctime = CURRENT_TIME; 930 - 931 929 spin_unlock(&ci->i_ceph_lock); 932 930 if (dirty) 933 931 __mark_inode_dirty(inode, dirty);