From: Goldwyn Rodrigues <rgoldwyn@xxxxxxxx> The mount option to use shared pages for shared extents. If set, pass custom file_offset_to_device function to filemap_read(). sharedext may not describe it well. Suggest a better name? TODO Checks: Check if the pagesize == blocksize Signed-off-by: Goldwyn Rodrigues <rgoldwyn@xxxxxxxx> --- fs/btrfs/ctree.h | 1 + fs/btrfs/super.c | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h index 4aa4f4760b72..5c97112143d6 100644 --- a/fs/btrfs/ctree.h +++ b/fs/btrfs/ctree.h @@ -1415,6 +1415,7 @@ enum { BTRFS_MOUNT_DISCARD_ASYNC = (1UL << 28), BTRFS_MOUNT_IGNOREBADROOTS = (1UL << 29), BTRFS_MOUNT_IGNOREDATACSUMS = (1UL << 30), + BTRFS_MOUNT_SHAREDEXT = (1UL << 31), }; #define BTRFS_DEFAULT_COMMIT_INTERVAL (30) diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c index d07b18b2b250..432f40f72466 100644 --- a/fs/btrfs/super.c +++ b/fs/btrfs/super.c @@ -397,6 +397,7 @@ enum { #ifdef CONFIG_BTRFS_FS_REF_VERIFY Opt_ref_verify, #endif + Opt_sharedext, Opt_err, }; @@ -471,6 +472,7 @@ static const match_table_t tokens = { #ifdef CONFIG_BTRFS_FS_REF_VERIFY {Opt_ref_verify, "ref_verify"}, #endif + {Opt_sharedext, "sharedext"}, {Opt_err, NULL}, }; @@ -1013,6 +1015,10 @@ int btrfs_parse_options(struct btrfs_fs_info *info, char *options, btrfs_set_opt(info->mount_opt, REF_VERIFY); break; #endif + case Opt_sharedext: + btrfs_info(info, "enabling shared memory for shared extents"); + btrfs_set_opt(info->mount_opt, SHAREDEXT); + break; case Opt_err: btrfs_err(info, "unrecognized mount option '%s'", p); ret = -EINVAL; -- 2.33.1