mirror of https://gitee.com/openkylin/linux.git
xen-blkfront: use bitmap_set() and bitmap_clear()
Use bitmap_set and bitmap_clear rather than modifying individual bits in a memory region. Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com> Cc: Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com> Cc: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> Cc: xen-devel@lists.xensource.com Cc: virtualization@lists.linux-foundation.org Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
This commit is contained in:
parent
b2167ba6dd
commit
34ae2e47d9
|
@ -43,6 +43,7 @@
|
||||||
#include <linux/slab.h>
|
#include <linux/slab.h>
|
||||||
#include <linux/mutex.h>
|
#include <linux/mutex.h>
|
||||||
#include <linux/scatterlist.h>
|
#include <linux/scatterlist.h>
|
||||||
|
#include <linux/bitmap.h>
|
||||||
|
|
||||||
#include <xen/xen.h>
|
#include <xen/xen.h>
|
||||||
#include <xen/xenbus.h>
|
#include <xen/xenbus.h>
|
||||||
|
@ -177,8 +178,7 @@ static int xlbd_reserve_minors(unsigned int minor, unsigned int nr)
|
||||||
|
|
||||||
spin_lock(&minor_lock);
|
spin_lock(&minor_lock);
|
||||||
if (find_next_bit(minors, end, minor) >= end) {
|
if (find_next_bit(minors, end, minor) >= end) {
|
||||||
for (; minor < end; ++minor)
|
bitmap_set(minors, minor, nr);
|
||||||
__set_bit(minor, minors);
|
|
||||||
rc = 0;
|
rc = 0;
|
||||||
} else
|
} else
|
||||||
rc = -EBUSY;
|
rc = -EBUSY;
|
||||||
|
@ -193,8 +193,7 @@ static void xlbd_release_minors(unsigned int minor, unsigned int nr)
|
||||||
|
|
||||||
BUG_ON(end > nr_minors);
|
BUG_ON(end > nr_minors);
|
||||||
spin_lock(&minor_lock);
|
spin_lock(&minor_lock);
|
||||||
for (; minor < end; ++minor)
|
bitmap_clear(minors, minor, nr);
|
||||||
__clear_bit(minor, minors);
|
|
||||||
spin_unlock(&minor_lock);
|
spin_unlock(&minor_lock);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue