Whamcloud - gitweb
LU-11623 llite: hash just created files if lock allows 84/33584/9
authorOleg Drokin <green@whamcloud.com>
Tue, 6 Nov 2018 00:26:44 +0000 (19:26 -0500)
committerOleg Drokin <green@whamcloud.com>
Sat, 1 Jun 2019 03:59:19 +0000 (03:59 +0000)
If open|creat (and other intent operations later) returned a lookup bit
as part of the lock, hash the resultant dentry under this lock,
not to trigger further RPCs in subsequent lookups.

Benchmark results:

This patch can significantly improve open-create + stat on the same
client.

This patch in combination with two others:

https://review.whamcloud.com/32157
https://review.whamcloud.com/33585

Improves the 'stat' side of open-create + stat by >10x.

Without patches (master branch commit 26a7abe):

mpirun -np 24 --allow-run-as-root /work/tools/bin/mdtest -n 50000 -d /cache1/out/ -F -C -T -v -w 32k

   Operation                      Max            Min           Mean        Std Dev
   ---------                      ---            ---           ----        -------
   File creation     :       3838.205       3838.204       3838.204          0.000
   File stat         :      33459.289      33459.249      33459.271          0.011
   File read         :          0.000          0.000          0.000          0.000
   File removal      :          0.000          0.000          0.000          0.000
   Tree creation     :       3146.841       3146.841       3146.841          0.000
   Tree removal      :          0.000          0.000          0.000          0.000

With the three patches:

mpirun -np 24 --allow-run-as-root /work/tools/bin/mdtest -n 50000 -d /cache1/out/ -F -C -T -v -w 32k
SUMMARY rate: (of 1 iterations)
   Operation                      Max            Min           Mean        Std Dev
   ---------                      ---            ---           ----        -------
   File creation     :       3822.440       3822.439       3822.440          0.000
   File stat         :     350620.140     350615.980     350617.193          1.051
   File read         :          0.000          0.000          0.000          0.000
   File removal      :          0.000          0.000          0.000          0.000
   Tree creation     :       2076.727       2076.727       2076.727          0.000
   Tree removal      :          0.000          0.000          0.000          0.000

Note 33K stats/second vs 350K stats/second.

ls -l time of the mdtest directory is also reduced from 23.5 seconds to
5.8 seconds.

Change-Id: Id5140d1042af7f5ab9052922e11a7eda8f92a29a
Signed-off-by: Oleg Drokin <green@whamcloud.com>
Reviewed-on: https://review.whamcloud.com/33584
Tested-by: Jenkins
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Patrick Farrell <pfarrell@whamcloud.com>
lustre/llite/namei.c

index f21f961..80bfd7b 100644 (file)
@@ -693,9 +693,9 @@ static int ll_lookup_it_finish(struct ptlrpc_request *request,
                if (bits & MDS_INODELOCK_LOOKUP)
                        d_lustre_revalidate(*de);
        } else if (!it_disposition(it, DISP_OPEN_CREATE)) {
-               /* If file created on server, don't depend on parent UPDATE
-                * lock to unhide it. It is left hidden and next lookup can
-                * find it in ll_splice_alias.
+               /*
+                * If file was created on the server, the dentry is revalidated
+                * in ll_create_it if the lock allows for it.
                 */
                /* Check that parent has UPDATE lock. */
                struct lookup_intent parent_it = {
@@ -1174,6 +1174,7 @@ static int ll_create_it(struct inode *dir, struct dentry *dentry,
                        void *secctx, __u32 secctxlen)
 {
        struct inode *inode;
+       __u64 bits = 0;
        int rc = 0;
        ENTRY;
 
@@ -1209,6 +1210,10 @@ static int ll_create_it(struct inode *dir, struct dentry *dentry,
                        RETURN(rc);
        }
 
+       ll_set_lock_data(ll_i2sbi(dir)->ll_md_exp, inode, it, &bits);
+       if (bits & MDS_INODELOCK_LOOKUP)
+               d_lustre_revalidate(dentry);
+
        RETURN(0);
 }