From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx1.redhat.com ([209.132.183.28]:38422 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728372AbeLJRNf (ORCPT ); Mon, 10 Dec 2018 12:13:35 -0500 From: Vivek Goyal To: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, kvm@vger.kernel.org Cc: vgoyal@redhat.com, miklos@szeredi.hu, stefanha@redhat.com, dgilbert@redhat.com, sweil@redhat.com, swhiteho@redhat.com Subject: [PATCH 19/52] virito-fs: Make dax optional Date: Mon, 10 Dec 2018 12:12:45 -0500 Message-Id: <20181210171318.16998-20-vgoyal@redhat.com> In-Reply-To: <20181210171318.16998-1-vgoyal@redhat.com> References: <20181210171318.16998-1-vgoyal@redhat.com> Sender: linux-fsdevel-owner@vger.kernel.org List-ID: From: "Dr. David Alan Gilbert" Add a 'dax' option and only enable dax when it's on. Also show "dax" in mount options if filesystem was mounted with dax enabled. Signed-off-by: Dr. David Alan Gilbert Signed-off-by: Vivek Goyal --- fs/fuse/fuse_i.h | 1 + fs/fuse/inode.c | 8 ++++++++ fs/fuse/virtio_fs.c | 2 +- 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/fs/fuse/fuse_i.h b/fs/fuse/fuse_i.h index b5a6a12e67d6..345abe9b022f 100644 --- a/fs/fuse/fuse_i.h +++ b/fs/fuse/fuse_i.h @@ -70,6 +70,7 @@ struct fuse_mount_data { unsigned group_id_present:1; unsigned default_permissions:1; unsigned allow_other:1; + unsigned dax:1; unsigned max_read; unsigned blksize; }; diff --git a/fs/fuse/inode.c b/fs/fuse/inode.c index 10e4a39318c4..d2afce377fd4 100644 --- a/fs/fuse/inode.c +++ b/fs/fuse/inode.c @@ -439,6 +439,7 @@ enum { OPT_ALLOW_OTHER, OPT_MAX_READ, OPT_BLKSIZE, + OPT_DAX, OPT_ERR }; @@ -452,6 +453,7 @@ static const match_table_t tokens = { {OPT_ALLOW_OTHER, "allow_other"}, {OPT_MAX_READ, "max_read=%u"}, {OPT_BLKSIZE, "blksize=%u"}, + {OPT_DAX, "dax"}, {OPT_ERR, NULL} }; @@ -543,6 +545,10 @@ int parse_fuse_opt(char *opt, struct fuse_mount_data *d, int is_bdev, d->blksize = value; break; + case OPT_DAX: + d->dax = 1; + break; + default: return 0; } @@ -571,6 +577,8 @@ static int fuse_show_options(struct seq_file *m, struct dentry *root) seq_printf(m, ",max_read=%u", fc->max_read); if (sb->s_bdev && sb->s_blocksize != FUSE_DEFAULT_BLKSIZE) seq_printf(m, ",blksize=%lu", sb->s_blocksize); + if (fc->dax_dev) + seq_printf(m, ",dax"); return 0; } diff --git a/fs/fuse/virtio_fs.c b/fs/fuse/virtio_fs.c index 55bac1465536..e4d5e0cd41ba 100644 --- a/fs/fuse/virtio_fs.c +++ b/fs/fuse/virtio_fs.c @@ -1050,7 +1050,7 @@ static int virtio_fs_fill_super(struct super_block *sb, void *data, /* TODO this sends FUSE_INIT and could cause hiprio or notifications * virtqueue races since they haven't been set up yet! */ - err = fuse_fill_super_common(sb, &d, fs->dax_dev, + err = fuse_fill_super_common(sb, &d, d.dax ? fs->dax_dev : NULL, &virtio_fs_fiq_ops, fs, (void **)&fs->vqs[2].fud); if (err < 0) -- 2.13.6