cleanup property and extended attribute set
cover cleanup property and extended attribute set
In an attempt to stream line the property and extended attribute set here are the few cleanup patches.
1/6 to 3/6 are mostly non functional cleanups (except for the conversion
to non static function in 3/6) and can be merged together.
4/6 removes the readonly root check in btrfs_setxattr() more details in
the change log.
5/6 as now we have btrfs_setxattr() and btrfs_setxattr_trans() for the
threads with transaction and without transaction respectively, so this patch uses them.
6/6 as 5/6 as diverted the threads with transaction to btrfs_setxattr(),
now btrfs_setxattr_trans() can drop the trans arg.
Anand Jain (6):
btrfs: rename btrfs_setxattr to btrfs_setxattr_trans
btrfs: rename do_setxattr to btrfs_setxattr
btrfs: declare btrfs_setxattr as a non static function
btrfs: remove redundant readonly root check in btrfs_setxattr_trans
btrfs: split thread with trans to use btrfs_setxattr
btrfs: cleanup btrfs_setxattr_trans drop trans arg
fs/btrfs/acl.c | 6 +++++- fs/btrfs/props.c | 25 +++++++++++++++++++------ fs/btrfs/xattr.c | 25 ++++++++++--------------- fs/btrfs/xattr.h | 7 ++++--- 4 files changed, 38 insertions(+), 25 deletions(-)
Signature · 1 line
2.17.1
PATCH 1/6 btrfs: rename btrfs_setxattr to btrfs_setxattr_trans
Rename btrfs_setxattr() to btrfs_setxattr_trans(), so that do_setxattr() can be renamed to btrfs_setxattr().
Preparatory patch, no functional changes.
--- fs/btrfs/acl.c | 2 +- fs/btrfs/props.c | 20 ++++++++++---------- fs/btrfs/xattr.c | 12 ++++++------ fs/btrfs/xattr.h | 2 +- 4 files changed, 18 insertions(+), 18 deletions(-)
fs/btrfs/acl.c +1 -1
@@ -93,7 +93,7 @@ static int __btrfs_set_acl(struct btrfs_trans_handle *trans, goto out; } - ret =btrfs_setxattr (trans, inode, name, value, size,0 ); + ret =btrfs_setxattr_trans (trans, inode, name, value, size,0 ); out:kfree (value);
fs/btrfs/props.c +10 -10
@@ -70,8 +70,8 @@ static int btrfs_set_prop(struct btrfs_trans_handle *trans, struct inode *inode,return -EINVAL ;if (value_len ==0 ) { - ret =btrfs_setxattr (trans, inode, handler->xattr_name, -NULL ,0 , flags); + ret =btrfs_setxattr_trans (trans, inode, handler->xattr_name, +NULL ,0 , flags);if (ret)return ret;
@@ -84,14 +84,14 @@ static int btrfs_set_prop(struct btrfs_trans_handle *trans, struct inode *inode, ret = handler->validate (value, value_len);if (ret)return ret; - ret =btrfs_setxattr (trans, inode, handler->xattr_name, - value, value_len, flags); + ret =btrfs_setxattr_trans (trans, inode, handler->xattr_name, + value, value_len, flags);if (ret)return ret; ret = handler->apply (inode, value, value_len);if (ret) { -btrfs_setxattr (trans, inode, handler->xattr_name, -NULL ,0 , flags); +btrfs_setxattr_trans (trans, inode, handler->xattr_name, +NULL ,0 , flags);return ret; }
@@ -358,13 +358,13 @@ static int inherit_props(struct btrfs_trans_handle *trans,if (ret)return ret; - ret =btrfs_setxattr (trans, inode, h->xattr_name, value, -strlen (value),0 ); + ret =btrfs_setxattr_trans (trans, inode, h->xattr_name, value, +strlen (value),0 );if (!ret) { ret = h->apply (inode, value,strlen (value));if (ret) -btrfs_setxattr (trans, inode, h->xattr_name, -NULL ,0 ,0 ); +btrfs_setxattr_trans (trans, inode, h->xattr_name, +NULL ,0 ,0 );else set_bit (BTRFS_INODE_HAS_PROPS , &BTRFS_I (inode)->runtime_flags);
fs/btrfs/xattr.c +6 -6
@@ -220,9 +220,9 @@ static int do_setxattr(struct btrfs_trans_handle *trans,/* * @value: "" makes the attribute to empty, NULL removes it */ -int btrfs_setxattr (struct btrfs_trans_handle *trans, -struct inode *inode,const char *name, -const void *value,size_t size,int flags) +int btrfs_setxattr_trans (struct btrfs_trans_handle *trans, +struct inode *inode,const char *name, +const void *value,size_t size,int flags) {struct btrfs_root *root =BTRFS_I (inode)->root;int ret;
@@ -370,7 +370,7 @@ static int btrfs_xattr_handler_set(const struct xattr_handler *handler, size_t size, int flags) { name =xattr_full_name (handler, name); -return btrfs_setxattr (NULL , inode, name, buffer, size, flags); +return btrfs_setxattr_trans (NULL , inode, name, buffer, size, flags); } static int btrfs_xattr_handler_set_prop(const struct xattr_handler *handler,
@@ -441,8 +441,8 @@ static int btrfs_initxattrs(struct inode *inode, }strcpy (name,XATTR_SECURITY_PREFIX );strcpy (name +XATTR_SECURITY_PREFIX_LEN , xattr->name); - err =btrfs_setxattr (trans, inode, name, xattr->value, - xattr->value_len,0 ); + err =btrfs_setxattr_trans (trans, inode, name, xattr->value, + xattr->value_len,0 );kfree (name);if (err <0 )break ;
fs/btrfs/xattr.h +1 -1
@@ -12,7 +12,7 @@ extern const struct xattr_handler *btrfs_xattr_handlers[];int btrfs_getxattr (struct inode *inode,const char *name,void *buffer,size_t size); -int btrfs_setxattr (struct btrfs_trans_handle *trans, +int btrfs_setxattr_trans (struct btrfs_trans_handle *trans,struct inode *inode,const char *name,const void *value,size_t size,int flags);ssize_t btrfs_listxattr (struct dentry *dentry,char *buffer,size_t size);
Signature · 1 line
2.17.1
PATCH 2/6 btrfs: rename do_setxattr to btrfs_setxattr
In reply to Anand JainWhen trans is not NULL btrfs_setxattr() calls do_setxattr() directly with a check for readonly root. Rename do_setxattr() btrfs_setxattr() in preparation to call do_setxattr() directly instead. Preparatory patch, no functional changes.
--- fs/btrfs/xattr.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
fs/btrfs/xattr.c +5 -5
@@ -76,9 +76,9 @@ int btrfs_getxattr(struct inode *inode, const char *name,return ret; } -static int do_setxattr (struct btrfs_trans_handle *trans, -struct inode *inode,const char *name, -const void *value,size_t size,int flags) +static int btrfs_setxattr (struct btrfs_trans_handle *trans, +struct inode *inode,const char *name, +const void *value,size_t size,int flags) {struct btrfs_dir_item *di =NULL ;struct btrfs_root *root =BTRFS_I (inode)->root;
@@ -231,13 +231,13 @@ int btrfs_setxattr_trans(struct btrfs_trans_handle *trans,return -EROFS ;if (trans) -return do_setxattr (trans, inode, name, value, size, flags); +return btrfs_setxattr (trans, inode, name, value, size, flags); trans =btrfs_start_transaction (root,2 );if (IS_ERR (trans))return PTR_ERR (trans); - ret =do_setxattr (trans, inode, name, value, size, flags); + ret =btrfs_setxattr (trans, inode, name, value, size, flags);if (ret) goto out;
Signature · 1 line
2.17.1
PATCH 3/6 btrfs: declare btrfs_setxattr as a non static function
In reply to Anand JainPreparatory patch, as we are going split the threads with transaction and threads without transaction to use the respective btrfs_setxattr() and btrfs_setxattr_trans() functions. Declare btrfs_setxattr() as non static function.
--- fs/btrfs/xattr.c | 5 ++--- fs/btrfs/xattr.h | 2 ++ 2 files changed, 4 insertions(+), 3 deletions(-)
fs/btrfs/xattr.c +2 -3
@@ -76,9 +76,8 @@ int btrfs_getxattr(struct inode *inode, const char *name,return ret; } -static int btrfs_setxattr (struct btrfs_trans_handle *trans, -struct inode *inode,const char *name, -const void *value,size_t size,int flags) +int btrfs_setxattr (struct btrfs_trans_handle *trans,struct inode *inode, +const char *name,const void *value,size_t size,int flags) {struct btrfs_dir_item *di =NULL ;struct btrfs_root *root =BTRFS_I (inode)->root;
fs/btrfs/xattr.h +2 -0
@@ -12,6 +12,8 @@ extern const struct xattr_handler *btrfs_xattr_handlers[];int btrfs_getxattr (struct inode *inode,const char *name,void *buffer,size_t size); +int btrfs_setxattr (struct btrfs_trans_handle *trans,struct inode *inode, +const char *name,const void *value,size_t size,int flags);int btrfs_setxattr_trans (struct btrfs_trans_handle *trans,struct inode *inode,const char *name,const void *value,size_t size,int flags);
Signature · 1 line
2.17.1
PATCH 4/6 btrfs: remove redundant readonly root check in btrfs_setxattr_trans
In reply to Anand Jainbtrfs_setxattr_trans() is called by 5 threads as below and all of them are write based threads, which won't run for a readonly root. So its ok to remove the readonly root check here.
1.__btrfs_set_acl()btrfs_init_acl()btrfs_init_inode_security()
2.__btrfs_set_acl()btrfs_set_acl()
3.btrfs_set_prop()btrfs_set_prop_trans()
/ \btrfs_ioctl_setflags() btrfs_xattr_handler_set_prop()
4.btrfs_xattr_handler_set()
5.btrfs_initxattrs()btrfs_xattr_security_init()btrfs_init_inode_security()
--- fs/btrfs/xattr.c | 3 --- 1 file changed, 3 deletions(-)
fs/btrfs/xattr.c +0 -3
@@ -226,9 +226,6 @@ int btrfs_setxattr_trans(struct btrfs_trans_handle *trans,struct btrfs_root *root =BTRFS_I (inode)->root;int ret; -if (btrfs_root_readonly (root)) -return -EROFS ; -if (trans)return btrfs_setxattr (trans, inode, name, value, size, flags);
Signature · 1 line
2.17.1
PATCH 5/6 btrfs: split thread with trans to use btrfs_setxattr
In reply to Anand JainWhen the parent thread has already created the transaction call btrfs_setxattr() directly. Also adds assert in btrfs_setxattr() to check if trans is not null.
--- fs/btrfs/acl.c | 6 +++++- fs/btrfs/props.c | 34 ++++++++++++++++++++++++---------- fs/btrfs/xattr.c | 6 ++++-- 3 files changed, 33 insertions(+), 13 deletions(-)
fs/btrfs/acl.c +5 -1
@@ -93,7 +93,11 @@ static int __btrfs_set_acl(struct btrfs_trans_handle *trans, goto out; } - ret =btrfs_setxattr_trans (trans, inode, name, value, size,0 ); +if (trans) + ret =btrfs_setxattr (trans, inode, name, value, size,0 ); +else + ret =btrfs_setxattr_trans (NULL , inode, name, value, size,0 ); + out:kfree (value);
fs/btrfs/props.c +24 -10
@@ -70,8 +70,13 @@ static int btrfs_set_prop(struct btrfs_trans_handle *trans, struct inode *inode,return -EINVAL ;if (value_len ==0 ) { - ret =btrfs_setxattr_trans (trans, inode, handler->xattr_name, -NULL ,0 , flags); +if (trans) + ret =btrfs_setxattr (trans, inode, handler->xattr_name, +NULL ,0 , flags); +else + ret =btrfs_setxattr_trans (NULL , inode, + handler->xattr_name,NULL ,0 , + flags);if (ret)return ret;
@@ -84,14 +89,23 @@ static int btrfs_set_prop(struct btrfs_trans_handle *trans, struct inode *inode, ret = handler->validate (value, value_len);if (ret)return ret; - ret =btrfs_setxattr_trans (trans, inode, handler->xattr_name, - value, value_len, flags); +if (trans) + ret =btrfs_setxattr (trans, inode, handler->xattr_name, value, + value_len, flags); +else + ret =btrfs_setxattr_trans (NULL , inode, handler->xattr_name, + value, value_len, flags); +if (ret)return ret; ret = handler->apply (inode, value, value_len);if (ret) { -btrfs_setxattr_trans (trans, inode, handler->xattr_name, -NULL ,0 , flags); +if (trans) +btrfs_setxattr (trans, inode, handler->xattr_name,NULL , +0 , flags); +else +btrfs_setxattr_trans (NULL , inode, handler->xattr_name, +NULL ,0 , flags);return ret; }
@@ -358,13 +372,13 @@ static int inherit_props(struct btrfs_trans_handle *trans,if (ret)return ret; - ret =btrfs_setxattr_trans (trans, inode, h->xattr_name, value, -strlen (value),0 ); + ret =btrfs_setxattr (trans, inode, h->xattr_name, value, +strlen (value),0 );if (!ret) { ret = h->apply (inode, value,strlen (value));if (ret) -btrfs_setxattr_trans (trans, inode, h->xattr_name, -NULL ,0 ,0 ); +btrfs_setxattr (trans, inode, h->xattr_name, +NULL ,0 ,0 );else set_bit (BTRFS_INODE_HAS_PROPS , &BTRFS_I (inode)->runtime_flags);
fs/btrfs/xattr.c +4 -2
@@ -86,6 +86,8 @@ int btrfs_setxattr(struct btrfs_trans_handle *trans, struct inode *inode,size_t name_len =strlen (name);int ret =0 ; +ASSERT (trans); +if (name_len + size >BTRFS_MAX_XATTR_SIZE (root->fs_info))return -ENOSPC ;
@@ -437,8 +439,8 @@ static int btrfs_initxattrs(struct inode *inode, }strcpy (name,XATTR_SECURITY_PREFIX );strcpy (name +XATTR_SECURITY_PREFIX_LEN , xattr->name); - err =btrfs_setxattr_trans (trans, inode, name, xattr->value, - xattr->value_len,0 ); + err =btrfs_setxattr (trans, inode, name, xattr->value, + xattr->value_len,0 );kfree (name);if (err <0 )break ;
Signature · 1 line
2.17.1
PATCH 6/6 btrfs: cleanup btrfs_setxattr_trans drop trans arg
In reply to Anand JainThe previous preparatory
btrfs: split thread with trans to use btrfs_setxattr
made sure that btrfs_setxattr_trans() is called only when trans arg is NULL.
Now this patch cleanups btrfs_setxattr_trans() and drops the trans arg.
--- fs/btrfs/acl.c | 2 +- fs/btrfs/props.c | 13 ++++++------- fs/btrfs/xattr.c | 9 +++------ fs/btrfs/xattr.h | 5 ++--- 4 files changed, 12 insertions(+), 17 deletions(-)
fs/btrfs/acl.c +1 -1
@@ -96,7 +96,7 @@ static int __btrfs_set_acl(struct btrfs_trans_handle *trans,if (trans) ret =btrfs_setxattr (trans, inode, name, value, size,0 );else - ret =btrfs_setxattr_trans (NULL , inode, name, value, size,0 ); + ret =btrfs_setxattr_trans (inode, name, value, size,0 ); out:kfree (value);
fs/btrfs/props.c +6 -7
@@ -74,9 +74,8 @@ static int btrfs_set_prop(struct btrfs_trans_handle *trans, struct inode *inode, ret =btrfs_setxattr (trans, inode, handler->xattr_name,NULL ,0 , flags); else - ret =btrfs_setxattr_trans (NULL , inode, - handler->xattr_name,NULL ,0 , - flags); + ret =btrfs_setxattr_trans (inode, handler->xattr_name, +NULL ,0 , flags);if (ret)return ret;
@@ -93,8 +92,8 @@ static int btrfs_set_prop(struct btrfs_trans_handle *trans, struct inode *inode, ret =btrfs_setxattr (trans, inode, handler->xattr_name, value, value_len, flags); else - ret =btrfs_setxattr_trans (NULL , inode, handler->xattr_name, - value, value_len, flags); + ret =btrfs_setxattr_trans (inode, handler->xattr_name, value, + value_len, flags);if (ret)return ret;
@@ -104,8 +103,8 @@ static int btrfs_set_prop(struct btrfs_trans_handle *trans, struct inode *inode,btrfs_setxattr (trans, inode, handler->xattr_name,NULL ,0 , flags); else - btrfs_setxattr_trans(NULL, inode, handler->xattr_name, - NULL, 0, flags); + btrfs_setxattr_trans(inode, handler->xattr_name, NULL, + 0, flags);return ret; }
fs/btrfs/xattr.c +3 -6
@@ -221,16 +221,13 @@ int btrfs_setxattr(struct btrfs_trans_handle *trans, struct inode *inode,/* * @value: "" makes the attribute to empty, NULL removes it */ -int btrfs_setxattr_trans (struct btrfs_trans_handle *trans, -struct inode *inode,const char *name, +int btrfs_setxattr_trans (struct inode *inode,const char *name,const void *value,size_t size,int flags) {struct btrfs_root *root =BTRFS_I (inode)->root; +struct btrfs_trans_handle *trans;int ret; -if (trans) -return btrfs_setxattr (trans, inode, name, value, size, flags); - trans =btrfs_start_transaction (root,2 );if (IS_ERR (trans))return PTR_ERR (trans);
@@ -368,7 +365,7 @@ static int btrfs_xattr_handler_set(const struct xattr_handler *handler, size_t size, int flags) { name =xattr_full_name (handler, name); -return btrfs_setxattr_trans (NULL , inode, name, buffer, size, flags); +return btrfs_setxattr_trans (inode, name, buffer, size, flags); } static int btrfs_xattr_handler_set_prop(const struct xattr_handler *handler,
fs/btrfs/xattr.h +2 -3
@@ -14,9 +14,8 @@ int btrfs_getxattr(struct inode *inode, const char *name, void *buffer, size_t size);int btrfs_setxattr (struct btrfs_trans_handle *trans,struct inode *inode,const char *name,const void *value,size_t size,int flags); -int btrfs_setxattr_trans (struct btrfs_trans_handle *trans, -struct inode *inode,const char *name, -const void *value,size_t size,int flags); +int btrfs_setxattr_trans (struct inode *inode,const char *name, +const void *value,size_t size,int flags);ssize_t btrfs_listxattr (struct dentry *dentry,char *buffer,size_t size); int btrfs_xattr_security_init(struct btrfs_trans_handle *trans,
Signature · 1 line
2.17.1
just a note: this is based on misc-next.
Quoted 27 lines · Anand Jain
In an attempt to stream line the property and extended attribute set here are the few cleanup patches.
1/6 to 3/6 are mostly non functional cleanups (except for the conversion
to non static function in 3/6) and can be merged together.
4/6 removes the readonly root check inbtrfs_setxattr()more details in
the change log.
5/6 as now we havebtrfs_setxattr()andbtrfs_setxattr_trans()for the
threads with transaction and without transaction respectively, so this patch uses them.
6/6 as 5/6 as diverted the threads with transaction tobtrfs_setxattr(),
nowbtrfs_setxattr_trans()can drop the trans arg.Anand Jain (6):
btrfs: renamebtrfs_setxattrtobtrfs_setxattr_trans
btrfs: renamedo_setxattrtobtrfs_setxattr
btrfs: declarebtrfs_setxattras a non static function
btrfs: remove redundant readonly root check inbtrfs_setxattr_trans
btrfs: split thread with trans to usebtrfs_setxattr
btrfs: cleanupbtrfs_setxattr_transdrop trans argfs/btrfs/acl.c | 6 +++++- fs/btrfs/props.c | 25 +++++++++++++++++++------ fs/btrfs/xattr.c | 25 ++++++++++--------------- fs/btrfs/xattr.h | 7 ++++--- 4 files changed, 38 insertions(+), 25 deletions(-)
Quoted 13 lines · Anand Jain
In an attempt to stream line the property and extended attribute set here are the few cleanup patches.
1/6 to 3/6 are mostly non functional cleanups (except for the conversion
to non static function in 3/6) and can be merged together.
4/6 removes the readonly root check inbtrfs_setxattr()more details in
the change log.
5/6 as now we havebtrfs_setxattr()andbtrfs_setxattr_trans()for the
threads with transaction and without transaction respectively, so this patch uses them.
6/6 as 5/6 as diverted the threads with transaction tobtrfs_setxattr(),
nowbtrfs_setxattr_trans()can drop the trans arg.
Quoted 7 lines
Anand Jain (6):
btrfs: renamebtrfs_setxattrtobtrfs_setxattr_trans
btrfs: renamedo_setxattrtobtrfs_setxattr
btrfs: declarebtrfs_setxattras a non static function
btrfs: remove redundant readonly root check inbtrfs_setxattr_trans
btrfs: split thread with trans to usebtrfs_setxattr
btrfs: cleanupbtrfs_setxattr_transdrop trans arg
Looks good to me, thanks. The result is very close to what the previous patchset did. Patchset will go to for-next soon.
Quoted 22 lines · David Sterba
Quoted 13 lines · Anand Jain
In an attempt to stream line the property and extended attribute set here are the few cleanup patches.
1/6 to 3/6 are mostly non functional cleanups (except for the conversion
to non static function in 3/6) and can be merged together.
4/6 removes the readonly root check inbtrfs_setxattr()more details in
the change log.
5/6 as now we havebtrfs_setxattr()andbtrfs_setxattr_trans()for the
threads with transaction and without transaction respectively, so this patch uses them.
6/6 as 5/6 as diverted the threads with transaction tobtrfs_setxattr(),
nowbtrfs_setxattr_trans()can drop the trans arg.Quoted 7 lines
Anand Jain (6):
btrfs: renamebtrfs_setxattrtobtrfs_setxattr_trans
btrfs: renamedo_setxattrtobtrfs_setxattr
btrfs: declarebtrfs_setxattras a non static function
btrfs: remove redundant readonly root check inbtrfs_setxattr_trans
btrfs: split thread with trans to usebtrfs_setxattr
btrfs: cleanupbtrfs_setxattr_transdrop trans arg
Quoted 3 lines
Looks good to me, thanks. The result is very close to what the previous patchset did. Patchset will go to for-next soon.
Thanks. On top of these, I am writing patches to merge start_transactions in btrfs_ioctl_setflags().
-Anand
Quoted 25 lines · Anand Jain
Quoted 22 lines · David Sterba
Quoted 20 lines · Anand Jain
In an attempt to stream line the property and extended attribute set here are the few cleanup patches.
1/6 to 3/6 are mostly non functional cleanups (except for the conversion
to non static function in 3/6) and can be merged together.
4/6 removes the readonly root check inbtrfs_setxattr()more details in
the change log.
5/6 as now we havebtrfs_setxattr()andbtrfs_setxattr_trans()for the
threads with transaction and without transaction respectively, so this patch uses them.
6/6 as 5/6 as diverted the threads with transaction tobtrfs_setxattr(),
nowbtrfs_setxattr_trans()can drop the trans arg.Anand Jain (6):
btrfs: renamebtrfs_setxattrtobtrfs_setxattr_trans
btrfs: renamedo_setxattrtobtrfs_setxattr
btrfs: declarebtrfs_setxattras a non static function
btrfs: remove redundant readonly root check inbtrfs_setxattr_trans
btrfs: split thread with trans to usebtrfs_setxattr
btrfs: cleanupbtrfs_setxattr_transdrop trans arg
Quoted 6 lines
Quoted 3 lines
Looks good to me, thanks. The result is very close to what the previous patchset did. Patchset will go to for-next soon.
Thanks. On top of these, I am writing patches to merge
start_transactionsinbtrfs_ioctl_setflags().
My current idea how to change btrfs_ioctl_setflags is like that (but I haven't prototyped it so it might not work):
- don't change binode->flags directly, but do all flag updates on a temporary variable
- if a property needs to be changed, do validation first, then start transaction and pass it to the property handler
- in the finalizing code, start a transaction unless it's been started already, apply the iflags and end transaction
This means there are up to 4 starting points of transaction, but the property validation should never fail between start/end region. There are other potential failures due to ENOMEM or ENOSPC, but that's the general set of errors we can't avoid.
Quoted 36 lines · David Sterba
Quoted 25 lines · Anand Jain
Quoted 22 lines · David Sterba
Quoted 20 lines · Anand Jain
In an attempt to stream line the property and extended attribute set here are the few cleanup patches.
1/6 to 3/6 are mostly non functional cleanups (except for the conversion
to non static function in 3/6) and can be merged together.
4/6 removes the readonly root check inbtrfs_setxattr()more details in
the change log.
5/6 as now we havebtrfs_setxattr()andbtrfs_setxattr_trans()for the
threads with transaction and without transaction respectively, so this patch uses them.
6/6 as 5/6 as diverted the threads with transaction tobtrfs_setxattr(),
nowbtrfs_setxattr_trans()can drop the trans arg.Anand Jain (6):
btrfs: renamebtrfs_setxattrtobtrfs_setxattr_trans
btrfs: renamedo_setxattrtobtrfs_setxattr
btrfs: declarebtrfs_setxattras a non static function
btrfs: remove redundant readonly root check inbtrfs_setxattr_trans
btrfs: split thread with trans to usebtrfs_setxattr
btrfs: cleanupbtrfs_setxattr_transdrop trans argQuoted 6 lines
Quoted 3 lines
Looks good to me, thanks. The result is very close to what the previous patchset did. Patchset will go to for-next soon.
Thanks. On top of these, I am writing patches to merge
start_transactionsinbtrfs_ioctl_setflags().My current idea how to change
btrfs_ioctl_setflagsis like that (but I haven't prototyped it so it might not work):
Quoted 8 lines
- don't change
binode->flagsdirectly, but do all flag updates on a temporary variable- if a property needs to be changed, do validation first, then start transaction and pass it to the property handler
- in the finalizing code, start a transaction unless it's been started already, apply the iflags and end transaction
I almost have the same way, but not in the same change sequence. Which should be fine.
Quoted 5 lines
This means there are up to 4 starting points of transaction, but the property validation should never fail between start/end region. There are other potential failures due to ENOMEM or ENOSPC, but that's the general set of errors we can't avoid.
My new docker build+test setup is giving me a little bit of headache. I will send the patches for the review soon.
Thanks, Anand
Quoted 33 lines · David Sterba
Quoted 25 lines · Anand Jain
Quoted 22 lines · David Sterba
Quoted 20 lines · Anand Jain
In an attempt to stream line the property and extended attribute set here are the few cleanup patches.
1/6 to 3/6 are mostly non functional cleanups (except for the conversion
to non static function in 3/6) and can be merged together.
4/6 removes the readonly root check inbtrfs_setxattr()more details in
the change log.
5/6 as now we havebtrfs_setxattr()andbtrfs_setxattr_trans()for the
threads with transaction and without transaction respectively, so this patch uses them.
6/6 as 5/6 as diverted the threads with transaction tobtrfs_setxattr(),
nowbtrfs_setxattr_trans()can drop the trans arg.Anand Jain (6):
btrfs: renamebtrfs_setxattrtobtrfs_setxattr_trans
btrfs: renamedo_setxattrtobtrfs_setxattr
btrfs: declarebtrfs_setxattras a non static function
btrfs: remove redundant readonly root check inbtrfs_setxattr_trans
btrfs: split thread with trans to usebtrfs_setxattr
btrfs: cleanupbtrfs_setxattr_transdrop trans argQuoted 6 lines
Quoted 3 lines
Looks good to me, thanks. The result is very close to what the previous patchset did. Patchset will go to for-next soon.
Thanks. On top of these, I am writing patches to merge
start_transactionsinbtrfs_ioctl_setflags().
Quoted 8 lines
My current idea how to change
btrfs_ioctl_setflagsis like that (but I haven't prototyped it so it might not work):- don't change
binode->flagsdirectly, but do all flag updates on a temporary variable- if a property needs to be changed, do validation first, then start transaction and pass it to the property handler
In btrfs_ioctl_setflags() we don't need the validate() at all, as the the property strings are hard coded with in the kernel or already verified during the mount -o option (fs_info->compress_type). So only place where we need the validate is btrfs_xattr_handler_set_prop().
Thanks, Anand
Quoted 8 lines
- in the finalizing code, start a transaction unless it's been started already, apply the iflags and end transaction
This means there are up to 4 starting points of transaction, but the property validation should never fail between start/end region. There are other potential failures due to ENOMEM or ENOSPC, but that's the general set of errors we can't avoid.