Message ID | 1481147110-20048-2-git-send-email-bo.li.liu@oracle.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Hi Liu, [auto build test WARNING on tip/perf/core] [also build test WARNING on v4.9-rc8 next-20161207] [cannot apply to btrfs/next] [if your patch is applied to the wrong git tree, please drop us a note to help improve the system] url: https://github.com/0day-ci/linux/commits/Liu-Bo/btrfs-dax-IO/20161208-082651 config: x86_64-randconfig-s2-12081004 (attached as .config) compiler: gcc-4.4 (Debian 4.4.7-8) 4.4.7 reproduce: # save the attached .config to linux build tree make ARCH=x86_64 All warnings (new ones prefixed by >>): fs/btrfs/super.c: In function 'btrfs_parse_options': >> fs/btrfs/super.c:414: warning: unused variable 'set_bdev' fs/btrfs/super.o: warning: objtool: btrfs_statfs()+0x2af: function has unreachable instruction vim +/set_bdev +414 fs/btrfs/super.c 398 * XXX JDM: This needs to be cleaned up for remount. 399 */ 400 int btrfs_parse_options(struct btrfs_root *root, char *options, 401 unsigned long new_flags) 402 { 403 struct btrfs_fs_info *info = root->fs_info; 404 substring_t args[MAX_OPT_ARGS]; 405 char *p, *num, *orig = NULL; 406 u64 cache_gen; 407 int intarg; 408 int ret = 0; 409 char *compress_type; 410 bool compress_force = false; 411 enum btrfs_compression_type saved_compress_type; 412 bool saved_compress_force; 413 int no_compress = 0; > 414 int set_bdev = 0; 415 416 cache_gen = btrfs_super_cache_generation(root->fs_info->super_copy); 417 if (btrfs_fs_compat_ro(root->fs_info, FREE_SPACE_TREE)) 418 btrfs_set_opt(info->mount_opt, FREE_SPACE_TREE); 419 else if (cache_gen) 420 btrfs_set_opt(info->mount_opt, SPACE_CACHE); 421 422 /* --- 0-DAY kernel test infrastructure Open Source Technology Center https://lists.01.org/pipermail/kbuild-all Intel Corporation
On Wed, Dec 07, 2016 at 01:45:05PM -0800, Liu Bo wrote: > Signed-off-by: Liu Bo <bo.li.liu@oracle.com> > --- > fs/btrfs/ctree.h | 1 + > fs/btrfs/super.c | 40 +++++++++++++++++++++++++++++++++++++++- > 2 files changed, 40 insertions(+), 1 deletion(-) > > diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h > index 0b8ce2b..e54c6e6 100644 > --- a/fs/btrfs/ctree.h > +++ b/fs/btrfs/ctree.h > @@ -1317,6 +1317,7 @@ static inline u32 BTRFS_MAX_XATTR_SIZE(const struct btrfs_root *root) > #define BTRFS_MOUNT_FRAGMENT_METADATA (1 << 25) > #define BTRFS_MOUNT_FREE_SPACE_TREE (1 << 26) > #define BTRFS_MOUNT_NOLOGREPLAY (1 << 27) > +#define BTRFS_MOUNT_DAX (1 << 28) > > #define BTRFS_DEFAULT_COMMIT_INTERVAL (30) > #define BTRFS_DEFAULT_MAX_INLINE (2048) > diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c > index 74ed5aa..9b18f3d 100644 > --- a/fs/btrfs/super.c > +++ b/fs/btrfs/super.c > @@ -323,7 +323,7 @@ enum { > Opt_commit_interval, Opt_barrier, Opt_nodefrag, Opt_nodiscard, > Opt_noenospc_debug, Opt_noflushoncommit, Opt_acl, Opt_datacow, > Opt_datasum, Opt_treelog, Opt_noinode_cache, Opt_usebackuproot, > - Opt_nologreplay, Opt_norecovery, > + Opt_nologreplay, Opt_norecovery, Opt_dax, Can we please not create more filesystems with a DAX mount option? This was only even an enabler, and not meant to be a permanent thing. The permanent functionality for DAX is supposed to be per-inode inheritable DAX flags - not mount options - so that applications can choose on a per file basis to enable/disable DAX access as they see fit. This also enables the filesystem to reject the attempt to turn on DAX if the set of contexts for the file are not DAX compatible.... Cheers, Dave.
On Fri, Dec 09, 2016 at 03:47:20PM +1100, Dave Chinner wrote: > On Wed, Dec 07, 2016 at 01:45:05PM -0800, Liu Bo wrote: > > Signed-off-by: Liu Bo <bo.li.liu@oracle.com> > > --- > > fs/btrfs/ctree.h | 1 + > > fs/btrfs/super.c | 40 +++++++++++++++++++++++++++++++++++++++- > > 2 files changed, 40 insertions(+), 1 deletion(-) > > > > diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h > > index 0b8ce2b..e54c6e6 100644 > > --- a/fs/btrfs/ctree.h > > +++ b/fs/btrfs/ctree.h > > @@ -1317,6 +1317,7 @@ static inline u32 BTRFS_MAX_XATTR_SIZE(const struct btrfs_root *root) > > #define BTRFS_MOUNT_FRAGMENT_METADATA (1 << 25) > > #define BTRFS_MOUNT_FREE_SPACE_TREE (1 << 26) > > #define BTRFS_MOUNT_NOLOGREPLAY (1 << 27) > > +#define BTRFS_MOUNT_DAX (1 << 28) > > > > #define BTRFS_DEFAULT_COMMIT_INTERVAL (30) > > #define BTRFS_DEFAULT_MAX_INLINE (2048) > > diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c > > index 74ed5aa..9b18f3d 100644 > > --- a/fs/btrfs/super.c > > +++ b/fs/btrfs/super.c > > @@ -323,7 +323,7 @@ enum { > > Opt_commit_interval, Opt_barrier, Opt_nodefrag, Opt_nodiscard, > > Opt_noenospc_debug, Opt_noflushoncommit, Opt_acl, Opt_datacow, > > Opt_datasum, Opt_treelog, Opt_noinode_cache, Opt_usebackuproot, > > - Opt_nologreplay, Opt_norecovery, > > + Opt_nologreplay, Opt_norecovery, Opt_dax, > > Can we please not create more filesystems with a DAX mount option? > This was only even an enabler, and not meant to be a permanent > thing. The permanent functionality for DAX is supposed to be > per-inode inheritable DAX flags - not mount options - so that > applications can choose on a per file basis to enable/disable DAX > access as they see fit. > > This also enables the filesystem to reject the attempt to turn on > DAX if the set of contexts for the file are not DAX compatible.... Sounds good, I'll try to update it to use inode DAX flag directly. Thanks, -liubo -- To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
On Fri, Dec 09, 2016 at 10:41:34AM -0800, Liu Bo wrote: > On Fri, Dec 09, 2016 at 03:47:20PM +1100, Dave Chinner wrote: > > On Wed, Dec 07, 2016 at 01:45:05PM -0800, Liu Bo wrote: > > > Signed-off-by: Liu Bo <bo.li.liu@oracle.com> > > > --- > > > fs/btrfs/ctree.h | 1 + > > > fs/btrfs/super.c | 40 +++++++++++++++++++++++++++++++++++++++- > > > 2 files changed, 40 insertions(+), 1 deletion(-) > > > > > > diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h > > > index 0b8ce2b..e54c6e6 100644 > > > --- a/fs/btrfs/ctree.h > > > +++ b/fs/btrfs/ctree.h > > > @@ -1317,6 +1317,7 @@ static inline u32 BTRFS_MAX_XATTR_SIZE(const struct btrfs_root *root) > > > #define BTRFS_MOUNT_FRAGMENT_METADATA (1 << 25) > > > #define BTRFS_MOUNT_FREE_SPACE_TREE (1 << 26) > > > #define BTRFS_MOUNT_NOLOGREPLAY (1 << 27) > > > +#define BTRFS_MOUNT_DAX (1 << 28) > > > > > > #define BTRFS_DEFAULT_COMMIT_INTERVAL (30) > > > #define BTRFS_DEFAULT_MAX_INLINE (2048) > > > diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c > > > index 74ed5aa..9b18f3d 100644 > > > --- a/fs/btrfs/super.c > > > +++ b/fs/btrfs/super.c > > > @@ -323,7 +323,7 @@ enum { > > > Opt_commit_interval, Opt_barrier, Opt_nodefrag, Opt_nodiscard, > > > Opt_noenospc_debug, Opt_noflushoncommit, Opt_acl, Opt_datacow, > > > Opt_datasum, Opt_treelog, Opt_noinode_cache, Opt_usebackuproot, > > > - Opt_nologreplay, Opt_norecovery, > > > + Opt_nologreplay, Opt_norecovery, Opt_dax, > > > > Can we please not create more filesystems with a DAX mount option? > > This was only even an enabler, and not meant to be a permanent > > thing. The permanent functionality for DAX is supposed to be > > per-inode inheritable DAX flags - not mount options - so that > > applications can choose on a per file basis to enable/disable DAX > > access as they see fit. > > > > This also enables the filesystem to reject the attempt to turn on > > DAX if the set of contexts for the file are not DAX compatible.... > > Sounds good, I'll try to update it to use inode DAX flag directly. xfs_io already has chattr/lsattr support (+/-x) for the FS_XFLAG_DAX flag in FS_IOC_FS{GS}ETXATTR, and you can have a look at the XFS code in xfs_ioctl.c for the operations that are needed to dynamically change the S_DAX flag on an inode (e.g xfs_ioctl_setattr_dax_invalidate()) Cheers, Dave.
diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h index 0b8ce2b..e54c6e6 100644 --- a/fs/btrfs/ctree.h +++ b/fs/btrfs/ctree.h @@ -1317,6 +1317,7 @@ static inline u32 BTRFS_MAX_XATTR_SIZE(const struct btrfs_root *root) #define BTRFS_MOUNT_FRAGMENT_METADATA (1 << 25) #define BTRFS_MOUNT_FREE_SPACE_TREE (1 << 26) #define BTRFS_MOUNT_NOLOGREPLAY (1 << 27) +#define BTRFS_MOUNT_DAX (1 << 28) #define BTRFS_DEFAULT_COMMIT_INTERVAL (30) #define BTRFS_DEFAULT_MAX_INLINE (2048) diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c index 74ed5aa..9b18f3d 100644 --- a/fs/btrfs/super.c +++ b/fs/btrfs/super.c @@ -323,7 +323,7 @@ enum { Opt_commit_interval, Opt_barrier, Opt_nodefrag, Opt_nodiscard, Opt_noenospc_debug, Opt_noflushoncommit, Opt_acl, Opt_datacow, Opt_datasum, Opt_treelog, Opt_noinode_cache, Opt_usebackuproot, - Opt_nologreplay, Opt_norecovery, + Opt_nologreplay, Opt_norecovery, Opt_dax, #ifdef CONFIG_BTRFS_DEBUG Opt_fragment_data, Opt_fragment_metadata, Opt_fragment_all, #endif @@ -383,6 +383,7 @@ static const match_table_t tokens = { {Opt_rescan_uuid_tree, "rescan_uuid_tree"}, {Opt_fatal_errors, "fatal_errors=%s"}, {Opt_commit_interval, "commit=%d"}, + {Opt_dax, "dax"}, #ifdef CONFIG_BTRFS_DEBUG {Opt_fragment_data, "fragment=data"}, {Opt_fragment_metadata, "fragment=metadata"}, @@ -410,6 +411,7 @@ int btrfs_parse_options(struct btrfs_root *root, char *options, enum btrfs_compression_type saved_compress_type; bool saved_compress_force; int no_compress = 0; + int set_bdev = 0; cache_gen = btrfs_super_cache_generation(root->fs_info->super_copy); if (btrfs_fs_compat_ro(root->fs_info, FREE_SPACE_TREE)) @@ -470,6 +472,40 @@ int btrfs_parse_options(struct btrfs_root *root, char *options, btrfs_clear_opt(info->mount_opt, NODATACOW); btrfs_clear_opt(info->mount_opt, NODATASUM); break; +#ifdef CONFIG_FS_DAX + case Opt_dax: + btrfs_set_and_info(info, DAX, "setting dax"); + /* + * sb->s_blocksize is set to root->sectorsize + * sb->s_bdev is required, but btrfs doesn't set it + * because of multi-device, so here we set it + * temporarily. + * We allows only one device in dax case. + */ + if (!info->sb->s_bdev) { + info->sb->s_bdev = info->fs_devices->latest_bdev; + set_bdev = 1; + } + ret = bdev_dax_supported(info->sb, info->sb->s_blocksize); + if (set_bdev) + info->sb->s_bdev = NULL; + if (ret) + goto out; + + /* dax inode doesn't need inline. */ + info->max_inline = 0; + btrfs_info(info, "max_inline at %llu", info->max_inline); + + btrfs_clear_opt(info->mount_opt, COMPRESS); + btrfs_clear_opt(info->mount_opt, FORCE_COMPRESS); + btrfs_set_opt(info->mount_opt, NODATACOW); + btrfs_set_opt(info->mount_opt, NODATASUM); + btrfs_info(info, + "setting nodatacow, compression disabled"); + + /* dax doesn't expect other fancy options. */ + goto out; +#endif case Opt_nodatacow: if (!btrfs_test_opt(info, NODATACOW)) { if (!btrfs_test_opt(info, COMPRESS) || @@ -1232,6 +1268,8 @@ static int btrfs_show_options(struct seq_file *seq, struct dentry *dentry) seq_puts(seq, ",nodatasum"); if (btrfs_test_opt(info, NODATACOW)) seq_puts(seq, ",nodatacow"); + if (btrfs_test_opt(info, DAX)) + seq_puts(seq, ",dax"); if (btrfs_test_opt(info, NOBARRIER)) seq_puts(seq, ",nobarrier"); if (info->max_inline != BTRFS_DEFAULT_MAX_INLINE)
Signed-off-by: Liu Bo <bo.li.liu@oracle.com> --- fs/btrfs/ctree.h | 1 + fs/btrfs/super.c | 40 +++++++++++++++++++++++++++++++++++++++- 2 files changed, 40 insertions(+), 1 deletion(-)