xattr.c (86968ef21596515958d5f0a40233d02be78ecec0) | xattr.c (12fe3dda7ed89c95cc0ef7abc001ad1ad3e092f8) |
---|---|
1// SPDX-License-Identifier: GPL-2.0 2#include <linux/ceph/ceph_debug.h> 3#include <linux/ceph/pagelist.h> 4 5#include "super.h" 6#include "mds_client.h" 7 8#include <linux/ceph/decode.h> --- 740 unchanged lines hidden (view full) --- 749 if (name_size) 750 size += 4 + 4 + name_size + val_size; 751 752 return size; 753} 754 755/* 756 * If there are dirty xattrs, reencode xattrs into the prealloc_blob | 1// SPDX-License-Identifier: GPL-2.0 2#include <linux/ceph/ceph_debug.h> 3#include <linux/ceph/pagelist.h> 4 5#include "super.h" 6#include "mds_client.h" 7 8#include <linux/ceph/decode.h> --- 740 unchanged lines hidden (view full) --- 749 if (name_size) 750 size += 4 + 4 + name_size + val_size; 751 752 return size; 753} 754 755/* 756 * If there are dirty xattrs, reencode xattrs into the prealloc_blob |
757 * and swap into place. | 757 * and swap into place. It returns the old i_xattrs.blob (or NULL) so 758 * that it can be freed by the caller as the i_ceph_lock is likely to be 759 * held. |
758 */ | 760 */ |
759void __ceph_build_xattrs_blob(struct ceph_inode_info *ci) | 761struct ceph_buffer *__ceph_build_xattrs_blob(struct ceph_inode_info *ci) |
760{ 761 struct rb_node *p; 762 struct ceph_inode_xattr *xattr = NULL; | 762{ 763 struct rb_node *p; 764 struct ceph_inode_xattr *xattr = NULL; |
765 struct ceph_buffer *old_blob = NULL; |
|
763 void *dest; 764 765 dout("__build_xattrs_blob %p\n", &ci->vfs_inode); 766 if (ci->i_xattrs.dirty) { 767 int need = __get_required_blob_size(ci, 0, 0); 768 769 BUG_ON(need > ci->i_xattrs.prealloc_blob->alloc_len); 770 --- 14 unchanged lines hidden (view full) --- 785 p = rb_next(p); 786 } 787 788 /* adjust buffer len; it may be larger than we need */ 789 ci->i_xattrs.prealloc_blob->vec.iov_len = 790 dest - ci->i_xattrs.prealloc_blob->vec.iov_base; 791 792 if (ci->i_xattrs.blob) | 766 void *dest; 767 768 dout("__build_xattrs_blob %p\n", &ci->vfs_inode); 769 if (ci->i_xattrs.dirty) { 770 int need = __get_required_blob_size(ci, 0, 0); 771 772 BUG_ON(need > ci->i_xattrs.prealloc_blob->alloc_len); 773 --- 14 unchanged lines hidden (view full) --- 788 p = rb_next(p); 789 } 790 791 /* adjust buffer len; it may be larger than we need */ 792 ci->i_xattrs.prealloc_blob->vec.iov_len = 793 dest - ci->i_xattrs.prealloc_blob->vec.iov_base; 794 795 if (ci->i_xattrs.blob) |
793 ceph_buffer_put(ci->i_xattrs.blob); | 796 old_blob = ci->i_xattrs.blob; |
794 ci->i_xattrs.blob = ci->i_xattrs.prealloc_blob; 795 ci->i_xattrs.prealloc_blob = NULL; 796 ci->i_xattrs.dirty = false; 797 ci->i_xattrs.version++; 798 } | 797 ci->i_xattrs.blob = ci->i_xattrs.prealloc_blob; 798 ci->i_xattrs.prealloc_blob = NULL; 799 ci->i_xattrs.dirty = false; 800 ci->i_xattrs.version++; 801 } |
802 803 return old_blob; |
|
799} 800 801static inline int __get_request_mask(struct inode *in) { 802 struct ceph_mds_request *req = current->journal_info; 803 int mask = 0; 804 if (req && req->r_target_inode == in) { 805 if (req->r_op == CEPH_MDS_OP_LOOKUP || 806 req->r_op == CEPH_MDS_OP_LOOKUPINO || --- 549 unchanged lines hidden --- | 804} 805 806static inline int __get_request_mask(struct inode *in) { 807 struct ceph_mds_request *req = current->journal_info; 808 int mask = 0; 809 if (req && req->r_target_inode == in) { 810 if (req->r_op == CEPH_MDS_OP_LOOKUP || 811 req->r_op == CEPH_MDS_OP_LOOKUPINO || --- 549 unchanged lines hidden --- |