All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 0/4] virtiofs,fuse: support per-file DAX
@ 2021-07-16 10:47 ` Jeffle Xu
  0 siblings, 0 replies; 53+ messages in thread
From: Jeffle Xu @ 2021-07-16 10:47 UTC (permalink / raw)
  To: vgoyal, stefanha, miklos; +Cc: linux-fsdevel, virtualization, bo.liu, joseph.qi

This patchset adds support of per-file DAX for virtiofs, which is
inspired by Ira Weiny's work on ext4[1] and xfs[2].

There are three related scenarios:
1. Alloc inode: get per-file DAX flag from fuse_attr.flags. (patch 3)
2. Per-file DAX flag changes when the file has been opened. (patch 3)
In this case, the dentry and inode are all marked as DONT_CACHE, and
the DAX state won't be updated until the file is closed and reopened
later.
3. Users can change the per-file DAX flag inside the guest by chattr(1).
(patch 4)
4. Create new files under directories with DAX enabled. When creating
new files in ext4/xfs on host, the new created files will inherit the
per-file DAX flag from the directory, and thus the new created files in
virtiofs will also inherit the per-file DAX flag if the fuse server
derives fuse_attr.flags from the underlying ext4/xfs inode's per-file
DAX flag.


Any comment is welcome.

[1] commit 9cb20f94afcd ("fs/ext4: Make DAX mount option a tri-state")
[2] commit 02beb2686ff9 ("fs/xfs: Make DAX mount option a tri-state")


changes since v1:
- add support for changing per-file DAX flags inside guest (patch 4)

v1:https://www.spinics.net/lists/linux-virtualization/msg51008.html

Jeffle Xu (4):
  fuse: add fuse_should_enable_dax() helper
  fuse: Make DAX mount option a tri-state
  fuse: add per-file DAX flag
  fuse: support changing per-file DAX flag inside guest

 fs/fuse/dax.c             | 36 ++++++++++++++++++++++++++++++++++--
 fs/fuse/file.c            |  4 ++--
 fs/fuse/fuse_i.h          | 16 ++++++++++++----
 fs/fuse/inode.c           |  7 +++++--
 fs/fuse/ioctl.c           |  9 ++++++---
 fs/fuse/virtio_fs.c       | 16 ++++++++++++++--
 include/uapi/linux/fuse.h |  5 +++++
 7 files changed, 78 insertions(+), 15 deletions(-)

-- 
2.27.0


^ permalink raw reply	[flat|nested] 53+ messages in thread
* Re: [PATCH v2 4/4] fuse: support changing per-file DAX flag inside guest
@ 2021-07-27 18:31 kernel test robot
  2021-07-28  0:39   ` kernel test robot
  0 siblings, 1 reply; 53+ messages in thread
From: kernel test robot @ 2021-07-27 18:31 UTC (permalink / raw)
  To: kbuild

[-- Attachment #1: Type: text/plain, Size: 15805 bytes --]

CC: clang-built-linux(a)googlegroups.com
CC: kbuild-all(a)lists.01.org
In-Reply-To: <20210716104753.74377-5-jefflexu@linux.alibaba.com>
References: <20210716104753.74377-5-jefflexu@linux.alibaba.com>
TO: Jeffle Xu <jefflexu@linux.alibaba.com>
TO: vgoyal(a)redhat.com
TO: stefanha(a)redhat.com
TO: miklos(a)szeredi.hu
CC: linux-fsdevel(a)vger.kernel.org
CC: virtualization(a)lists.linux-foundation.org
CC: bo.liu(a)linux.alibaba.com
CC: joseph.qi(a)linux.alibaba.com

Hi Jeffle,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on fuse/for-next]
[also build test WARNING on v5.14-rc3 next-20210726]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Jeffle-Xu/virtiofs-fuse-support-per-file-DAX/20210718-102250
base:   https://git.kernel.org/pub/scm/linux/kernel/git/mszeredi/fuse.git for-next
:::::: branch date: 10 days ago
:::::: commit date: 10 days ago
config: x86_64-randconfig-c001-20210727 (attached as .config)
compiler: clang version 13.0.0 (https://github.com/llvm/llvm-project c658b472f3e61e1818e1909bf02f3d65470018a5)
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # install x86_64 cross compiling tool for clang build
        # apt-get install binutils-x86-64-linux-gnu
        # https://github.com/0day-ci/linux/commit/a6ac625f19c4c4de28ee8a466c1bab8824b7042e
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Jeffle-Xu/virtiofs-fuse-support-per-file-DAX/20210718-102250
        git checkout a6ac625f19c4c4de28ee8a466c1bab8824b7042e
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=x86_64 clang-analyzer 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>


clang-analyzer warnings: (new ones prefixed by >>)
   drivers/regulator/qcom_spmi-regulator.c:1155:2: warning: Value stored to 'ret' is never read [clang-analyzer-deadcode.DeadStores]
           ret = spmi_vreg_update_bits(vreg, SPMI_COMMON_REG_ENABLE,
           ^     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/regulator/qcom_spmi-regulator.c:1155:2: note: Value stored to 'ret' is never read
           ret = spmi_vreg_update_bits(vreg, SPMI_COMMON_REG_ENABLE,
           ^     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   Suppressed 6 warnings (6 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   6 warnings generated.
   Suppressed 6 warnings (6 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   7 warnings generated.
   drivers/regulator/palmas-regulator.c:1598:36: warning: Value stored to 'pdata' during its initialization is never read [clang-analyzer-deadcode.DeadStores]
           struct palmas_pmic_platform_data *pdata = dev_get_platdata(&pdev->dev);
                                             ^~~~~   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/regulator/palmas-regulator.c:1598:36: note: Value stored to 'pdata' during its initialization is never read
           struct palmas_pmic_platform_data *pdata = dev_get_platdata(&pdev->dev);
                                             ^~~~~   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   Suppressed 6 warnings (6 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   6 warnings generated.
   Suppressed 6 warnings (6 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   5 warnings generated.
   Suppressed 5 warnings (5 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   5 warnings generated.
   Suppressed 5 warnings (5 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   7 warnings generated.
   drivers/gpu/drm/nouveau/nvkm/subdev/mmu/vmm.c:49:39: warning: Dereference of null pointer [clang-analyzer-core.NullDereference]
                           const struct nvkm_vmm_desc *pair = page[-1].desc;
                                                              ^
   drivers/gpu/drm/nouveau/nvkm/subdev/mmu/vmm.c:1145:8: note: Assuming  is non-null
           if (!(*pvmm = kzalloc(sizeof(**pvmm), GFP_KERNEL)))
                 ^~~~~
   drivers/gpu/drm/nouveau/nvkm/subdev/mmu/vmm.c:1145:2: note: Taking false branch
           if (!(*pvmm = kzalloc(sizeof(**pvmm), GFP_KERNEL)))
           ^
   drivers/gpu/drm/nouveau/nvkm/subdev/mmu/vmm.c:1147:9: note: Calling 'nvkm_vmm_ctor'
           return nvkm_vmm_ctor(func, mmu, hdr, managed, addr, size, key, name, *pvmm);
                  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/gpu/drm/nouveau/nvkm/subdev/mmu/vmm.c:1051:43: note: Assuming 'key' is null
           __mutex_init(&vmm->mutex, "&vmm->mutex", key ? key : &_key);
                                                    ^~~
   drivers/gpu/drm/nouveau/nvkm/subdev/mmu/vmm.c:1051:43: note: '?' condition is false
   drivers/gpu/drm/nouveau/nvkm/subdev/mmu/vmm.c:1056:2: note: Loop condition is false. Execution continues on line 1063
           while (page[1].shift)
           ^
   drivers/gpu/drm/nouveau/nvkm/subdev/mmu/vmm.c:1063:2: note: Loop condition is false. Execution continues on line 1065
           for (levels = 0, desc = page->desc; desc->bits; desc++, levels++)
           ^
   drivers/gpu/drm/nouveau/nvkm/subdev/mmu/vmm.c:1068:6: note: Taking false branch
           if (WARN_ON(levels > NVKM_VMM_LEVELS_MAX))
               ^
   include/asm-generic/bug.h:120:2: note: expanded from macro 'WARN_ON'
           if (unlikely(__ret_warn_on))                                    \
           ^
   drivers/gpu/drm/nouveau/nvkm/subdev/mmu/vmm.c:1068:2: note: Taking false branch
           if (WARN_ON(levels > NVKM_VMM_LEVELS_MAX))
           ^
   drivers/gpu/drm/nouveau/nvkm/subdev/mmu/vmm.c:1072:41: note: Passing null pointer value via 3rd parameter 'page'
           vmm->pd = nvkm_vmm_pt_new(desc, false, NULL);
                                                  ^
   include/linux/stddef.h:8:14: note: expanded from macro 'NULL'
   #define NULL ((void *)0)
                ^~~~~~~~~~~
   drivers/gpu/drm/nouveau/nvkm/subdev/mmu/vmm.c:1072:12: note: Calling 'nvkm_vmm_pt_new'
           vmm->pd = nvkm_vmm_pt_new(desc, false, NULL);
                     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/gpu/drm/nouveau/nvkm/subdev/mmu/vmm.c:47:6: note: Assuming field 'type' is > PGT
           if (desc->type > PGT) {
               ^~~~~~~~~~~~~~~~
   drivers/gpu/drm/nouveau/nvkm/subdev/mmu/vmm.c:47:2: note: Taking true branch
           if (desc->type > PGT) {
           ^
   drivers/gpu/drm/nouveau/nvkm/subdev/mmu/vmm.c:48:7: note: Assuming field 'type' is equal to SPT
                   if (desc->type == SPT) {
                       ^~~~~~~~~~~~~~~~~
   drivers/gpu/drm/nouveau/nvkm/subdev/mmu/vmm.c:48:3: note: Taking true branch
                   if (desc->type == SPT) {
                   ^
   drivers/gpu/drm/nouveau/nvkm/subdev/mmu/vmm.c:49:39: note: Dereference of null pointer
                           const struct nvkm_vmm_desc *pair = page[-1].desc;
                                                              ^~~~~~~~~~~~~
   Suppressed 6 warnings (6 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   6 warnings generated.
   Suppressed 6 warnings (6 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   6 warnings generated.
   Suppressed 6 warnings (6 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   6 warnings generated.
   Suppressed 6 warnings (6 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   6 warnings generated.
   Suppressed 6 warnings (6 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   8 warnings generated.
>> fs/fuse/ioctl.c:471:3: warning: Value stored to 'newdax' is never read [clang-analyzer-deadcode.DeadStores]
                   newdax = flags & FS_DAX_FL;
                   ^        ~~~~~~~~~~~~~~~~~
   fs/fuse/ioctl.c:471:3: note: Value stored to 'newdax' is never read
                   newdax = flags & FS_DAX_FL;
                   ^        ~~~~~~~~~~~~~~~~~
   fs/fuse/ioctl.c:482:3: warning: Value stored to 'newdax' is never read [clang-analyzer-deadcode.DeadStores]
                   newdax = fa->fsx_xflags & FS_XFLAG_DAX;
                   ^        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   fs/fuse/ioctl.c:482:3: note: Value stored to 'newdax' is never read
                   newdax = fa->fsx_xflags & FS_XFLAG_DAX;
                   ^        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   Suppressed 6 warnings (6 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   8 warnings generated.
   fs/fuse/cuse.c:359:2: warning: Value stored to 'rc' is never read [clang-analyzer-deadcode.DeadStores]
           rc = -ENOMEM;
           ^    ~~~~~~~
   fs/fuse/cuse.c:359:2: note: Value stored to 'rc' is never read
           rc = -ENOMEM;
           ^    ~~~~~~~
   fs/fuse/cuse.c:386:2: warning: Value stored to 'rc' is never read [clang-analyzer-deadcode.DeadStores]
           rc = -ENOMEM;
           ^    ~~~~~~~
   fs/fuse/cuse.c:386:2: note: Value stored to 'rc' is never read
           rc = -ENOMEM;
           ^    ~~~~~~~
   Suppressed 6 warnings (6 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   8 warnings generated.
   fs/fuse/virtio_fs.c:912:2: warning: Attempt to free released memory [clang-analyzer-unix.Malloc]
           kfree(fs->vqs);
           ^~~~~~~~~~~~~~
   fs/fuse/virtio_fs.c:879:6: note: Assuming 'fs' is non-null
           if (!fs)
               ^~~
   fs/fuse/virtio_fs.c:879:2: note: Taking false branch
           if (!fs)
           ^
   fs/fuse/virtio_fs.c:885:6: note: 'ret' is >= 0
           if (ret < 0)
               ^~~
   fs/fuse/virtio_fs.c:885:2: note: Taking false branch
           if (ret < 0)
           ^
   fs/fuse/virtio_fs.c:888:8: note: Calling 'virtio_fs_setup_vqs'
           ret = virtio_fs_setup_vqs(vdev, fs);
                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   fs/fuse/virtio_fs.c:691:2: note: Loop condition is false.  Exiting loop
           virtio_cread_le(vdev, struct virtio_fs_config, num_request_queues,
           ^
   include/linux/virtio_config.h:396:3: note: expanded from macro 'virtio_cread_le'
                   might_sleep();                                          \
                   ^
   include/linux/kernel.h:119:2: note: expanded from macro 'might_sleep'
           do { __might_sleep(__FILE__, __LINE__, 0); might_resched(); } while (0)
           ^
   fs/fuse/virtio_fs.c:691:2: note: Control jumps to 'case 4:' @line 691
           virtio_cread_le(vdev, struct virtio_fs_config, num_request_queues,
           ^
   include/linux/virtio_config.h:400:3: note: expanded from macro 'virtio_cread_le'
                   switch (sizeof(virtio_cread_v)) {                       \
                   ^
   fs/fuse/virtio_fs.c:691:2: note:  Execution continues on line 691
           virtio_cread_le(vdev, struct virtio_fs_config, num_request_queues,
           ^
   include/linux/virtio_config.h:408:4: note: expanded from macro 'virtio_cread_le'
                           break;                                          \
                           ^
   fs/fuse/virtio_fs.c:691:2: note: Loop condition is false.  Exiting loop
           virtio_cread_le(vdev, struct virtio_fs_config, num_request_queues,
           ^
   include/linux/virtio_config.h:393:2: note: expanded from macro 'virtio_cread_le'
           do {                                                            \
           ^
   fs/fuse/virtio_fs.c:693:6: note: Assuming field 'num_request_queues' is not equal to 0
           if (fs->num_request_queues == 0)
               ^~~~~~~~~~~~~~~~~~~~~~~~~~~
   fs/fuse/virtio_fs.c:693:2: note: Taking false branch
           if (fs->num_request_queues == 0)
           ^
   fs/fuse/virtio_fs.c:698:6: note: Assuming field 'vqs' is non-null
           if (!fs->vqs)
               ^~~~~~~~
   fs/fuse/virtio_fs.c:698:2: note: Taking false branch
           if (!fs->vqs)
           ^
   fs/fuse/virtio_fs.c:705:6: note: Assuming 'vqs' is non-null
           if (!vqs || !callbacks || !names) {
               ^~~~
   fs/fuse/virtio_fs.c:705:6: note: Left side of '||' is false
   fs/fuse/virtio_fs.c:705:14: note: Assuming 'callbacks' is non-null
           if (!vqs || !callbacks || !names) {
                       ^~~~~~~~~~
   fs/fuse/virtio_fs.c:705:6: note: Left side of '||' is false
           if (!vqs || !callbacks || !names) {
               ^
   fs/fuse/virtio_fs.c:705:28: note: Assuming 'names' is non-null
           if (!vqs || !callbacks || !names) {
                                     ^~~~~~
   fs/fuse/virtio_fs.c:705:2: note: Taking false branch

vim +/newdax +471 fs/fuse/ioctl.c

72227eac177dd1 Miklos Szeredi 2021-04-08  455  
72227eac177dd1 Miklos Szeredi 2021-04-08  456  int fuse_fileattr_set(struct user_namespace *mnt_userns,
72227eac177dd1 Miklos Szeredi 2021-04-08  457  		      struct dentry *dentry, struct fileattr *fa)
72227eac177dd1 Miklos Szeredi 2021-04-08  458  {
72227eac177dd1 Miklos Szeredi 2021-04-08  459  	struct inode *inode = d_inode(dentry);
72227eac177dd1 Miklos Szeredi 2021-04-08  460  	struct fuse_file *ff;
72227eac177dd1 Miklos Szeredi 2021-04-08  461  	unsigned int flags = fa->flags;
72227eac177dd1 Miklos Szeredi 2021-04-08  462  	struct fsxattr xfa;
a6ac625f19c4c4 Jeffle Xu      2021-07-16  463  	bool newdax;
72227eac177dd1 Miklos Szeredi 2021-04-08  464  	int err;
72227eac177dd1 Miklos Szeredi 2021-04-08  465  
72227eac177dd1 Miklos Szeredi 2021-04-08  466  	ff = fuse_priv_ioctl_prepare(inode);
72227eac177dd1 Miklos Szeredi 2021-04-08  467  	if (IS_ERR(ff))
72227eac177dd1 Miklos Szeredi 2021-04-08  468  		return PTR_ERR(ff);
72227eac177dd1 Miklos Szeredi 2021-04-08  469  
72227eac177dd1 Miklos Szeredi 2021-04-08  470  	if (fa->flags_valid) {
a6ac625f19c4c4 Jeffle Xu      2021-07-16 @471  		newdax = flags & FS_DAX_FL;

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org

[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 34402 bytes --]

^ permalink raw reply	[flat|nested] 53+ messages in thread

end of thread, other threads:[~2021-08-04  6:52 UTC | newest]

Thread overview: 53+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-16 10:47 [PATCH v2 0/4] virtiofs,fuse: support per-file DAX Jeffle Xu
2021-07-16 10:47 ` Jeffle Xu
2021-07-16 10:47 ` [PATCH v2 1/4] fuse: add fuse_should_enable_dax() helper Jeffle Xu
2021-07-16 10:47   ` Jeffle Xu
2021-07-16 10:47 ` [PATCH v2 2/4] fuse: Make DAX mount option a tri-state Jeffle Xu
2021-07-16 10:47   ` Jeffle Xu
2021-07-19 18:02   ` Vivek Goyal
2021-07-19 18:02     ` Vivek Goyal
2021-07-20  5:54     ` JeffleXu
2021-07-20  5:54       ` JeffleXu
2021-07-16 10:47 ` [PATCH v2 3/4] fuse: add per-file DAX flag Jeffle Xu
2021-07-16 10:47   ` Jeffle Xu
2021-07-19 18:41   ` Vivek Goyal
2021-07-19 18:41     ` Vivek Goyal
2021-07-20  7:19     ` JeffleXu
2021-07-20  7:19       ` JeffleXu
2021-07-20 19:40       ` Vivek Goyal
2021-07-20 19:40         ` Vivek Goyal
2021-07-21 12:35         ` JeffleXu
2021-07-21 12:35           ` JeffleXu
2021-07-19 19:44   ` Vivek Goyal
2021-07-19 19:44     ` Vivek Goyal
2021-07-20  6:51     ` JeffleXu
2021-07-20  6:51       ` JeffleXu
2021-07-20  9:22       ` JeffleXu
2021-07-20  9:22         ` JeffleXu
2021-07-20 19:27       ` Vivek Goyal
2021-07-20 19:27         ` Vivek Goyal
2021-07-21 14:14         ` JeffleXu
2021-07-21 14:14           ` JeffleXu
2021-07-21 14:40           ` Vivek Goyal
2021-07-21 14:40             ` Vivek Goyal
2021-07-16 10:47 ` [PATCH v2 4/4] fuse: support changing per-file DAX flag inside guest Jeffle Xu
2021-07-16 10:47   ` Jeffle Xu
2021-07-19 19:54   ` Vivek Goyal
2021-07-19 19:54     ` Vivek Goyal
2021-07-19 21:30 ` [PATCH v2 0/4] virtiofs,fuse: support per-file DAX Vivek Goyal
2021-07-19 21:30   ` Vivek Goyal
2021-07-20  5:25   ` JeffleXu
2021-07-20  5:25     ` JeffleXu
2021-07-20 19:18     ` Vivek Goyal
2021-07-20 19:18       ` Vivek Goyal
2021-07-21 12:32       ` JeffleXu
2021-07-21 12:32         ` JeffleXu
2021-07-21 12:48         ` Vivek Goyal
2021-07-21 12:48           ` Vivek Goyal
2021-07-21 14:42           ` Vivek Goyal
2021-07-21 14:42             ` Vivek Goyal
2021-08-04  6:51             ` JeffleXu
2021-08-04  6:51               ` JeffleXu
2021-07-27 18:31 [PATCH v2 4/4] fuse: support changing per-file DAX flag inside guest kernel test robot
2021-07-28  0:39 ` kernel test robot
2021-07-28  0:39   ` kernel test robot

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.