[PATCH] fuse: avoid unnecessary spinlock bump

2022-04-02 Thread Jeffle Xu
Move dmap free worker kicker inside the critical region, so that extra spinlock lock/unlock could be avoided. Suggested-by: Liu Jiang Signed-off-by: Jeffle Xu --- fs/fuse/dax.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/fuse/dax.c b/fs/fuse/dax.c index d7d3a7f06862

[virtiofsd PATCH v4 3/4] virtiofsd: support per-file DAX negotiation in FUSE_INIT

2021-08-16 Thread Jeffle Xu
accordingly if the file is capable of per-file DAX. Currently only ext4/xfs since linux kernel v5.8 support storing FS_DAX_FL flag persistently, and thus advertise support for per-file DAX feature only when the backend fs type is ext4 and xfs. Signed-off-by: Jeffle Xu --- tools/virtiofsd

[virtiofsd PATCH v4 4/4] virtiofsd: support per-file DAX in FUSE_LOOKUP

2021-08-16 Thread Jeffle Xu
For passthrough, when the corresponding virtiofs in guest is mounted with '-o dax=inode', advertise that the file is capable of per-file DAX if the inode in the backend fs is marked with FS_DAX_FL flag. Signed-off-by: Jeffle Xu --- tools/virtiofsd/passthrough

[virtiofsd PATCH v4 0/4] virtiofsd: support per-file DAX

2021-08-16 Thread Jeffle Xu
4 in v2 is incomplete by mistake and it will fail to be compiled. I had ever sent a seperate patch 4 of v3. Now I send the whole complete set in v4. Except for this, there's no other diferrence. Jeffle Xu (4): virtiofsd: add .ioctl() support virtiofsd: expand fuse protocol to support per

[virtiofsd PATCH v4 1/4] virtiofsd: add .ioctl() support

2021-08-16 Thread Jeffle Xu
supported. Later we can restrict the flags/attributes allowed to be set to reinforce the security, or extend the scope of allowed ioctls if it is really needed later. Signed-off-by: Jeffle Xu --- tools/virtiofsd/passthrough_ll.c | 53 +++ tools/virtiofsd

[virtiofsd PATCH v4 2/4] virtiofsd: expand fuse protocol to support per-file DAX

2021-08-16 Thread Jeffle Xu
Signed-off-by: Jeffle Xu --- include/standard-headers/linux/fuse.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/include/standard-headers/linux/fuse.h b/include/standard-headers/linux/fuse.h index 950d7edb7e..7bd006ffcb 100644 --- a/include/standard-headers/linux/fuse.h +++ b/include

[PATCH v4 0/8] fuse,virtiofs: support per-file DAX

2021-08-16 Thread Jeffle Xu
inux-fsdevel/msg200852.html v2: https://www.spinics.net/lists/linux-fsdevel/msg199584.html v1: https://www.spinics.net/lists/linux-virtualization/msg51008.html Jeffle Xu (8): fuse: add fuse_should_enable_dax() helper fuse: Make DAX mount option a tri-state fuse: support per-file DAX fuse:

[PATCH v4 8/8] fuse: show '-o dax=inode' option only when FUSE server supports

2021-08-16 Thread Jeffle Xu
Prior of this patch, the mount option will still show '-o dax=inode' when FUSE server advertises that it doesn't support per-file DAX. Signed-off-by: Jeffle Xu --- fs/fuse/inode.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/fuse/inode.c b/fs/fus

[PATCH v4 7/8] fuse: support changing per-file DAX flag inside guest

2021-08-16 Thread Jeffle Xu
Fuse client can enable or disable per-file DAX inside kernel/guest by chattr(1). Similarly the new state won't be updated until the file is closed and reopened later. Signed-off-by: Jeffle Xu --- fs/fuse/ioctl.c | 15 +-- 1 file changed, 13 insertions(+), 2 deletions(-) diff

[PATCH v4 6/8] fuse: mark inode DONT_CACHE when per-file DAX indication changes

2021-08-16 Thread Jeffle Xu
;t be updated until this file is closed and reopened later. Signed-off-by: Jeffle Xu --- 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 30833f8d37dd..f7ede0be4e00 100644 --- a/fs

[PATCH v4 5/8] fuse: enable per-file DAX

2021-08-16 Thread Jeffle Xu
Enable per-file DAX if fuse server advertises that the file supports that. Currently the state whether the file enables DAX or not is initialized only when inode is instantiated. Signed-off-by: Jeffle Xu --- fs/fuse/dax.c| 12 fs/fuse/file.c | 4 ++-- fs/fuse/fuse_i.h | 4

[PATCH v4 4/8] fuse: negotiate if server/client supports per-file DAX

2021-08-16 Thread Jeffle Xu
request accordingly. Requirements for client: - capable of handling per-file DAX when receiving FUSE_ATTR_DAX. Signed-off-by: Jeffle Xu --- fs/fuse/fuse_i.h | 3 +++ fs/fuse/inode.c | 12 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/fs/fuse/fuse_i.h b/fs/fuse

[PATCH v4 3/8] fuse: support per-file DAX

2021-08-16 Thread Jeffle Xu
FUSE_LOOKUP request. Signed-off-by: Jeffle Xu --- include/uapi/linux/fuse.h | 9 - 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/include/uapi/linux/fuse.h b/include/uapi/linux/fuse.h index 36ed092227fa..15a1f5fc0797 100644 --- a/include/uapi/linux/fuse.h +++ b/include/uapi/linux

[PATCH v4 1/8] fuse: add fuse_should_enable_dax() helper

2021-08-16 Thread Jeffle Xu
This is in prep for following per-file DAX checking. Signed-off-by: Jeffle Xu --- fs/fuse/dax.c | 10 +- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/fs/fuse/dax.c b/fs/fuse/dax.c index 0e5407f48e6a..c6f4e82e65f3 100644 --- a/fs/fuse/dax.c +++ b/fs/fuse/dax.c @@ -1336,11

[PATCH v4 2/8] fuse: Make DAX mount option a tri-state

2021-08-16 Thread Jeffle Xu
We add 'always', 'never', and 'inode' (default). '-o dax' continues to operate the same which is equivalent to 'always'. By the time this patch is applied, 'inode' mode is actually equal to 'always' mode, before the per-file DA

[PATCH 1/2] fuse: disable atomic_o_trunc if no_open is enabled

2021-08-11 Thread Jeffle Xu
ated to be same with that on host side, the end result is that O_TRUNC semantic is broken. This disables atomic_o_trunc as well if with no_open. Reviewed-by: Peng Tao Signed-off-by: Liu Bo Signed-off-by: Jeffle Xu --- fs/fuse/file.c | 10 -- 1 file changed, 8 insertions(+), 2 deletions(-

[PATCH 2/2] virtiofs: reduce lock contention on fpq->lock

2021-08-11 Thread Jeffle Xu
From: Liu Bo Since %req has been removed from fpq->processing_list, no one except request_wait_answer() is looking at this %req and request_wait_answer() waits only on FINISH flag, it's OK to remove fpq->lock after %req is dropped from the list. Signed-off-by: Liu Bo Signed-off-by

[PATCH 0/2] virtiofs: miscellaneous fixes

2021-08-11 Thread Jeffle Xu
Some fixes or optimization for virtiofs, which are authored by Liu Bo. Liu Bo (2): virtio-fs: disable atomic_o_trunc if no_open is enabled virtiofs: reduce lock contention on fpq->lock fs/fuse/file.c | 11 +-- fs/fuse/virtio_fs.c | 3 --- 2 files changed, 9 insertions(+), 5 del

[virtiofsd PATCH v3 4/4] virtiofsd: support per-file DAX in FUSE_LOOKUP

2021-08-11 Thread Jeffle Xu
For passthrough, when the corresponding virtiofs in guest is mounted with '-o dax=inode', advertise that the file is capable of per-file DAX if the inode in the backend fs is marked with FS_DAX_FL flag. Signed-off-by: Jeffle Xu --- Sorry I forget to add staged changes to the lat

[virtiofsd PATCH v2 4/4] virtiofsd: support per-file DAX in FUSE_LOOKUP

2021-08-10 Thread Jeffle Xu
For passthrough, when the corresponding virtiofs in guest is mounted with '-o dax=inode', advertise that the file is capable of per-file DAX if the inode in the backend fs is marked with FS_DAX_FL flag. Signed-off-by: Jeffle Xu --- tools/virtiofsd/passthrough

[virtiofsd PATCH v2 2/4] virtiofsd: expand fuse protocol to support per-file DAX

2021-08-10 Thread Jeffle Xu
Signed-off-by: Jeffle Xu --- include/standard-headers/linux/fuse.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/include/standard-headers/linux/fuse.h b/include/standard-headers/linux/fuse.h index 950d7edb7e..7bd006ffcb 100644 --- a/include/standard-headers/linux/fuse.h +++ b/include

[virtiofsd PATCH v2 3/4] virtiofsd: support per-file DAX negotiation in FUSE_INIT

2021-08-10 Thread Jeffle Xu
accordingly if the file is capable of per-file DAX. Currently only ext4/xfs since linux kernel v5.8 support storing FS_DAX_FL flag persistently, and thus advertise support for per-file DAX feature only when the backend fs type is ext4 and xfs. Signed-off-by: Jeffle Xu --- tools/virtiofsd

[virtiofsd PATCH v2 1/4] virtiofsd: add .ioctl() support

2021-08-10 Thread Jeffle Xu
supported. Later we can restrict the flags/attributes allowed to be set to reinforce the security, or extend the scope of allowed ioctls if it is really needed later. Signed-off-by: Jeffle Xu --- tools/virtiofsd/passthrough_ll.c | 53 +++ tools/virtiofsd

[virtiofsd PATCH v2 0/4] virtiofsd: support per-file DAX

2021-08-10 Thread Jeffle Xu
implementation, the kernel always advertise FUSE_PERFILE_DAX no matter whether it's mounted with '-o dax=inode' or not. It can be fixed in the next version, and I need more feedbacks so far. Any comment on this whole series is welcome. Jeffle Xu (4): virtiofsd: add .ioctl() support vi

[PATCH virtiofsd 1/3] virtiofsd: expand fuse protocol to support per-file DAX

2021-08-04 Thread Jeffle Xu
Signed-off-by: Jeffle Xu --- include/standard-headers/linux/fuse.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/include/standard-headers/linux/fuse.h b/include/standard-headers/linux/fuse.h index 950d7edb7e..7bd006ffcb 100644 --- a/include/standard-headers/linux/fuse.h +++ b/include

[PATCH virtiofsd 2/3] virtiofsd: support per-file DAX negotiation in FUSE_INIT

2021-08-04 Thread Jeffle Xu
Signed-off-by: Jeffle Xu --- tools/virtiofsd/fuse_common.h| 5 + tools/virtiofsd/fuse_lowlevel.c | 6 ++ tools/virtiofsd/passthrough_ll.c | 3 +++ 3 files changed, 14 insertions(+) diff --git a/tools/virtiofsd/fuse_common.h b/tools/virtiofsd/fuse_common.h index 8a75729be9

[PATCH virtiofsd 3/3] virtiofsd: support per-file DAX in FUSE_LOOKUP

2021-08-04 Thread Jeffle Xu
Signed-off-by: Jeffle Xu --- tools/virtiofsd/passthrough_ll.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tools/virtiofsd/passthrough_ll.c b/tools/virtiofsd/passthrough_ll.c index da88304253..1a472ce7f0 100644 --- a/tools/virtiofsd/passthrough_ll.c +++ b/tools/virtiofsd

[PATCH virtiofsd 0/3] virtiofsd: support per-file DAX

2021-08-04 Thread Jeffle Xu
still used for test only, marking files larger than 1MB shall enable per-file DAX. Jeffle Xu (3): virtiofsd: expand fuse protocol to support per-file DAX virtiofsd: support per-file DAX negotiation in FUSE_INIT virtiofsd: support per-file DAX in FUSE_LOOKUP include/standard-headers/linux/

[PATCH v3 0/8] fuse,virtiofs: support per-file DAX

2021-08-04 Thread Jeffle Xu
t option a tri-state") v2: https://www.spinics.net/lists/linux-fsdevel/msg199584.html v1: https://www.spinics.net/lists/linux-virtualization/msg51008.html Jeffle Xu (8): fuse: add fuse_should_enable_dax() helper fuse: Make DAX mount option a tri-state fuse: support per-file DAX fuse: n

[PATCH v3 5/8] fuse: enable per-file DAX

2021-08-04 Thread Jeffle Xu
Enable per-file DAX if fuse server advertises that the file supports that. Currently the state whether the file enables DAX or not is initialized only when inode is instantiated. Signed-off-by: Jeffle Xu --- fs/fuse/dax.c| 12 fs/fuse/file.c | 4 ++-- fs/fuse/fuse_i.h | 4

[PATCH v3 8/8] fuse: show '-o dax=inode' option only when FUSE server supports

2021-08-04 Thread Jeffle Xu
Prior of this patch, the mount option will still show '-o dax=inode' when FUSE server advertises that it doesn't support per-file DAX. Signed-off-by: Jeffle Xu --- fs/fuse/inode.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/fuse/inode.c b/fs/fus

[PATCH v3 4/8] fuse: negotiate if server/client supports per-file DAX

2021-08-04 Thread Jeffle Xu
request accordingly. Requirements for client: - capable of handling per-file DAX when receiving FUSE_ATTR_DAX. Signed-off-by: Jeffle Xu --- fs/fuse/fuse_i.h | 3 +++ fs/fuse/inode.c | 12 +++- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/fs/fuse/fuse_i.h b/fs/fuse

[PATCH v3 3/8] fuse: support per-file DAX

2021-08-04 Thread Jeffle Xu
FUSE_LOOKUP request. Signed-off-by: Jeffle Xu --- include/uapi/linux/fuse.h | 9 - 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/include/uapi/linux/fuse.h b/include/uapi/linux/fuse.h index 36ed092227fa..15a1f5fc0797 100644 --- a/include/uapi/linux/fuse.h +++ b/include/uapi/linux

[PATCH v3 6/8] fuse: mark inode DONT_CACHE when per-file DAX indication changes

2021-08-04 Thread Jeffle Xu
;t be updated until this file is closed and reopened later. Signed-off-by: Jeffle Xu --- 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 30833f8d37dd..14bc5b9a0576 100644 --- a/fs

[PATCH v3 2/8] fuse: Make DAX mount option a tri-state

2021-08-04 Thread Jeffle Xu
We add 'always', 'never', and 'inode' (default). '-o dax' continues to operate the same which is equivalent to 'always'. By the time this patch is applied, 'inode' mode is actually equal to 'always' mode, before the per-file DA

[PATCH v3 7/8] fuse: support changing per-file DAX flag inside guest

2021-08-04 Thread Jeffle Xu
Fuse client can enable or disable per-file DAX inside kernel/guest by chattr(1). Similarly the new state won't be updated until the file is closed and reopened later. Signed-off-by: Jeffle Xu --- fs/fuse/ioctl.c | 15 +-- 1 file changed, 13 insertions(+), 2 deletions(-) diff

[PATCH v3 1/8] fuse: add fuse_should_enable_dax() helper

2021-08-04 Thread Jeffle Xu
This is in prep for following per-file DAX checking. Signed-off-by: Jeffle Xu --- fs/fuse/dax.c | 10 +- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/fs/fuse/dax.c b/fs/fuse/dax.c index 0e5407f48e6a..c6f4e82e65f3 100644 --- a/fs/fuse/dax.c +++ b/fs/fuse/dax.c @@ -1336,11

[PATCH v2 2/4] fuse: Make DAX mount option a tri-state

2021-07-16 Thread Jeffle Xu
We add 'always', 'never', and 'inode' (default). '-o dax' continues to operate the same which is equivalent to 'always'. By the time this patch is applied, 'inode' mode is actually equal to 'always' mode, before the per-file DA

[PATCH v2 4/4] fuse: support changing per-file DAX flag inside guest

2021-07-16 Thread Jeffle Xu
flags retrieved by FUSE LOOKUP routine, while the algorithm constructing fuse_attr.flags is totally fuse server specific, not to mention ioctl may not be supported by fuse server at all. Signed-off-by: Jeffle Xu --- fs/fuse/ioctl.c | 9 ++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --

[PATCH v2 3/4] fuse: add per-file DAX flag

2021-07-16 Thread Jeffle Xu
Add one flag for fuse_attr.flags indicating if DAX shall be enabled for this file. When the per-file DAX flag changes for an *opened* file, the state of the file won't be updated until this file is closed and reopened later. Signed-off-by: Jeffle Xu --- fs/fuse/dax.c

[PATCH v2 1/4] fuse: add fuse_should_enable_dax() helper

2021-07-16 Thread Jeffle Xu
This is in prep for following per-file DAX checking. Signed-off-by: Jeffle Xu --- fs/fuse/dax.c | 10 +- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/fs/fuse/dax.c b/fs/fuse/dax.c index 0e5407f48e6a..c6f4e82e65f3 100644 --- a/fs/fuse/dax.c +++ b/fs/fuse/dax.c @@ -1336,11

[PATCH v2 0/4] virtiofs,fuse: support per-file DAX

2021-07-16 Thread Jeffle Xu
nics.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 +

[PATCH] virtiofsd: support per-file DAX

2021-07-15 Thread Jeffle Xu
An example implementation of supporting per-file DAX flag for virtiofsd, where DAx is enabled for files larger than 1M size. Signed-off-by: Jeffle Xu --- contrib/virtiofsd/fuse_kernel.h | 4 +++- contrib/virtiofsd/fuse_lowlevel.c | 3 +++ 2 files changed, 6 insertions(+), 1 deletion(-) diff

[RFC PATCH 2/3] fuse: Make DAX mount option a tri-state

2021-07-15 Thread Jeffle Xu
We add 'always', 'never', and 'inode' (default). '-o dax' continues to operate the same which is equivalent to 'always'. By the time this patch is applied, 'inode' mode is actually equal to 'always' mode, before the per-file DA

[RFC PATCH 3/3] fuse: add per-file DAX flag

2021-07-15 Thread Jeffle Xu
nside guest kernel, e.g., by chattr(1). Signed-off-by: Jeffle Xu --- fs/fuse/dax.c | 28 fs/fuse/file.c| 4 ++-- fs/fuse/fuse_i.h | 5 +++-- fs/fuse/inode.c | 4 +++- include/uapi/linux/fuse.h | 5 + 5 files change

[RFC PATCH 1/3] fuse: add fuse_should_enable_dax() helper

2021-07-15 Thread Jeffle Xu
This is in prep for following per-file DAX checking. Signed-off-by: Jeffle Xu --- fs/fuse/dax.c | 10 +- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/fs/fuse/dax.c b/fs/fuse/dax.c index 0e5407f48e6a..97b8bd09baa3 100644 --- a/fs/fuse/dax.c +++ b/fs/fuse/dax.c @@ -1336,11

[RFC PATCH 0/3] virtiofs,fuse: support per-file DAX

2021-07-15 Thread Jeffle Xu
ernel, e.g., by chattr(1). 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") Jeffle Xu (3): fuse: add fuse_should_enable_dax() helper fuse: Make DAX mount