]> git.apps.os.sepia.ceph.com Git - xfstests-dev.git/commit
btrfs: add functions to get and put a device for replace target
authorAnand Jain <Anand.Jain@oracle.com>
Thu, 23 Jun 2016 13:28:13 +0000 (21:28 +0800)
committerEryu Guan <eguan@redhat.com>
Fri, 1 Jul 2016 15:12:49 +0000 (23:12 +0800)
commit030c355ea095cb72d936de4493d2ce96050ac08c
treefa57d88028deda42d37451d36731c5a28daf5221
parent3dc4411e644b593518cf26e33568fe0b9dcb6317
btrfs: add functions to get and put a device for replace target

For the replace tests we need a device as a spare device,
here functions _spare_dev_get() and _spare_dev_put()
will get it from the SCRATCH_DEV_POOL_SAVED, which is set
when _scratch_dev_pool_get() is called, and is based on how
many has already been assigned to SCRATCH_DEV_POOL.

 usage:
   _scratch_dev_pool_get 3
   _spare_dev_get

      SPARE_DEV will have a device set which can be
      used as the replace target device.

   _spare_dev_put
   _scratch_dev_pool_put

_spare_dev_get() will pick the next device after SCRATCH_DEV_POOL
devices, from the SCRATCH_DEV_POOL_SAVED, and assigns it to
SPARE_DEV. _spare_dev_put() will set to SPARE_DEV to null.

Signed-off-by: Anand Jain <anand.jain@oracle.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
common/rc