* ls -l regression from 311324ad1713
@ 2016-04-15 14:23 J. Bruce Fields
0 siblings, 0 replies; 2+ messages in thread
From: J. Bruce Fields @ 2016-04-15 14:23 UTC (permalink / raw)
Cc: linux-nfs
This change is making "ls -l" of large changing directories slower:
commit 311324ad1713
Author: Trond Myklebust <trond.myklebust@primarydata.com>
Date: Fri Feb 7 17:02:08 2014 -0500
NFS: Be more aggressive in using readdirplus for 'ls -l' situations
Try to detect 'ls -l' by having nfs_getattr() look at whether or not
there is an opendir() file descriptor for the parent directory.
If so, then assume that we want to force use of readdirplus in order
to avoid the multiple GETATTR calls over the wire.
Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
After that commit, if we create a large directory and then add and
remove entries from it continuously while doing an "ls -l", we see
multiple READDIRPLUS requests sent with cookie 0; it appears the readdir
is starting over from the beginning of the directory repeatedly.
It doesn't appear to be the changes to nfs_getattr that do this, instead
it's just the change to nfs_readdir to call nfs_revalidate_mapping() in
the case INVALID_DATA is set (as opposed to only in the case the
directory's attribute cache has expired):
+static bool nfs_dir_mapping_need_revalidate(struct inode *dir)
+{
+ struct nfs_inode *nfsi = NFS_I(dir);
+
+ if (nfs_attribute_cache_expired(dir))
+ return true;
+ if (nfsi->cache_validity & NFS_INO_INVALID_DATA)
+ return true;
+ return false;
+}
...
@@ -847,7 +881,7 @@ static int nfs_readdir(...
desc->plus = nfs_use_readdirplus(inode, ctx) ? 1 : 0;
nfs_block_sillyrename(dentry);
- if (ctx->pos == 0 || nfs_attribute_cache_expired(inode))
+ if (ctx->pos == 0 || nfs_dir_mapping_need_revalidate(inode))
res = nfs_revalidate_mapping(inode, file->f_mapping);
if (res < 0)
goto out;
I assume (haven't checked) that INVALID_DATA is getting set when
READDIRPLUS's notice a change in the post_op_attr's?
I'm not sure what the correct behavior is here--any suggestions?
--b.
^ permalink raw reply [flat|nested] 2+ messages in thread
* ls -l regression from 311324ad1713
@ 2016-04-15 14:25 J. Bruce Fields
0 siblings, 0 replies; 2+ messages in thread
From: J. Bruce Fields @ 2016-04-15 14:25 UTC (permalink / raw)
To: Trond Myklebust; +Cc: linux-nfs
This change is making "ls -l" of large changing directories slower:
commit 311324ad1713
Author: Trond Myklebust <trond.myklebust@primarydata.com>
Date: Fri Feb 7 17:02:08 2014 -0500
NFS: Be more aggressive in using readdirplus for 'ls -l' situations
Try to detect 'ls -l' by having nfs_getattr() look at whether or not
there is an opendir() file descriptor for the parent directory.
If so, then assume that we want to force use of readdirplus in order
to avoid the multiple GETATTR calls over the wire.
Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
After that commit, if we create a large directory and then add and
remove entries from it continuously while doing an "ls -l", we see
multiple READDIRPLUS requests sent with cookie 0; it appears the readdir
is starting over from the beginning of the directory repeatedly.
It doesn't appear to be the changes to nfs_getattr that do this, instead
it's just the change to nfs_readdir to call nfs_revalidate_mapping() in
the case INVALID_DATA is set (as opposed to only in the case the
directory's attribute cache has expired):
+static bool nfs_dir_mapping_need_revalidate(struct inode *dir)
+{
+ struct nfs_inode *nfsi = NFS_I(dir);
+
+ if (nfs_attribute_cache_expired(dir))
+ return true;
+ if (nfsi->cache_validity & NFS_INO_INVALID_DATA)
+ return true;
+ return false;
+}
...
@@ -847,7 +881,7 @@ static int nfs_readdir(...
desc->plus = nfs_use_readdirplus(inode, ctx) ? 1 : 0;
nfs_block_sillyrename(dentry);
- if (ctx->pos == 0 || nfs_attribute_cache_expired(inode))
+ if (ctx->pos == 0 || nfs_dir_mapping_need_revalidate(inode))
res = nfs_revalidate_mapping(inode, file->f_mapping);
if (res < 0)
goto out;
I assume (haven't checked) that INVALID_DATA is getting set when
READDIRPLUS's notice a change in the post_op_attr's?
I'm not sure what the correct behavior is here--any suggestions?
--b.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2016-04-15 14:25 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-04-15 14:23 ls -l regression from 311324ad1713 J. Bruce Fields
-- strict thread matches above, loose matches on Subject: below --
2016-04-15 14:25 J. Bruce Fields
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).