linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Vivek Goyal <vgoyal@redhat.com>
To: Jeffle Xu <jefflexu@linux.alibaba.com>
Cc: stefanha@redhat.com, miklos@szeredi.hu, virtio-fs@redhat.com,
	linux-fsdevel@vger.kernel.org, joseph.qi@linux.alibaba.com
Subject: Re: [PATCH v8 5/7] fuse: negotiate per inode DAX in FUSE_INIT
Date: Mon, 13 Dec 2021 13:10:24 -0500	[thread overview]
Message-ID: <YbeMkISPOnD10nOZ@redhat.com> (raw)
In-Reply-To: <20211125070530.79602-6-jefflexu@linux.alibaba.com>

On Thu, Nov 25, 2021 at 03:05:28PM +0800, Jeffle Xu wrote:
> Among the FUSE_INIT phase, client shall advertise per inode DAX if it's
> mounted with "dax=inode". Then server is aware that client is in per
> inode DAX mode, and will construct per-inode DAX attribute accordingly.
> 
> Server shall also advertise support for per inode DAX. If server doesn't
> support it while client is mounted with "dax=inode", client will
> silently fallback to "dax=never" since "dax=inode" is advisory only.
> 
> Signed-off-by: Jeffle Xu <jefflexu@linux.alibaba.com>

Reviewed-by: Vivek Goyal <vgoyal@redhat.com>

Vivek
> ---
>  fs/fuse/dax.c    |  2 +-
>  fs/fuse/fuse_i.h |  3 +++
>  fs/fuse/inode.c  | 13 +++++++++----
>  3 files changed, 13 insertions(+), 5 deletions(-)
> 
> diff --git a/fs/fuse/dax.c b/fs/fuse/dax.c
> index 1550c3624414..234c2278420f 100644
> --- a/fs/fuse/dax.c
> +++ b/fs/fuse/dax.c
> @@ -1351,7 +1351,7 @@ static bool fuse_should_enable_dax(struct inode *inode, unsigned int flags)
>  		return true;
>  
>  	/* dax_mode is FUSE_DAX_INODE* */
> -	return flags & FUSE_ATTR_DAX;
> +	return fc->inode_dax && (flags & FUSE_ATTR_DAX);
>  }
>  
>  void fuse_dax_inode_init(struct inode *inode, unsigned int flags)
> diff --git a/fs/fuse/fuse_i.h b/fs/fuse/fuse_i.h
> index f03ea7cb74b0..83970723314a 100644
> --- a/fs/fuse/fuse_i.h
> +++ b/fs/fuse/fuse_i.h
> @@ -777,6 +777,9 @@ struct fuse_conn {
>  	/* Propagate syncfs() to server */
>  	unsigned int sync_fs:1;
>  
> +	/* Does the filesystem support per inode DAX? */
> +	unsigned int inode_dax:1;
> +
>  	/** The number of requests waiting for completion */
>  	atomic_t num_waiting;
>  
> diff --git a/fs/fuse/inode.c b/fs/fuse/inode.c
> index 0669e41a9645..b26612fce6d0 100644
> --- a/fs/fuse/inode.c
> +++ b/fs/fuse/inode.c
> @@ -1169,10 +1169,13 @@ static void process_init_reply(struct fuse_mount *fm, struct fuse_args *args,
>  					min_t(unsigned int, fc->max_pages_limit,
>  					max_t(unsigned int, arg->max_pages, 1));
>  			}
> -			if (IS_ENABLED(CONFIG_FUSE_DAX) &&
> -			    arg->flags & FUSE_MAP_ALIGNMENT &&
> -			    !fuse_dax_check_alignment(fc, arg->map_alignment)) {
> -				ok = false;
> +			if (IS_ENABLED(CONFIG_FUSE_DAX)) {
> +				if (arg->flags & FUSE_MAP_ALIGNMENT &&
> +				    !fuse_dax_check_alignment(fc, arg->map_alignment)) {
> +					ok = false;
> +				}
> +				if (arg->flags & FUSE_HAS_INODE_DAX)
> +					fc->inode_dax = 1;
>  			}
>  			if (arg->flags & FUSE_HANDLE_KILLPRIV_V2) {
>  				fc->handle_killpriv_v2 = 1;
> @@ -1227,6 +1230,8 @@ void fuse_send_init(struct fuse_mount *fm)
>  #ifdef CONFIG_FUSE_DAX
>  	if (fm->fc->dax)
>  		ia->in.flags |= FUSE_MAP_ALIGNMENT;
> +	if (fuse_is_inode_dax_mode(fm->fc->dax_mode))
> +		ia->in.flags |= FUSE_HAS_INODE_DAX;
>  #endif
>  	if (fm->fc->auto_submounts)
>  		ia->in.flags |= FUSE_SUBMOUNTS;
> -- 
> 2.27.0
> 


  reply	other threads:[~2021-12-13 18:11 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-25  7:05 [PATCH v8 0/7] fuse,virtiofs: support per-file DAX Jeffle Xu
2021-11-25  7:05 ` [PATCH v8 1/7] fuse: add fuse_should_enable_dax() helper Jeffle Xu
2021-12-13 18:08   ` Vivek Goyal
2021-11-25  7:05 ` [PATCH v8 2/7] fuse: make DAX mount option a tri-state Jeffle Xu
2021-12-13 18:09   ` Vivek Goyal
2021-11-25  7:05 ` [PATCH v8 3/7] fuse: support per inode DAX in fuse protocol Jeffle Xu
2021-12-13 18:09   ` Vivek Goyal
2021-11-25  7:05 ` [PATCH v8 4/7] fuse: enable per inode DAX Jeffle Xu
2021-12-13 18:10   ` Vivek Goyal
2021-11-25  7:05 ` [PATCH v8 5/7] fuse: negotiate per inode DAX in FUSE_INIT Jeffle Xu
2021-12-13 18:10   ` Vivek Goyal [this message]
2021-11-25  7:05 ` [PATCH v8 6/7] fuse: mark inode DONT_CACHE when per inode DAX hint changes Jeffle Xu
2021-12-07 16:00   ` Vivek Goyal
2021-12-08  1:36     ` JeffleXu
2021-12-13 18:10   ` Vivek Goyal
2021-11-25  7:05 ` [PATCH v8 7/7] Documentation/filesystem/dax: DAX on virtiofs Jeffle Xu
2021-12-13 18:11   ` Vivek Goyal
2021-12-13 18:12 ` [PATCH v8 0/7] fuse,virtiofs: support per-file DAX Vivek Goyal

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=YbeMkISPOnD10nOZ@redhat.com \
    --to=vgoyal@redhat.com \
    --cc=jefflexu@linux.alibaba.com \
    --cc=joseph.qi@linux.alibaba.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=miklos@szeredi.hu \
    --cc=stefanha@redhat.com \
    --cc=virtio-fs@redhat.com \
    /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).