From: Jeffle Xu Date: Mon, 11 Oct 2021 11:00:46 +0800 Message-Id: <20211011030052.98923-2-jefflexu@linux.alibaba.com> In-Reply-To: <20211011030052.98923-1-jefflexu@linux.alibaba.com> References: <20211011030052.98923-1-jefflexu@linux.alibaba.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="US-ASCII" Subject: [Virtio-fs] [PATCH v6 1/7] fuse: add fuse_should_enable_dax() helper List-Id: Development discussions about virtio-fs List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: vgoyal@redhat.com, stefanha@redhat.com, miklos@szeredi.hub Cc: linux-fsdevel@vger.kernel.org, virtio-fs@redhat.com, joseph.qi@linux.alibaba.com This is in prep for following per-file DAX checking. Signed-off-by: Jeffle Xu --- fs/fuse/dax.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/fs/fuse/dax.c b/fs/fuse/dax.c index 79df61ed7481..1eb6538bf1b2 100644 --- a/fs/fuse/dax.c +++ b/fs/fuse/dax.c @@ -1332,11 +1332,19 @@ static const struct address_space_operations fuse_dax_file_aops = { .invalidatepage = noop_invalidatepage, }; -void fuse_dax_inode_init(struct inode *inode) +static bool fuse_should_enable_dax(struct inode *inode) { struct fuse_conn *fc = get_fuse_conn(inode); - if (!fc->dax) + if (fc->dax) + return true; + + return false; +} + +void fuse_dax_inode_init(struct inode *inode) +{ + if (!fuse_should_enable_dax(inode)) return; inode->i_flags |= S_DAX; -- 2.27.0