All of lore.kernel.org
 help / color / mirror / Atom feed
From: Anand Jain <anand.jain@oracle.com>
To: linux-btrfs@vger.kernel.org
Subject: [PATCH RFC 1/5] btrfs: add inode pointer to prop_handler::validate()
Date: Tue, 19 Mar 2019 18:00:20 +0800	[thread overview]
Message-ID: <1552989624-29577-2-git-send-email-anand.jain@oracle.com> (raw)
In-Reply-To: <1552989624-29577-1-git-send-email-anand.jain@oracle.com>

In preparation to add the readmirror devid property, pass inode in the
prop_handler::validate() function vector, so that it can fetch
corresponding fs_devices.

Signed-off-by: Anand Jain <anand.jain@oracle.com>
---
 fs/btrfs/props.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/fs/btrfs/props.c b/fs/btrfs/props.c
index 99fa2459ba61..1a13f10a6ef5 100644
--- a/fs/btrfs/props.c
+++ b/fs/btrfs/props.c
@@ -18,7 +18,7 @@
 struct prop_handler {
 	struct hlist_node node;
 	const char *xattr_name;
-	int (*validate)(const char *value, size_t len);
+	int (*validate)(struct inode *inode, const char *value, size_t len);
 	int (*apply)(struct inode *inode, const char *value, size_t len);
 	const char *(*extract)(struct inode *inode);
 	int inheritable;
@@ -89,7 +89,7 @@ int btrfs_set_prop(struct inode *inode, const char *name, const char *value,
 		goto out;
 	}
 
-	ret = handler->validate(value, value_len);
+	ret = handler->validate(inode, value, value_len);
 	if (ret)
 		return ret;
 
@@ -263,7 +263,8 @@ int btrfs_load_inode_props(struct inode *inode, struct btrfs_path *path)
 	return ret;
 }
 
-static int prop_compression_validate(const char *value, size_t len)
+static int prop_compression_validate(struct inode *inode, const char *value,
+				     size_t len)
 {
 	if (!value)
 		return 0;
@@ -361,7 +362,7 @@ static int inherit_props(struct btrfs_trans_handle *trans,
 			continue;
 
 		/* may be removed */
-		ret = h->validate(value, strlen(value));
+		ret = h->validate(inode, value, strlen(value));
 		if (ret)
 			continue;
 
-- 
1.8.3.1


  reply	other threads:[~2019-03-19 10:00 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-19 10:00 [PATCH RFC 0/5] readmirror feature Anand Jain
2019-03-19 10:00 ` Anand Jain [this message]
2019-03-19 10:00 ` [PATCH RFC 2/5] btrfs: add readmirror pid property Anand Jain
2019-03-19 10:00 ` [PATCH RFC 3/5] btrfs: add readmirror devid property Anand Jain
2019-03-19 10:00 ` [PATCH RFC 4/5] btrfs: add readmirror pid mount option Anand Jain
2019-03-19 10:00 ` [PATCH RFC 5/5] btrfs: add readmirror devid " Anand Jain
2019-03-19 10:02 ` [PATCH RFC 1/2] btrfs-progs: add helper to create xattr name Anand Jain
2019-03-19 10:02   ` [PATCH RFC 2/2] btrfs-progs: add readmirror policy Anand Jain
2019-03-21 16:26 ` [PATCH RFC 0/5] readmirror feature Steven Davies
2019-03-21 18:26   ` waxhead
2019-03-22  6:08   ` Anand Jain
2019-04-09 15:48 ` David Sterba
2019-04-12  9:02   ` Anand Jain

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=1552989624-29577-2-git-send-email-anand.jain@oracle.com \
    --to=anand.jain@oracle.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 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.