]> granicus.if.org Git - zfs/commitdiff
Removing unneeded mutex for reading vq_pending_tree size
authorGregorKopka <mailfrom-github@kopka.net>
Thu, 19 Sep 2013 14:42:17 +0000 (16:42 +0200)
committerBrian Behlendorf <behlendorf1@llnl.gov>
Wed, 25 Sep 2013 22:29:45 +0000 (15:29 -0700)
Locking mutex &vq->vq_lock in vdev_mirror_pending is unneeded:

* no data is modified
* only vq_pending_tree is read
* in case garbage is returned (eg. vq_pending_tree being updated
  while the read is made) the worst case would be that a single
  read could be queued on a mirror side which more busy than thought

The benefit of this change is streamlining of the code path since
it is taken for *every* mirror member on *every* read.

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes #1739

module/zfs/vdev_mirror.c

index e0884dc3ce63915ffae6509563cb09eefa5acc54..e3d772ac20d729a35ae5f27f2099672809a3c12a 100644 (file)
@@ -89,14 +89,7 @@ static const zio_vsd_ops_t vdev_mirror_vsd_ops = {
 static int
 vdev_mirror_pending(vdev_t *vd)
 {
-       vdev_queue_t *vq = &vd->vdev_queue;
-       int pending;
-
-       mutex_enter(&vq->vq_lock);
-       pending = avl_numnodes(&vq->vq_pending_tree);
-       mutex_exit(&vq->vq_lock);
-
-       return (pending);
+       return avl_numnodes(&vd->vdev_queue.vq_pending_tree);
 }
 
 static mirror_map_t *