From: Anand Jain <anand.jain@oracle.com>
To: linux-btrfs@vger.kernel.org
Subject: [PATCH v2 3/3] btrfs: read_mirror_policy ability to reset
Date: Wed, 16 May 2018 18:03:59 +0800 [thread overview]
Message-ID: <20180516100359.7752-4-anand.jain@oracle.com> (raw)
In-Reply-To: <20180516100359.7752-1-anand.jain@oracle.com>
Adds an ability to change the read_mirror_policy at remount.
Signed-off-by: Anand Jain <anand.jain@oracle.com>
---
fs/btrfs/super.c | 19 ++++++++++++++++---
1 file changed, 16 insertions(+), 3 deletions(-)
diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c
index 7ddecf4178a6..e70592036b95 100644
--- a/fs/btrfs/super.c
+++ b/fs/btrfs/super.c
@@ -856,6 +856,12 @@ int btrfs_parse_options(struct btrfs_fs_info *info, char *options,
intarg = 0;
if (match_int(&args[0], &intarg) == 0) {
struct btrfs_device *device;
+ int clear = 0;
+
+ if (intarg < 0) {
+ clear = 1;
+ intarg = -intarg;
+ }
device = btrfs_find_device(info, intarg,
NULL, NULL);
@@ -866,10 +872,17 @@ int btrfs_parse_options(struct btrfs_fs_info *info, char *options,
ret = -EINVAL;
goto out;
}
- info->read_mirror_policy =
+
+ if (clear) {
+ info->read_mirror_policy = 0;
+ clear_bit(BTRFS_DEV_STATE_READ_MIRROR,
+ &device->dev_state);
+ } else {
+ info->read_mirror_policy =
BTRFS_READ_MIRROR_BY_DEV;
- set_bit(BTRFS_DEV_STATE_READ_MIRROR,
- &device->dev_state);
+ set_bit(BTRFS_DEV_STATE_READ_MIRROR,
+ &device->dev_state);
+ }
break;
}
--
2.7.0
next prev parent reply other threads:[~2018-05-16 10:01 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-05-16 10:03 [PATCH v2 0/3] btrfs: add read mirror policy Anand Jain
2018-05-16 10:03 ` [PATCH v2 1/3] btrfs: add mount option read_mirror_policy Anand Jain
2018-05-16 10:03 ` [PATCH v2 2/3] btrfs: add read_mirror_policy parameter devid Anand Jain
2019-01-21 11:56 ` Steven Davies
2019-01-22 13:43 ` Anand Jain
2019-01-22 14:28 ` Steven Davies
2018-05-16 10:03 ` Anand Jain [this message]
2018-05-16 22:35 ` [PATCH v2 0/3] btrfs: add read mirror policy David Sterba
2018-05-17 2:32 ` Anand Jain
2018-05-17 12:25 ` Austin S. Hemmelgarn
2018-05-17 14:46 ` Jeff Mahoney
2018-05-18 8:06 ` Anand Jain
2018-05-18 12:36 ` Austin S. Hemmelgarn
2018-05-17 14:46 ` Jeff Mahoney
2018-05-17 15:22 ` Austin S. Hemmelgarn
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=20180516100359.7752-4-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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).