Linux Btrfs filesystem development
 help / color / mirror / Atom feed
From: David Sterba <dsterba@suse.com>
To: linux-btrfs@vger.kernel.org
Cc: David Sterba <dsterba@suse.com>
Subject: [PATCH 09/11] btrfs: pass a btrfs_inode to btrfs_set_prop()
Date: Mon, 24 Jun 2024 18:23:22 +0200	[thread overview]
Message-ID: <78792470bbfd5e8964f9fd29fe5dd8f3f103a09b.1719246104.git.dsterba@suse.com> (raw)
In-Reply-To: <cover.1719246104.git.dsterba@suse.com>

Pass a struct btrfs_inode to btrfs_set_prop() as it's an
internal interface, allowing to remove some use of BTRFS_I.

Signed-off-by: David Sterba <dsterba@suse.com>
---
 fs/btrfs/ioctl.c |  8 ++++----
 fs/btrfs/props.c | 14 +++++++-------
 fs/btrfs/props.h |  2 +-
 fs/btrfs/xattr.c |  2 +-
 4 files changed, 13 insertions(+), 13 deletions(-)

diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c
index f30242066ed2..83f773fe429d 100644
--- a/fs/btrfs/ioctl.c
+++ b/fs/btrfs/ioctl.c
@@ -375,15 +375,15 @@ int btrfs_fileattr_set(struct mnt_idmap *idmap,
 		return PTR_ERR(trans);
 
 	if (comp) {
-		ret = btrfs_set_prop(trans, inode, "btrfs.compression", comp,
-				     strlen(comp), 0);
+		ret = btrfs_set_prop(trans, BTRFS_I(inode), "btrfs.compression",
+				     comp, strlen(comp), 0);
 		if (ret) {
 			btrfs_abort_transaction(trans, ret);
 			goto out_end_trans;
 		}
 	} else {
-		ret = btrfs_set_prop(trans, inode, "btrfs.compression", NULL,
-				     0, 0);
+		ret = btrfs_set_prop(trans, BTRFS_I(inode), "btrfs.compression",
+				     NULL, 0, 0);
 		if (ret && ret != -ENODATA) {
 			btrfs_abort_transaction(trans, ret);
 			goto out_end_trans;
diff --git a/fs/btrfs/props.c b/fs/btrfs/props.c
index 5c8e64eaf48b..b8fa34e16abb 100644
--- a/fs/btrfs/props.c
+++ b/fs/btrfs/props.c
@@ -104,7 +104,7 @@ bool btrfs_ignore_prop(const struct btrfs_inode *inode, const char *name)
 	return handler->ignore(inode);
 }
 
-int btrfs_set_prop(struct btrfs_trans_handle *trans, struct inode *inode,
+int btrfs_set_prop(struct btrfs_trans_handle *trans, struct btrfs_inode *inode,
 		   const char *name, const char *value, size_t value_len,
 		   int flags)
 {
@@ -116,29 +116,29 @@ 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,
+		ret = btrfs_setxattr(trans, &inode->vfs_inode, handler->xattr_name,
 				     NULL, 0, flags);
 		if (ret)
 			return ret;
 
-		ret = handler->apply(inode, NULL, 0);
+		ret = handler->apply(&inode->vfs_inode, NULL, 0);
 		ASSERT(ret == 0);
 
 		return ret;
 	}
 
-	ret = btrfs_setxattr(trans, inode, handler->xattr_name, value,
+	ret = btrfs_setxattr(trans, &inode->vfs_inode, handler->xattr_name, value,
 			     value_len, flags);
 	if (ret)
 		return ret;
-	ret = handler->apply(inode, value, value_len);
+	ret = handler->apply(&inode->vfs_inode, value, value_len);
 	if (ret) {
-		btrfs_setxattr(trans, inode, handler->xattr_name, NULL,
+		btrfs_setxattr(trans, &inode->vfs_inode, handler->xattr_name, NULL,
 			       0, flags);
 		return ret;
 	}
 
-	set_bit(BTRFS_INODE_HAS_PROPS, &BTRFS_I(inode)->runtime_flags);
+	set_bit(BTRFS_INODE_HAS_PROPS, &inode->runtime_flags);
 
 	return 0;
 }
diff --git a/fs/btrfs/props.h b/fs/btrfs/props.h
index 24131b29d842..63546d0a9444 100644
--- a/fs/btrfs/props.h
+++ b/fs/btrfs/props.h
@@ -15,7 +15,7 @@ struct btrfs_trans_handle;
 
 int __init btrfs_props_init(void);
 
-int btrfs_set_prop(struct btrfs_trans_handle *trans, struct inode *inode,
+int btrfs_set_prop(struct btrfs_trans_handle *trans, struct btrfs_inode *inode,
 		   const char *name, const char *value, size_t value_len,
 		   int flags);
 int btrfs_validate_prop(const struct btrfs_inode *inode, const char *name,
diff --git a/fs/btrfs/xattr.c b/fs/btrfs/xattr.c
index 0288fe541dca..738c7bb8ea7c 100644
--- a/fs/btrfs/xattr.c
+++ b/fs/btrfs/xattr.c
@@ -451,7 +451,7 @@ static int btrfs_xattr_handler_set_prop(const struct xattr_handler *handler,
 	if (IS_ERR(trans))
 		return PTR_ERR(trans);
 
-	ret = btrfs_set_prop(trans, inode, name, value, size, flags);
+	ret = btrfs_set_prop(trans, BTRFS_I(inode), name, value, size, flags);
 	if (!ret) {
 		inode_inc_iversion(inode);
 		inode_set_ctime_current(inode);
-- 
2.45.0


  parent reply	other threads:[~2024-06-24 16:23 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-24 16:22 [PATCH 00/11] Inode type conversion David Sterba
2024-06-24 16:23 ` [PATCH 01/11] btrfs: pass a btrfs_inode to btrfs_readdir_put_delayed_items() David Sterba
2024-06-24 16:23 ` [PATCH 02/11] btrfs: pass a btrfs_inode to btrfs_readdir_get_delayed_items() David Sterba
2024-06-24 16:23 ` [PATCH 03/11] btrfs: pass a btrfs_inode to is_data_inode() David Sterba
2024-06-24 16:23 ` [PATCH 04/11] btrfs: switch btrfs_block_group::inode to struct btrfs_inode David Sterba
2024-06-24 16:23 ` [PATCH 05/11] btrfs: pass a btrfs_inode to btrfs_ioctl_send() David Sterba
2024-06-24 16:23 ` [PATCH 06/11] btrfs: switch btrfs_pending_snapshot::dir to btrfs_inode David Sterba
2024-06-24 16:23 ` [PATCH 07/11] btrfs: switch btrfs_ordered_extent::inode to struct btrfs_inode David Sterba
2024-06-24 16:23 ` [PATCH 08/11] btrfs: pass a btrfs_inode to btrfs_compress_heuristic() David Sterba
2024-06-24 16:23 ` David Sterba [this message]
2024-06-24 16:23 ` [PATCH 10/11] btrfs: pass a btrfs_inode to btrfs_load_inode_props() David Sterba
2024-06-24 16:23 ` [PATCH 11/11] btrfs: pass a btrfs_inode to btrfs_inode_inherit_props() David Sterba
2024-06-24 18:41 ` [PATCH 00/11] Inode type conversion Boris Burkov
2024-06-26 14:06 ` Filipe Manana
2024-06-26 14:39   ` 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=78792470bbfd5e8964f9fd29fe5dd8f3f103a09b.1719246104.git.dsterba@suse.com \
    --to=dsterba@suse.com \
    --cc=linux-btrfs@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox