This patch adds mount option -o readmirror, which provides a transient
readmirror feature, which can be used in a readonly mount as well.
For example..
mount -o readmirror=pid
Signed-off-by: Anand Jain <anand.jain@xxxxxxxxxx>
---
fs/btrfs/super.c | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c
index e01fc68af6c1..9d25a01bcecb 100644
--- a/fs/btrfs/super.c
+++ b/fs/btrfs/super.c
@@ -343,6 +343,7 @@ enum {
#ifdef CONFIG_BTRFS_FS_REF_VERIFY
Opt_ref_verify,
#endif
+ Opt_readmirror_policy,
Opt_err,
};
@@ -413,6 +414,7 @@ enum {
#ifdef CONFIG_BTRFS_FS_REF_VERIFY
{Opt_ref_verify, "ref_verify"},
#endif
+ {Opt_readmirror_policy, "readmirror=%s"},
{Opt_err, NULL},
};
@@ -850,6 +852,14 @@ int btrfs_parse_options(struct btrfs_fs_info *info, char *options,
btrfs_set_opt(info->mount_opt, REF_VERIFY);
break;
#endif
+ case Opt_readmirror_policy:
+ if (strcmp(args[0].from, "pid") == 0) {
+ info->fs_devices->readmirror_policy =
+ BTRFS_READMIRROR_PID;
+ break;
+ }
+ ret = -EINVAL;
+ goto out;
case Opt_err:
btrfs_info(info, "unrecognized mount option '%s'", p);
ret = -EINVAL;
--
1.8.3.1