Whamcloud - gitweb
LU-8837 lmv: don't use lqr_alloc spinlock in lmv 49/41949/6
authorMr NeilBrown <neilb@suse.de>
Mon, 8 Mar 2021 22:28:48 +0000 (09:28 +1100)
committerOleg Drokin <green@whamcloud.com>
Mon, 22 Mar 2021 16:26:20 +0000 (16:26 +0000)
The only place the lrq_alloc spinlock is used in lmv is in
lmv_locate_tgt_rr().  The purpose here is presumably to protect
lmv_qos_rr_index from concurrent updates.  This is a field that is
only tangentially related the the structure that holds the spinlock.

lmv_qos_rr_index is directly in 'struct lmv_obd' while lqr_alloc
is in struct lu_qos_rr which is in struct lu_qos, which is in lmv_obd.

As there is a spinlock in 'struct lmv_obd' (lmv_lock) it makes more
sense to use that to protect lmv_qos_rr_index.  Then the entire
lu_qos_rr structure will be unused on the client and can be made
server-only.

Test-Parameters: trivial
Signed-off-by: Mr NeilBrown <neilb@suse.de>
Change-Id: I926e6d31ca0ee1cbfff9905192428e28485ed448
Reviewed-on: https://review.whamcloud.com/41949
Reviewed-by: Lai Siyao <lai.siyao@whamcloud.com>
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: James Simmons <jsimmons@infradead.org>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lustre/lmv/lmv_obd.c

index 5c95be1..a32a763 100644 (file)
@@ -1523,7 +1523,7 @@ static struct lu_tgt_desc *lmv_locate_tgt_rr(struct lmv_obd *lmv, __u32 *mdt)
 
        ENTRY;
 
-       spin_lock(&lmv->lmv_qos.lq_rr.lqr_alloc);
+       spin_lock(&lmv->lmv_lock);
        for (i = 0; i < lmv->lmv_mdt_descs.ltd_tgts_size; i++) {
                index = (i + lmv->lmv_qos_rr_index) %
                        lmv->lmv_mdt_descs.ltd_tgts_size;
@@ -1534,11 +1534,11 @@ static struct lu_tgt_desc *lmv_locate_tgt_rr(struct lmv_obd *lmv, __u32 *mdt)
                *mdt = tgt->ltd_index;
                lmv->lmv_qos_rr_index = (*mdt + 1) %
                                        lmv->lmv_mdt_descs.ltd_tgts_size;
-               spin_unlock(&lmv->lmv_qos.lq_rr.lqr_alloc);
+               spin_unlock(&lmv->lmv_lock);
 
                RETURN(tgt);
        }
-       spin_unlock(&lmv->lmv_qos.lq_rr.lqr_alloc);
+       spin_unlock(&lmv->lmv_lock);
 
        RETURN(ERR_PTR(-ENODEV));
 }