virtiofsd: enable PARALLEL_DIROPS during INIT
PATCH 1/1 virtiofsd: enable PARALLEL_DIROPS during INIT
lookup is a RO operations, PARALLEL_DIROPS can be enabled.
--- contrib/virtiofsd/fuse_lowlevel.c | 2 ++ 1 file changed, 2 insertions(+)
contrib/virtiofsd/fuse_lowlevel.c +2 -0
@@ -2089,6 +2089,8 @@ static void do_init(fuse_req_t req, fuse_ino_t nodeid,if (se->conn.want &FUSE_CAP_ASYNC_READ ) outarg.flags |=FUSE_ASYNC_READ ; +if (se->conn.want &FUSE_CAP_PARALLEL_DIROPS ) + outarg.flags |=FUSE_PARALLEL_DIROPS ;if (se->conn.want &FUSE_CAP_POSIX_LOCKS ) outarg.flags |=FUSE_POSIX_LOCKS ;if (se->conn.want &FUSE_CAP_ATOMIC_O_TRUNC )
Signature · 1 line
1.8.3.1
Quoted 3 lines · * Liu Bo ([email protected]) wrote:
lookup is a RO operations,
PARALLEL_DIROPScan be enabled.Signed-off-by Liu Bo <[email protected]>
I'm not too sure what this is doing; and why doesn't upstream libfuse have this?
Dave
Quoted 20 lines
--- contrib/virtiofsd/fuse_lowlevel.c | 2 ++ 1 file changed, 2 insertions(+)contrib/virtiofsd/fuse_lowlevel.c +2
-0@@ -2089,6 +2089,8 @@ static void do_init(fuse_req_t req, fuse_ino_t nodeid,if (se->conn.want &FUSE_CAP_ASYNC_READ ) outarg.flags |=FUSE_ASYNC_READ ; +if (se->conn.want &FUSE_CAP_PARALLEL_DIROPS ) + outarg.flags |=FUSE_PARALLEL_DIROPS ;if (se->conn.want &FUSE_CAP_POSIX_LOCKS ) outarg.flags |=FUSE_POSIX_LOCKS ;if (se->conn.want &FUSE_CAP_ATOMIC_O_TRUNC )Signature · 1 line
1.8.3.1
--
Dr. David Alan Gilbert / [email protected] / Manchester, UK
Quoted 7 lines · Dr. David Alan Gilbert
Quoted 3 lines · * Liu Bo ([email protected]) wrote:
lookup is a RO operations,
PARALLEL_DIROPScan be enabled.Signed-off-by Liu Bo <[email protected]>I'm not too sure what this is doing; and why doesn't upstream libfuse have this?
I'm not sure why libfuse doesn't include the capability, but AFAICT this is needed for practical use.
Say that we have 100 threads doing 'ls /mnt/virtiofs/', then they are serialized by a mutex in
---fuse_lookup
fuse_lock_inode
if (!get_fuse_conn(inode)->parallel_dirops)
mutex_lock(&get_fuse_inode(inode)->mutex);---
What fuse_lookup does is a plain lookup with loading inode if necessary, so I don't see anything wrong making operations parallel.
This is found by a fsmark test,
----
NFILES=100000
time $FSMARK -D 10000 -S0 -n $NFILES -s 0 -L 5 -l /tmp/fs_log.txt \
-d $MNT/0 -d $MNT/1 \
-d $MNT/2 -d $MNT/3 \
-d $MNT/4 -d $MNT/5 \
-d $MNT/6 -d $MNT/7 \
-d $MNT/8 -d $MNT/9 \
-d $MNT/10 -d $MNT/11 \
-d $MNT/12 -d $MNT/13 \
-d $MNT/14 -d $MNT/15----
the vanilla virtiofs was super slow due to the mutex lock.
thanks,
-liubo
Quoted 25 lines
Dave
Quoted 20 lines
--- contrib/virtiofsd/fuse_lowlevel.c | 2 ++ 1 file changed, 2 insertions(+)contrib/virtiofsd/fuse_lowlevel.c +2
-0@@ -2089,6 +2089,8 @@ static void do_init(fuse_req_t req, fuse_ino_t nodeid,if (se->conn.want &FUSE_CAP_ASYNC_READ ) outarg.flags |=FUSE_ASYNC_READ ; +if (se->conn.want &FUSE_CAP_PARALLEL_DIROPS ) + outarg.flags |=FUSE_PARALLEL_DIROPS ;if (se->conn.want &FUSE_CAP_POSIX_LOCKS ) outarg.flags |=FUSE_POSIX_LOCKS ;if (se->conn.want &FUSE_CAP_ATOMIC_O_TRUNC )Signature · 1 line
1.8.3.1--
Dr. David Alan Gilbert / [email protected] / Manchester, UK
Quoted 11 lines · * Liu Bo ([email protected]) wrote:
Quoted 7 lines · Dr. David Alan Gilbert
Quoted 3 lines · * Liu Bo ([email protected]) wrote:
lookup is a RO operations,
PARALLEL_DIROPScan be enabled.Signed-off-by Liu Bo <[email protected]>I'm not too sure what this is doing; and why doesn't upstream libfuse have this?
I'm not sure why libfuse doesn't include the capability, but AFAICT this is needed for practical use.
Miklos: Do you know what the rules are around PARALLEL_DIROPS and why the upstream libfuse doesn't have it eanbled?
Dave
Quoted 25 lines
Say that we have 100 threads doing 'ls
/mnt/virtiofs/', then they are serialized by a mutex in
---fuse_lookup
fuse_lock_inodeif (!get_fuse_conn(inode)->parallel_dirops) mutex_lock(&get_fuse_inode(inode)->mutex);---
What
fuse_lookupdoes is a plain lookup with loading inode if necessary, so I don't see anything wrong making operations parallel.This is found by a fsmark test,
----
NFILES=100000time $FSMARK -D 10000 -S0 -n $NFILES -s 0 -L 5 -l /tmp/fs_log.txt \ -d $MNT/0 -d $MNT/1 \ -d $MNT/2 -d $MNT/3 \ -d $MNT/4 -d $MNT/5 \ -d $MNT/6 -d $MNT/7 \ -d $MNT/8 -d $MNT/9 \ -d $MNT/10 -d $MNT/11 \ -d $MNT/12 -d $MNT/13 \ -d $MNT/14 -d $MNT/15
Quoted 33 lines
----
the vanilla virtiofs was super slow due to the mutex lock.
thanks,
-liuboQuoted 25 lines
Dave
Quoted 20 lines
--- contrib/virtiofsd/fuse_lowlevel.c | 2 ++ 1 file changed, 2 insertions(+)contrib/virtiofsd/fuse_lowlevel.c +2
-0@@ -2089,6 +2089,8 @@ static void do_init(fuse_req_t req, fuse_ino_t nodeid,if (se->conn.want &FUSE_CAP_ASYNC_READ ) outarg.flags |=FUSE_ASYNC_READ ; +if (se->conn.want &FUSE_CAP_PARALLEL_DIROPS ) + outarg.flags |=FUSE_PARALLEL_DIROPS ;if (se->conn.want &FUSE_CAP_POSIX_LOCKS ) outarg.flags |=FUSE_POSIX_LOCKS ;if (se->conn.want &FUSE_CAP_ATOMIC_O_TRUNC )Signature · 1 line
1.8.3.1--
Dr. David Alan Gilbert / [email protected] / Manchester, UK
--
Dr. David Alan Gilbert / [email protected] / Manchester, UK
Quoted 8 lines · Dr. David Alan Gilbert
Quoted 6 lines · * Liu Bo ([email protected]) wrote:
Quoted 5 lines · Dr. David Alan Gilbert
Quoted 3 lines · * Liu Bo ([email protected]) wrote:
lookup is a RO operations,
PARALLEL_DIROPScan be enabled.Signed-off-by Liu Bo <[email protected]>
Quoted 8 lines
Quoted 5 lines
Quoted 2 lines
I'm not too sure what this is doing; and why doesn't upstream libfuse have this?
I'm not sure why libfuse doesn't include the capability, but AFAICT this is needed for practical use.
Miklos: Do you know what the rules are around
PARALLEL_DIROPSand why the upstream libfuse doesn't have it eanbled?
Not sure why libfuse3 wouldn't have it enabled by default, probably an omission. Having said that, the reason this is opt in is that old filesystems might rely on the serialized behavior, so back compatibility requires that we have this turned off by default, so now libfuse3 has the same problem...
Thanks,
Miklos
Quoted 16 lines · * Miklos Szeredi ([email protected]) wrote:
Quoted 14 lines · Dr. David Alan Gilbert
Quoted 11 lines · * Liu Bo ([email protected]) wrote:
Quoted 7 lines · Dr. David Alan Gilbert
Quoted 3 lines · * Liu Bo ([email protected]) wrote:
lookup is a RO operations,
PARALLEL_DIROPScan be enabled.Signed-off-by Liu Bo <[email protected]>I'm not too sure what this is doing; and why doesn't upstream libfuse have this?
I'm not sure why libfuse doesn't include the capability, but AFAICT this is needed for practical use.
Quoted 8 lines
Quoted 2 lines
Miklos: Do you know what the rules are around
PARALLEL_DIROPSand why the upstream libfuse doesn't have it eanbled?Not sure why libfuse3 wouldn't have it enabled by default, probably an omission. Having said that, the reason this is opt in is that old filesystems might rely on the serialized behavior, so back compatibility requires that we have this turned off by default, so now libfuse3 has the same problem...
So for us (virtio-fs) is it always safe?
Dave
Quoted 2 lines
Thanks,
Miklos
--
Dr. David Alan Gilbert / [email protected] / Manchester, UK
Quoted 20 lines · Dr. David Alan Gilbert
Quoted 19 lines · * Miklos Szeredi ([email protected]) wrote:
Quoted 16 lines · Dr. David Alan Gilbert
Quoted 11 lines · * Liu Bo ([email protected]) wrote:
Quoted 7 lines · Dr. David Alan Gilbert
Quoted 3 lines · * Liu Bo ([email protected]) wrote:
lookup is a RO operations,
PARALLEL_DIROPScan be enabled.Signed-off-by Liu Bo <[email protected]>I'm not too sure what this is doing; and why doesn't upstream libfuse have this?
I'm not sure why libfuse doesn't include the capability, but AFAICT this is needed for practical use.
Miklos: Do you know what the rules are around
PARALLEL_DIROPSand why the upstream libfuse doesn't have it eanbled?
Quoted 8 lines
Quoted 5 lines
Not sure why libfuse3 wouldn't have it enabled by default, probably an omission. Having said that, the reason this is opt in is that old filesystems might rely on the serialized behavior, so back compatibility requires that we have this turned off by default, so now libfuse3 has the same problem...
So for us (virtio-fs) is it always safe?
FYI, my first round of limited testing (dbench4, fsmark, fstests) didn't say no.
thanks,
-liubo
Quoted 21 lines · Dr. David Alan Gilbert
Quoted 19 lines · * Miklos Szeredi ([email protected]) wrote:
Quoted 16 lines · Dr. David Alan Gilbert
Quoted 11 lines · * Liu Bo ([email protected]) wrote:
Quoted 7 lines · Dr. David Alan Gilbert
Quoted 3 lines · * Liu Bo ([email protected]) wrote:
lookup is a RO operations,
PARALLEL_DIROPScan be enabled.Signed-off-by Liu Bo <[email protected]>I'm not too sure what this is doing; and why doesn't upstream libfuse have this?
I'm not sure why libfuse doesn't include the capability, but AFAICT this is needed for practical use.
Miklos: Do you know what the rules are around
PARALLEL_DIROPSand why the upstream libfuse doesn't have it eanbled?
Quoted 7 lines
Quoted 5 lines
Not sure why libfuse3 wouldn't have it enabled by default, probably an omission. Having said that, the reason this is opt in is that old filesystems might rely on the serialized behavior, so back compatibility requires that we have this turned off by default, so now libfuse3 has the same problem...
So for us (virtio-fs) is it always safe?
Yes, since no shared data is used between readdir instances.
Thanks,
Miklos
Dr. David Alan Gilbert
Reviewed-byQuoted 29 lines · * Miklos Szeredi ([email protected]) wrote:
Quoted 27 lines · Dr. David Alan Gilbert
Quoted 24 lines · * Miklos Szeredi ([email protected]) wrote:
Quoted 8 lines · Dr. David Alan Gilbert
Quoted 6 lines · * Liu Bo ([email protected]) wrote:
Quoted 5 lines · Dr. David Alan Gilbert
Quoted 3 lines · * Liu Bo ([email protected]) wrote:
lookup is a RO operations,
PARALLEL_DIROPScan be enabled.Signed-off-by Liu Bo <[email protected]>Quoted 8 lines
Quoted 5 lines
Quoted 2 lines
I'm not too sure what this is doing; and why doesn't upstream libfuse have this?
I'm not sure why libfuse doesn't include the capability, but AFAICT this is needed for practical use.
Miklos: Do you know what the rules are around
PARALLEL_DIROPSand why the upstream libfuse doesn't have it eanbled?Not sure why libfuse3 wouldn't have it enabled by default, probably an omission. Having said that, the reason this is opt in is that old filesystems might rely on the serialized behavior, so back compatibility requires that we have this turned off by default, so now libfuse3 has the same problem...
Quoted 3 lines
Quoted 1 line
So for us (virtio-fs) is it always safe?
Yes, since no shared data is used between readdir instances.
OK, in that case
and added to my tree.
Quoted 2 lines
Thanks,
Miklos
--
Dr. David Alan Gilbert / [email protected] / Manchester, UK