Whamcloud - gitweb
LU-11775 osc: check if opg is in lru list without locking 60/33860/4
authorLi Dongyang <dongyangli@ddn.com>
Fri, 14 Dec 2018 01:36:22 +0000 (12:36 +1100)
committerOleg Drokin <green@whamcloud.com>
Wed, 27 Feb 2019 18:03:06 +0000 (18:03 +0000)
osc_lru_use is called for every page queued for io,
we can just check if the osc_page is in the lru list
without taking the cl_lru_list_lock and return if not
as a fast path.
Note we still need to do the check again after locking
as it could be removed from the lru list by another thread.

Signed-off-by: Li Dongyang <dongyangli@ddn.com>
Change-Id: I1587b6b5547ae5a7a8bfe32a78361bb888c85d5b
Reviewed-on: https://review.whamcloud.com/33860
Reviewed-by: Patrick Farrell <pfarrell@whamcloud.com>
Tested-by: Jenkins
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Alexey Lyashkov <c17817@cray.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lustre/osc/osc_page.c

index ff64374..cd4107b 100644 (file)
@@ -516,6 +516,8 @@ static void osc_lru_use(struct client_obd *cli, struct osc_page *opg)
        /* If page is being transferred for the first time,
         * ops_lru should be empty */
        if (opg->ops_in_lru) {
+               if (list_empty(&opg->ops_lru))
+                       return;
                spin_lock(&cli->cl_lru_list_lock);
                if (!list_empty(&opg->ops_lru)) {
                        __osc_lru_del(cli, opg);