提交 74667123 编写于 作者: N NeilBrown

md/bitmap: convert some spin_lock_irqsave to spin_lock_irq

All of these sites can only be called from process context with
irqs enabled, so using irqsave/irqrestore just adds noise.
Remove it.
Signed-off-by: NNeilBrown <neilb@suse.de>
上级 b405fe91
...@@ -737,10 +737,9 @@ static void bitmap_file_unmap(struct bitmap *bitmap) ...@@ -737,10 +737,9 @@ static void bitmap_file_unmap(struct bitmap *bitmap)
struct page **map, *sb_page; struct page **map, *sb_page;
unsigned long *attr; unsigned long *attr;
int pages; int pages;
unsigned long flags;
struct bitmap_storage *store = &bitmap->storage; struct bitmap_storage *store = &bitmap->storage;
spin_lock_irqsave(&bitmap->lock, flags); spin_lock_irq(&bitmap->lock);
map = store->filemap; map = store->filemap;
store->filemap = NULL; store->filemap = NULL;
attr = store->filemap_attr; attr = store->filemap_attr;
...@@ -749,7 +748,7 @@ static void bitmap_file_unmap(struct bitmap *bitmap) ...@@ -749,7 +748,7 @@ static void bitmap_file_unmap(struct bitmap *bitmap)
store->file_pages = 0; store->file_pages = 0;
sb_page = store->sb_page; sb_page = store->sb_page;
store->sb_page = NULL; store->sb_page = NULL;
spin_unlock_irqrestore(&bitmap->lock, flags); spin_unlock_irq(&bitmap->lock);
while (pages--) while (pages--)
if (map[pages] != sb_page) /* 0 is sb_page, release it below */ if (map[pages] != sb_page) /* 0 is sb_page, release it below */
...@@ -764,12 +763,11 @@ static void bitmap_file_unmap(struct bitmap *bitmap) ...@@ -764,12 +763,11 @@ static void bitmap_file_unmap(struct bitmap *bitmap)
static void bitmap_file_put(struct bitmap *bitmap) static void bitmap_file_put(struct bitmap *bitmap)
{ {
struct file *file; struct file *file;
unsigned long flags;
spin_lock_irqsave(&bitmap->lock, flags); spin_lock_irq(&bitmap->lock);
file = bitmap->storage.file; file = bitmap->storage.file;
bitmap->storage.file = NULL; bitmap->storage.file = NULL;
spin_unlock_irqrestore(&bitmap->lock, flags); spin_unlock_irq(&bitmap->lock);
if (file) if (file)
wait_event(bitmap->write_wait, wait_event(bitmap->write_wait,
...@@ -901,7 +899,7 @@ static void bitmap_file_clear_bit(struct bitmap *bitmap, sector_t block) ...@@ -901,7 +899,7 @@ static void bitmap_file_clear_bit(struct bitmap *bitmap, sector_t block)
* sync the dirty pages of the bitmap file to disk */ * sync the dirty pages of the bitmap file to disk */
void bitmap_unplug(struct bitmap *bitmap) void bitmap_unplug(struct bitmap *bitmap)
{ {
unsigned long i, flags; unsigned long i;
int dirty, need_write; int dirty, need_write;
int wait = 0; int wait = 0;
...@@ -911,9 +909,9 @@ void bitmap_unplug(struct bitmap *bitmap) ...@@ -911,9 +909,9 @@ void bitmap_unplug(struct bitmap *bitmap)
/* look at each page to see if there are any set bits that need to be /* look at each page to see if there are any set bits that need to be
* flushed out to disk */ * flushed out to disk */
for (i = 0; i < bitmap->storage.file_pages; i++) { for (i = 0; i < bitmap->storage.file_pages; i++) {
spin_lock_irqsave(&bitmap->lock, flags); spin_lock_irq(&bitmap->lock);
if (!bitmap->storage.filemap) { if (!bitmap->storage.filemap) {
spin_unlock_irqrestore(&bitmap->lock, flags); spin_unlock_irq(&bitmap->lock);
return; return;
} }
dirty = test_page_attr(bitmap, i, BITMAP_PAGE_DIRTY); dirty = test_page_attr(bitmap, i, BITMAP_PAGE_DIRTY);
...@@ -924,7 +922,7 @@ void bitmap_unplug(struct bitmap *bitmap) ...@@ -924,7 +922,7 @@ void bitmap_unplug(struct bitmap *bitmap)
clear_page_attr(bitmap, i, BITMAP_PAGE_PENDING); clear_page_attr(bitmap, i, BITMAP_PAGE_PENDING);
if (dirty) if (dirty)
wait = 1; wait = 1;
spin_unlock_irqrestore(&bitmap->lock, flags); spin_unlock_irq(&bitmap->lock);
if (dirty || need_write) if (dirty || need_write)
write_page(bitmap, bitmap->storage.filemap[i], 0); write_page(bitmap, bitmap->storage.filemap[i], 0);
...@@ -1129,7 +1127,6 @@ void bitmap_daemon_work(struct mddev *mddev) ...@@ -1129,7 +1127,6 @@ void bitmap_daemon_work(struct mddev *mddev)
struct bitmap *bitmap; struct bitmap *bitmap;
unsigned long j; unsigned long j;
unsigned long nextpage; unsigned long nextpage;
unsigned long flags;
sector_t blocks; sector_t blocks;
/* Use a mutex to guard daemon_work against /* Use a mutex to guard daemon_work against
...@@ -1156,7 +1153,7 @@ void bitmap_daemon_work(struct mddev *mddev) ...@@ -1156,7 +1153,7 @@ void bitmap_daemon_work(struct mddev *mddev)
* So set NEEDWRITE now, then after we make any last-minute changes * So set NEEDWRITE now, then after we make any last-minute changes
* we will write it. * we will write it.
*/ */
spin_lock_irqsave(&bitmap->lock, flags); spin_lock_irq(&bitmap->lock);
for (j = 0; j < bitmap->storage.file_pages; j++) for (j = 0; j < bitmap->storage.file_pages; j++)
if (test_page_attr(bitmap, j, if (test_page_attr(bitmap, j,
BITMAP_PAGE_PENDING)) { BITMAP_PAGE_PENDING)) {
...@@ -1235,14 +1232,14 @@ void bitmap_daemon_work(struct mddev *mddev) ...@@ -1235,14 +1232,14 @@ void bitmap_daemon_work(struct mddev *mddev)
BITMAP_PAGE_NEEDWRITE)) { BITMAP_PAGE_NEEDWRITE)) {
clear_page_attr(bitmap, j, clear_page_attr(bitmap, j,
BITMAP_PAGE_NEEDWRITE); BITMAP_PAGE_NEEDWRITE);
spin_unlock_irqrestore(&bitmap->lock, flags); spin_unlock_irq(&bitmap->lock);
write_page(bitmap, bitmap->storage.filemap[j], 0); write_page(bitmap, bitmap->storage.filemap[j], 0);
spin_lock_irqsave(&bitmap->lock, flags); spin_lock_irq(&bitmap->lock);
if (!bitmap->storage.filemap) if (!bitmap->storage.filemap)
break; break;
} }
} }
spin_unlock_irqrestore(&bitmap->lock, flags); spin_unlock_irq(&bitmap->lock);
done: done:
if (bitmap->allclean == 0) if (bitmap->allclean == 0)
...@@ -1815,12 +1812,11 @@ EXPORT_SYMBOL_GPL(bitmap_load); ...@@ -1815,12 +1812,11 @@ EXPORT_SYMBOL_GPL(bitmap_load);
void bitmap_status(struct seq_file *seq, struct bitmap *bitmap) void bitmap_status(struct seq_file *seq, struct bitmap *bitmap)
{ {
unsigned long chunk_kb; unsigned long chunk_kb;
unsigned long flags;
if (!bitmap) if (!bitmap)
return; return;
spin_lock_irqsave(&bitmap->lock, flags); spin_lock_irq(&bitmap->lock);
chunk_kb = bitmap->mddev->bitmap_info.chunksize >> 10; chunk_kb = bitmap->mddev->bitmap_info.chunksize >> 10;
seq_printf(seq, "bitmap: %lu/%lu pages [%luKB], " seq_printf(seq, "bitmap: %lu/%lu pages [%luKB], "
"%lu%s chunk", "%lu%s chunk",
...@@ -1836,7 +1832,7 @@ void bitmap_status(struct seq_file *seq, struct bitmap *bitmap) ...@@ -1836,7 +1832,7 @@ void bitmap_status(struct seq_file *seq, struct bitmap *bitmap)
} }
seq_printf(seq, "\n"); seq_printf(seq, "\n");
spin_unlock_irqrestore(&bitmap->lock, flags); spin_unlock_irq(&bitmap->lock);
} }
static ssize_t static ssize_t
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册