All of lore.kernel.org
 help / color / mirror / Atom feed
From: Josef Bacik <josef@toxicpanda.com>
To: Sweet Tea Dorminy <sweettea-kernel@dorminy.me>
Cc: "Theodore Y. Ts'o" <tytso@mit.edu>,
	Jaegeuk Kim <jaegeuk@kernel.org>,
	Eric Biggers <ebiggers@kernel.org>, Chris Mason <clm@fb.com>,
	David Sterba <dsterba@suse.com>,
	linux-fscrypt@vger.kernel.org, linux-btrfs@vger.kernel.org,
	kernel-team@meta.com
Subject: Re: [PATCH v3 08/22] btrfs: use struct fscrypt_str instead of struct qstr
Date: Fri, 21 Oct 2022 16:42:00 -0400	[thread overview]
Message-ID: <Y1MEGPa6/YgVfiDy@localhost.localdomain> (raw)
In-Reply-To: <8c708f4e52ddcf6a361706265f5fcfa64cce912a.1666281277.git.sweettea-kernel@dorminy.me>

On Thu, Oct 20, 2022 at 12:58:27PM -0400, Sweet Tea Dorminy wrote:
> While struct qstr is more natural without fscrypt, since it's provided
> by dentries, struct fscrypt_str is provided by the fscrypt handlers
> processing dentries, and is thus more natural in the fscrypt world.
> Replace all of the struct qstr uses with struct fscrypt_str.
> 
> Signed-off-by: Sweet Tea Dorminy <sweettea-kernel@dorminy.me>
> ---
>  fs/btrfs/ctree.h       | 19 +++++----
>  fs/btrfs/dir-item.c    | 10 ++---
>  fs/btrfs/inode-item.c  | 14 +++----
>  fs/btrfs/inode-item.h  | 10 ++---
>  fs/btrfs/inode.c       | 90 +++++++++++++++++-------------------------
>  fs/btrfs/ioctl.c       |  4 +-
>  fs/btrfs/root-tree.c   |  4 +-
>  fs/btrfs/send.c        |  4 +-
>  fs/btrfs/super.c       |  2 +-
>  fs/btrfs/transaction.c | 13 +++---
>  fs/btrfs/tree-log.c    | 42 ++++++++++----------
>  fs/btrfs/tree-log.h    |  4 +-
>  12 files changed, 98 insertions(+), 118 deletions(-)
> 
> diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h
> index 695fd6cf8918..9d1186a16912 100644
> --- a/fs/btrfs/ctree.h
> +++ b/fs/btrfs/ctree.h
> @@ -2898,10 +2898,10 @@ static inline void btrfs_clear_sb_rdonly(struct super_block *sb)
>  /* root-item.c */
>  int btrfs_add_root_ref(struct btrfs_trans_handle *trans, u64 root_id,
>  		       u64 ref_id, u64 dirid, u64 sequence,
> -		       const struct qstr *name);
> +		       const struct fscrypt_str *name);
>  int btrfs_del_root_ref(struct btrfs_trans_handle *trans, u64 root_id,
>  		       u64 ref_id, u64 dirid, u64 *sequence,
> -		       const struct qstr *name);
> +		       const struct fscrypt_str *name);
>  int btrfs_del_root(struct btrfs_trans_handle *trans,
>  		   const struct btrfs_key *key);
>  int btrfs_insert_root(struct btrfs_trans_handle *trans, struct btrfs_root *root,
> @@ -2930,23 +2930,23 @@ int btrfs_uuid_tree_iterate(struct btrfs_fs_info *fs_info);
>  
>  /* dir-item.c */
>  int btrfs_check_dir_item_collision(struct btrfs_root *root, u64 dir,
> -			  const struct qstr *name);
> +			  const struct fscrypt_str *name);
>  int btrfs_insert_dir_item(struct btrfs_trans_handle *trans,
> -			  const struct qstr *name, struct btrfs_inode *dir,
> +			  const struct fscrypt_str *name, struct btrfs_inode *dir,
>  			  struct btrfs_key *location, u8 type, u64 index);
>  struct btrfs_dir_item *btrfs_lookup_dir_item(struct btrfs_trans_handle *trans,
>  					     struct btrfs_root *root,
>  					     struct btrfs_path *path, u64 dir,
> -					     const struct qstr *name, int mod);
> +					     const struct fscrypt_str *name, int mod);
>  struct btrfs_dir_item *
>  btrfs_lookup_dir_index_item(struct btrfs_trans_handle *trans,
>  			    struct btrfs_root *root,
>  			    struct btrfs_path *path, u64 dir,
> -			    u64 index, const struct qstr *name, int mod);
> +			    u64 index, const struct fscrypt_str *name, int mod);
>  struct btrfs_dir_item *
>  btrfs_search_dir_index_item(struct btrfs_root *root,
>  			    struct btrfs_path *path, u64 dirid,
> -			    const struct qstr *name);
> +			    const struct fscrypt_str *name);
>  int btrfs_delete_one_dir_name(struct btrfs_trans_handle *trans,
>  			      struct btrfs_root *root,
>  			      struct btrfs_path *path,
> @@ -3027,10 +3027,10 @@ struct inode *btrfs_lookup_dentry(struct inode *dir, struct dentry *dentry);
>  int btrfs_set_inode_index(struct btrfs_inode *dir, u64 *index);
>  int btrfs_unlink_inode(struct btrfs_trans_handle *trans,
>  		       struct btrfs_inode *dir, struct btrfs_inode *inode,
> -		       const struct qstr *name);
> +		       const struct fscrypt_str *name);
>  int btrfs_add_link(struct btrfs_trans_handle *trans,
>  		   struct btrfs_inode *parent_inode, struct btrfs_inode *inode,
> -		   const struct qstr *name, int add_backref, u64 index);
> +		   const struct fscrypt_str *name, int add_backref, u64 index);
>  int btrfs_delete_subvolume(struct inode *dir, struct dentry *dentry);
>  int btrfs_truncate_block(struct btrfs_inode *inode, loff_t from, loff_t len,
>  			 int front);
> @@ -3056,7 +3056,6 @@ struct btrfs_new_inode_args {
>  	struct posix_acl *default_acl;
>  	struct posix_acl *acl;
>  	struct fscrypt_name fname;
> -	struct qstr name;
>  };
>  int btrfs_new_inode_prepare(struct btrfs_new_inode_args *args,
>  			    unsigned int *trans_num_items);
> diff --git a/fs/btrfs/dir-item.c b/fs/btrfs/dir-item.c
> index 8c60f37eb13f..fdab48c1abb8 100644
> --- a/fs/btrfs/dir-item.c
> +++ b/fs/btrfs/dir-item.c
> @@ -104,7 +104,7 @@ int btrfs_insert_xattr_item(struct btrfs_trans_handle *trans,
>   * Will return 0 or -ENOMEM
>   */
>  int btrfs_insert_dir_item(struct btrfs_trans_handle *trans,
> -			  const struct qstr *name, struct btrfs_inode *dir,
> +			  const struct fscrypt_str *name, struct btrfs_inode *dir,
>  			  struct btrfs_key *location, u8 type, u64 index)
>  {
>  	int ret = 0;
> @@ -206,7 +206,7 @@ static struct btrfs_dir_item *btrfs_lookup_match_dir(
>  struct btrfs_dir_item *btrfs_lookup_dir_item(struct btrfs_trans_handle *trans,
>  					     struct btrfs_root *root,
>  					     struct btrfs_path *path, u64 dir,
> -					     const struct qstr *name,
> +					     const struct fscrypt_str *name,
>  					     int mod)
>  {
>  	struct btrfs_key key;
> @@ -225,7 +225,7 @@ struct btrfs_dir_item *btrfs_lookup_dir_item(struct btrfs_trans_handle *trans,
>  }
>  
>  int btrfs_check_dir_item_collision(struct btrfs_root *root, u64 dir,
> -				   const struct qstr *name)
> +				   const struct fscrypt_str *name)
>  {
>  	int ret;
>  	struct btrfs_key key;
> @@ -302,7 +302,7 @@ struct btrfs_dir_item *
>  btrfs_lookup_dir_index_item(struct btrfs_trans_handle *trans,
>  			    struct btrfs_root *root,
>  			    struct btrfs_path *path, u64 dir,
> -			    u64 index, const struct qstr *name, int mod)
> +			    u64 index, const struct fscrypt_str *name, int mod)
>  {
>  	struct btrfs_dir_item *di;
>  	struct btrfs_key key;
> @@ -321,7 +321,7 @@ btrfs_lookup_dir_index_item(struct btrfs_trans_handle *trans,
>  
>  struct btrfs_dir_item *
>  btrfs_search_dir_index_item(struct btrfs_root *root, struct btrfs_path *path,
> -			    u64 dirid, const struct qstr *name)
> +			    u64 dirid, const struct fscrypt_str *name)
>  {
>  	struct btrfs_dir_item *di;
>  	struct btrfs_key key;
> diff --git a/fs/btrfs/inode-item.c b/fs/btrfs/inode-item.c
> index 643b0c555064..ce5c51ffdc0d 100644
> --- a/fs/btrfs/inode-item.c
> +++ b/fs/btrfs/inode-item.c
> @@ -12,7 +12,7 @@
>  
>  struct btrfs_inode_ref *btrfs_find_name_in_backref(struct extent_buffer *leaf,
>  						   int slot,
> -						   const struct qstr *name)
> +						   const struct fscrypt_str *name)
>  {
>  	struct btrfs_inode_ref *ref;
>  	unsigned long ptr;
> @@ -39,7 +39,7 @@ struct btrfs_inode_ref *btrfs_find_name_in_backref(struct extent_buffer *leaf,
>  
>  struct btrfs_inode_extref *btrfs_find_name_in_ext_backref(
>  		struct extent_buffer *leaf, int slot, u64 ref_objectid,
> -		const struct qstr *name)
> +		const struct fscrypt_str *name)
>  {
>  	struct btrfs_inode_extref *extref;
>  	unsigned long ptr;
> @@ -78,7 +78,7 @@ struct btrfs_inode_extref *
>  btrfs_lookup_inode_extref(struct btrfs_trans_handle *trans,
>  			  struct btrfs_root *root,
>  			  struct btrfs_path *path,
> -			  const struct qstr *name,
> +			  const struct fscrypt_str *name,
>  			  u64 inode_objectid, u64 ref_objectid, int ins_len,
>  			  int cow)
>  {
> @@ -101,7 +101,7 @@ btrfs_lookup_inode_extref(struct btrfs_trans_handle *trans,
>  
>  static int btrfs_del_inode_extref(struct btrfs_trans_handle *trans,
>  				  struct btrfs_root *root,
> -				  const struct qstr *name,
> +				  const struct fscrypt_str *name,
>  				  u64 inode_objectid, u64 ref_objectid,
>  				  u64 *index)
>  {
> @@ -171,7 +171,7 @@ static int btrfs_del_inode_extref(struct btrfs_trans_handle *trans,
>  }
>  
>  int btrfs_del_inode_ref(struct btrfs_trans_handle *trans,
> -			struct btrfs_root *root, const struct qstr *name,
> +			struct btrfs_root *root, const struct fscrypt_str *name,
>  			u64 inode_objectid, u64 ref_objectid, u64 *index)
>  {
>  	struct btrfs_path *path;
> @@ -248,7 +248,7 @@ int btrfs_del_inode_ref(struct btrfs_trans_handle *trans,
>   */
>  static int btrfs_insert_inode_extref(struct btrfs_trans_handle *trans,
>  				     struct btrfs_root *root,
> -				     const struct qstr *name,
> +				     const struct fscrypt_str *name,
>  				     u64 inode_objectid, u64 ref_objectid,
>  				     u64 index)
>  {
> @@ -303,7 +303,7 @@ static int btrfs_insert_inode_extref(struct btrfs_trans_handle *trans,
>  
>  /* Will return 0, -ENOMEM, -EMLINK, or -EEXIST or anything from the CoW path */
>  int btrfs_insert_inode_ref(struct btrfs_trans_handle *trans,
> -			   struct btrfs_root *root, const struct qstr *name,
> +			   struct btrfs_root *root, const struct fscrypt_str *name,
>  			   u64 inode_objectid, u64 ref_objectid, u64 index)
>  {
>  	struct btrfs_fs_info *fs_info = root->fs_info;
> diff --git a/fs/btrfs/inode-item.h b/fs/btrfs/inode-item.h
> index 3c657c670cfd..b80aeb715701 100644
> --- a/fs/btrfs/inode-item.h
> +++ b/fs/btrfs/inode-item.h
> @@ -64,10 +64,10 @@ int btrfs_truncate_inode_items(struct btrfs_trans_handle *trans,
>  			       struct btrfs_root *root,
>  			       struct btrfs_truncate_control *control);
>  int btrfs_insert_inode_ref(struct btrfs_trans_handle *trans,
> -			   struct btrfs_root *root, const struct qstr *name,
> +			   struct btrfs_root *root, const struct fscrypt_str *name,
>  			   u64 inode_objectid, u64 ref_objectid, u64 index);
>  int btrfs_del_inode_ref(struct btrfs_trans_handle *trans,
> -			struct btrfs_root *root, const struct qstr *name,
> +			struct btrfs_root *root, const struct fscrypt_str *name,
>  			u64 inode_objectid, u64 ref_objectid, u64 *index);
>  int btrfs_insert_empty_inode(struct btrfs_trans_handle *trans,
>  			     struct btrfs_root *root,
> @@ -80,15 +80,15 @@ struct btrfs_inode_extref *btrfs_lookup_inode_extref(
>  			  struct btrfs_trans_handle *trans,
>  			  struct btrfs_root *root,
>  			  struct btrfs_path *path,
> -			  const struct qstr *name,
> +			  const struct fscrypt_str *name,
>  			  u64 inode_objectid, u64 ref_objectid, int ins_len,
>  			  int cow);
>  
>  struct btrfs_inode_ref *btrfs_find_name_in_backref(struct extent_buffer *leaf,
>  						   int slot,
> -						   const struct qstr *name);
> +						   const struct fscrypt_str *name);
>  struct btrfs_inode_extref *btrfs_find_name_in_ext_backref(
>  		struct extent_buffer *leaf, int slot, u64 ref_objectid,
> -		const struct qstr *name);
> +		const struct fscrypt_str *name);
>  
>  #endif
> diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
> index 4c5b2e2d8b5e..b36e1bfdadd5 100644
> --- a/fs/btrfs/inode.c
> +++ b/fs/btrfs/inode.c
> @@ -4284,7 +4284,7 @@ int btrfs_update_inode_fallback(struct btrfs_trans_handle *trans,
>  static int __btrfs_unlink_inode(struct btrfs_trans_handle *trans,
>  				struct btrfs_inode *dir,
>  				struct btrfs_inode *inode,
> -				const struct qstr *name,
> +				const struct fscrypt_str *name,
>  				struct btrfs_rename_ctx *rename_ctx)
>  {
>  	struct btrfs_root *root = dir->root;
> @@ -4387,7 +4387,7 @@ static int __btrfs_unlink_inode(struct btrfs_trans_handle *trans,
>  
>  int btrfs_unlink_inode(struct btrfs_trans_handle *trans,
>  		       struct btrfs_inode *dir, struct btrfs_inode *inode,
> -		       const struct qstr *name)
> +		       const struct fscrypt_str *name)
>  {
>  	int ret;
>  	ret = __btrfs_unlink_inode(trans, dir, inode, name, NULL);
> @@ -4427,13 +4427,11 @@ static int btrfs_unlink(struct inode *dir, struct dentry *dentry)
>  	struct inode *inode = d_inode(dentry);
>  	int ret;
>  	struct fscrypt_name fname;
> -	struct qstr name;
>  
>  	ret = fscrypt_setup_filename(dir, &dentry->d_name, 1, &fname);
>  	if (ret)
>  		return ret;
> -	name = (struct qstr)FSTR_TO_QSTR(&fname.disk_name);
> -
> +	

Whitespace.  Thanks,

Josef

  reply	other threads:[~2022-10-21 20:43 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-20 16:58 [PATCH v3 00/22] btrfs: add fscrypt integration Sweet Tea Dorminy
2022-10-20 16:58 ` [PATCH v3 01/22] fscrypt: expose fscrypt_nokey_name Sweet Tea Dorminy
2022-10-20 16:58 ` [PATCH v3 02/22] fscrypt: add fscrypt_have_same_policy() to check inode compatibility Sweet Tea Dorminy
2022-10-20 20:52   ` Josef Bacik
2022-10-20 16:58 ` [PATCH v3 03/22] fscrypt: allow fscrypt_generate_iv() to distinguish filenames Sweet Tea Dorminy
2022-10-20 16:58 ` [PATCH v3 04/22] fscrypt: add extent-based encryption Sweet Tea Dorminy
2022-10-20 21:40   ` Eric Biggers
2022-10-20 22:20     ` Sweet Tea Dorminy
2022-10-20 21:45   ` Eric Biggers
2022-10-20 22:55     ` Sweet Tea Dorminy
2022-10-20 23:56       ` Eric Biggers
2022-10-21  0:37         ` Sweet Tea Dorminy
2022-10-20 16:58 ` [PATCH v3 05/22] fscrypt: document btrfs' fscrypt quirks Sweet Tea Dorminy
2022-10-20 21:41   ` Eric Biggers
2022-10-20 22:07     ` Sweet Tea Dorminy
2022-10-20 16:58 ` [PATCH v3 06/22] btrfs: use struct qstr instead of name and namelen Sweet Tea Dorminy
2022-10-20 16:58 ` [PATCH v3 07/22] btrfs: setup qstrings from dentrys using fscrypt helper Sweet Tea Dorminy
2022-10-20 16:58 ` [PATCH v3 08/22] btrfs: use struct fscrypt_str instead of struct qstr Sweet Tea Dorminy
2022-10-21 20:42   ` Josef Bacik [this message]
2022-10-20 16:58 ` [PATCH v3 09/22] btrfs: store directory encryption state Sweet Tea Dorminy
2022-10-20 16:58 ` [PATCH v3 10/22] btrfs: disable various operations on encrypted inodes Sweet Tea Dorminy
2022-10-20 16:58 ` [PATCH v3 11/22] btrfs: start using fscrypt hooks Sweet Tea Dorminy
2022-10-20 16:58 ` [PATCH v3 12/22] btrfs: add fscrypt_context items Sweet Tea Dorminy
2022-10-21 20:54   ` Josef Bacik
2022-10-20 16:58 ` [PATCH v3 13/22] btrfs: translate btrfs encryption flags and encrypted inode flag Sweet Tea Dorminy
2022-10-20 16:58 ` [PATCH v3 14/22] btrfs: store a fscrypt extent context per normal file extent Sweet Tea Dorminy
2022-10-20 16:58 ` [PATCH v3 15/22] btrfs: encrypt normal file extent data if appropriate Sweet Tea Dorminy
2022-10-21 20:58   ` Josef Bacik
2022-10-20 16:58 ` [PATCH v3 16/22] btrfs: Add new FEATURE_INCOMPAT_ENCRYPT feature flag Sweet Tea Dorminy
2022-10-20 16:58 ` [PATCH v3 17/22] btrfs: implement fscrypt ioctls Sweet Tea Dorminy
2022-10-20 16:58 ` [PATCH v3 18/22] btrfs: permit searching for nokey names for removal Sweet Tea Dorminy
2022-10-20 16:58 ` [PATCH v3 19/22] btrfs: use correct name hash for nokey names Sweet Tea Dorminy
2022-10-20 16:58 ` [PATCH v3 20/22] btrfs: adapt lookup for partially encrypted directories Sweet Tea Dorminy
2022-10-20 16:58 ` [PATCH v3 21/22] fscrypt: add flag allowing partially-encrypted directories Sweet Tea Dorminy
2022-10-20 16:58 ` [PATCH v3 22/22] btrfs: encrypt verity items Sweet Tea Dorminy
2022-10-20 21:38 ` [PATCH v3 00/22] btrfs: add fscrypt integration Eric Biggers
2022-10-20 23:12   ` David Sterba

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=Y1MEGPa6/YgVfiDy@localhost.localdomain \
    --to=josef@toxicpanda.com \
    --cc=clm@fb.com \
    --cc=dsterba@suse.com \
    --cc=ebiggers@kernel.org \
    --cc=jaegeuk@kernel.org \
    --cc=kernel-team@meta.com \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=linux-fscrypt@vger.kernel.org \
    --cc=sweettea-kernel@dorminy.me \
    --cc=tytso@mit.edu \
    /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.