From: Vivek Goyal <vgoyal@redhat.com>
To: Jeffle Xu <jefflexu@linux.alibaba.com>
Cc: stefanha@redhat.com, miklos@szeredi.hub,
linux-fsdevel@vger.kernel.org, virtio-fs@redhat.com,
bo.liu@linux.alibaba.com, joseph.qi@linux.alibaba.com
Subject: Re: [PATCH v6 6/7] fuse: mark inode DONT_CACHE when per-file DAX hint changes
Date: Mon, 18 Oct 2021 11:19:20 -0400 [thread overview]
Message-ID: <YW2QeIdS2X48FOHk@redhat.com> (raw)
In-Reply-To: <20211011030052.98923-7-jefflexu@linux.alibaba.com>
On Mon, Oct 11, 2021 at 11:00:51AM +0800, Jeffle Xu wrote:
> When the per-file DAX hint changes while the file is still *opened*, it
> is quite complicated and maybe fragile to dynamically change the DAX
> state.
>
> Hence mark the inode and corresponding dentries as DONE_CACHE once the
> per-file DAX hint changes, so that the inode instance will be evicted
> and freed as soon as possible once the file is closed and the last
> reference to the inode is put. And then when the file gets reopened next
> time, the new instantiated inode will reflect the new DAX state.
>
> In summary, when the per-file DAX hint changes for an *opened* file, the
> DAX state of the file won't be updated until this file is closed and
> reopened later.
>
> Signed-off-by: Jeffle Xu <jefflexu@linux.alibaba.com>
> ---
> fs/fuse/dax.c | 9 +++++++++
> fs/fuse/fuse_i.h | 1 +
> fs/fuse/inode.c | 3 +++
> 3 files changed, 13 insertions(+)
>
> diff --git a/fs/fuse/dax.c b/fs/fuse/dax.c
> index 15bde36829b8..ca083c13f5e8 100644
> --- a/fs/fuse/dax.c
> +++ b/fs/fuse/dax.c
> @@ -1364,6 +1364,15 @@ void fuse_dax_inode_init(struct inode *inode, unsigned int flags)
> inode->i_data.a_ops = &fuse_dax_file_aops;
> }
>
> +void fuse_dax_dontcache(struct inode *inode, unsigned int flags)
> +{
> + struct fuse_conn *fc = get_fuse_conn(inode);
> +
> + if (fc->dax_mode == FUSE_DAX_INODE &&
> + (!!IS_DAX(inode) != !!(flags & FUSE_ATTR_DAX)))
> + d_mark_dontcache(inode);
> +}
> +
> bool fuse_dax_check_alignment(struct fuse_conn *fc, unsigned int map_alignment)
> {
> if (fc->dax && (map_alignment > FUSE_DAX_SHIFT)) {
> diff --git a/fs/fuse/fuse_i.h b/fs/fuse/fuse_i.h
> index 0270a41c31d7..bb2c11e0311a 100644
> --- a/fs/fuse/fuse_i.h
> +++ b/fs/fuse/fuse_i.h
> @@ -1270,6 +1270,7 @@ void fuse_dax_conn_free(struct fuse_conn *fc);
> bool fuse_dax_inode_alloc(struct super_block *sb, struct fuse_inode *fi);
> void fuse_dax_inode_init(struct inode *inode, unsigned int flags);
> void fuse_dax_inode_cleanup(struct inode *inode);
> +void fuse_dax_dontcache(struct inode *inode, unsigned int flags);
> bool fuse_dax_check_alignment(struct fuse_conn *fc, unsigned int map_alignment);
> void fuse_dax_cancel_work(struct fuse_conn *fc);
>
> diff --git a/fs/fuse/inode.c b/fs/fuse/inode.c
> index 73f19cd6e702..cf934c2ba761 100644
> --- a/fs/fuse/inode.c
> +++ b/fs/fuse/inode.c
> @@ -268,6 +268,9 @@ void fuse_change_attributes(struct inode *inode, struct fuse_attr *attr,
> if (inval)
> invalidate_inode_pages2(inode->i_mapping);
> }
> +
> + if (IS_ENABLED(CONFIG_FUSE_DAX))
> + fuse_dax_dontcache(inode, attr->flags);
Should we give this function more generic name. Say
fuse_dax_change_attributes(). And let that function decide what attributes
have changed and does it need to take any action.
Vivek
> }
>
> static void fuse_init_inode(struct inode *inode, struct fuse_attr *attr)
> --
> 2.27.0
>
next prev parent reply other threads:[~2021-10-18 15:20 UTC|newest]
Thread overview: 37+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-10-11 3:00 [PATCH v6 0/7] fuse,virtiofs: support per-file DAX Jeffle Xu
2021-10-11 3:00 ` [PATCH v6 1/7] fuse: add fuse_should_enable_dax() helper Jeffle Xu
2021-10-11 3:00 ` [PATCH v6 2/7] fuse: make DAX mount option a tri-state Jeffle Xu
2021-10-18 14:10 ` Vivek Goyal
2021-10-20 2:52 ` JeffleXu
2021-10-20 14:48 ` Vivek Goyal
2021-10-29 8:33 ` JeffleXu
2021-10-29 13:03 ` Vivek Goyal
2021-11-01 8:21 ` JeffleXu
2021-10-20 15:17 ` Vivek Goyal
2021-10-22 6:54 ` JeffleXu
2021-10-25 17:52 ` Ira Weiny
2021-10-25 18:12 ` Vivek Goyal
2021-10-25 19:02 ` Ira Weiny
2021-10-25 19:33 ` Vivek Goyal
2021-10-25 20:41 ` Ira Weiny
2021-10-26 13:45 ` Vivek Goyal
2021-10-27 6:00 ` JeffleXu
2021-10-11 3:00 ` [PATCH v6 3/7] fuse: support per-file DAX in fuse protocol Jeffle Xu
2021-10-18 14:14 ` Vivek Goyal
2021-10-18 14:20 ` Vivek Goyal
2021-10-20 3:04 ` JeffleXu
2021-10-20 14:54 ` Vivek Goyal
2021-10-11 3:00 ` [PATCH v6 4/7] fuse: negotiate per-file DAX in FUSE_INIT Jeffle Xu
2021-10-18 14:30 ` Vivek Goyal
2021-10-20 3:10 ` JeffleXu
2021-10-20 15:44 ` Vivek Goyal
2021-10-11 3:00 ` [PATCH v6 5/7] fuse: enable per-file DAX Jeffle Xu
2021-10-18 15:11 ` Vivek Goyal
2021-10-11 3:00 ` [PATCH v6 6/7] fuse: mark inode DONT_CACHE when per-file DAX hint changes Jeffle Xu
2021-10-18 15:19 ` Vivek Goyal [this message]
2021-10-27 5:05 ` JeffleXu
2021-10-11 3:00 ` [PATCH v6 7/7] Documentation/filesystem/dax: record DAX on virtiofs Jeffle Xu
2021-10-15 3:33 ` [PATCH v6 0/7] fuse,virtiofs: support per-file DAX JeffleXu
2021-10-18 15:21 ` Vivek Goyal
2021-10-20 5:22 ` JeffleXu
2021-10-20 16:06 ` 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=YW2QeIdS2X48FOHk@redhat.com \
--to=vgoyal@redhat.com \
--cc=bo.liu@linux.alibaba.com \
--cc=jefflexu@linux.alibaba.com \
--cc=joseph.qi@linux.alibaba.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=miklos@szeredi.hub \
--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).