提交 b2f46e68 编写于 作者: C Cong Wang 提交者: Cong Wang

md: remove the second argument of k[un]map_atomic()

Acked-by: NNeilBrown <neilb@suse.de>
Signed-off-by: NCong Wang <amwang@redhat.com>
上级 2a156d09
...@@ -457,7 +457,7 @@ void bitmap_update_sb(struct bitmap *bitmap) ...@@ -457,7 +457,7 @@ void bitmap_update_sb(struct bitmap *bitmap)
return; return;
} }
spin_unlock_irqrestore(&bitmap->lock, flags); spin_unlock_irqrestore(&bitmap->lock, flags);
sb = kmap_atomic(bitmap->sb_page, KM_USER0); sb = kmap_atomic(bitmap->sb_page);
sb->events = cpu_to_le64(bitmap->mddev->events); sb->events = cpu_to_le64(bitmap->mddev->events);
if (bitmap->mddev->events < bitmap->events_cleared) if (bitmap->mddev->events < bitmap->events_cleared)
/* rocking back to read-only */ /* rocking back to read-only */
...@@ -467,7 +467,7 @@ void bitmap_update_sb(struct bitmap *bitmap) ...@@ -467,7 +467,7 @@ void bitmap_update_sb(struct bitmap *bitmap)
/* Just in case these have been changed via sysfs: */ /* Just in case these have been changed via sysfs: */
sb->daemon_sleep = cpu_to_le32(bitmap->mddev->bitmap_info.daemon_sleep/HZ); sb->daemon_sleep = cpu_to_le32(bitmap->mddev->bitmap_info.daemon_sleep/HZ);
sb->write_behind = cpu_to_le32(bitmap->mddev->bitmap_info.max_write_behind); sb->write_behind = cpu_to_le32(bitmap->mddev->bitmap_info.max_write_behind);
kunmap_atomic(sb, KM_USER0); kunmap_atomic(sb);
write_page(bitmap, bitmap->sb_page, 1); write_page(bitmap, bitmap->sb_page, 1);
} }
...@@ -478,7 +478,7 @@ void bitmap_print_sb(struct bitmap *bitmap) ...@@ -478,7 +478,7 @@ void bitmap_print_sb(struct bitmap *bitmap)
if (!bitmap || !bitmap->sb_page) if (!bitmap || !bitmap->sb_page)
return; return;
sb = kmap_atomic(bitmap->sb_page, KM_USER0); sb = kmap_atomic(bitmap->sb_page);
printk(KERN_DEBUG "%s: bitmap file superblock:\n", bmname(bitmap)); printk(KERN_DEBUG "%s: bitmap file superblock:\n", bmname(bitmap));
printk(KERN_DEBUG " magic: %08x\n", le32_to_cpu(sb->magic)); printk(KERN_DEBUG " magic: %08x\n", le32_to_cpu(sb->magic));
printk(KERN_DEBUG " version: %d\n", le32_to_cpu(sb->version)); printk(KERN_DEBUG " version: %d\n", le32_to_cpu(sb->version));
...@@ -497,7 +497,7 @@ void bitmap_print_sb(struct bitmap *bitmap) ...@@ -497,7 +497,7 @@ void bitmap_print_sb(struct bitmap *bitmap)
printk(KERN_DEBUG " sync size: %llu KB\n", printk(KERN_DEBUG " sync size: %llu KB\n",
(unsigned long long)le64_to_cpu(sb->sync_size)/2); (unsigned long long)le64_to_cpu(sb->sync_size)/2);
printk(KERN_DEBUG "max write behind: %d\n", le32_to_cpu(sb->write_behind)); printk(KERN_DEBUG "max write behind: %d\n", le32_to_cpu(sb->write_behind));
kunmap_atomic(sb, KM_USER0); kunmap_atomic(sb);
} }
/* /*
...@@ -525,7 +525,7 @@ static int bitmap_new_disk_sb(struct bitmap *bitmap) ...@@ -525,7 +525,7 @@ static int bitmap_new_disk_sb(struct bitmap *bitmap)
} }
bitmap->sb_page->index = 0; bitmap->sb_page->index = 0;
sb = kmap_atomic(bitmap->sb_page, KM_USER0); sb = kmap_atomic(bitmap->sb_page);
sb->magic = cpu_to_le32(BITMAP_MAGIC); sb->magic = cpu_to_le32(BITMAP_MAGIC);
sb->version = cpu_to_le32(BITMAP_MAJOR_HI); sb->version = cpu_to_le32(BITMAP_MAJOR_HI);
...@@ -533,7 +533,7 @@ static int bitmap_new_disk_sb(struct bitmap *bitmap) ...@@ -533,7 +533,7 @@ static int bitmap_new_disk_sb(struct bitmap *bitmap)
chunksize = bitmap->mddev->bitmap_info.chunksize; chunksize = bitmap->mddev->bitmap_info.chunksize;
BUG_ON(!chunksize); BUG_ON(!chunksize);
if (!is_power_of_2(chunksize)) { if (!is_power_of_2(chunksize)) {
kunmap_atomic(sb, KM_USER0); kunmap_atomic(sb);
printk(KERN_ERR "bitmap chunksize not a power of 2\n"); printk(KERN_ERR "bitmap chunksize not a power of 2\n");
return -EINVAL; return -EINVAL;
} }
...@@ -571,7 +571,7 @@ static int bitmap_new_disk_sb(struct bitmap *bitmap) ...@@ -571,7 +571,7 @@ static int bitmap_new_disk_sb(struct bitmap *bitmap)
bitmap->flags |= BITMAP_HOSTENDIAN; bitmap->flags |= BITMAP_HOSTENDIAN;
sb->version = cpu_to_le32(BITMAP_MAJOR_HOSTENDIAN); sb->version = cpu_to_le32(BITMAP_MAJOR_HOSTENDIAN);
kunmap_atomic(sb, KM_USER0); kunmap_atomic(sb);
return 0; return 0;
} }
...@@ -603,7 +603,7 @@ static int bitmap_read_sb(struct bitmap *bitmap) ...@@ -603,7 +603,7 @@ static int bitmap_read_sb(struct bitmap *bitmap)
return err; return err;
} }
sb = kmap_atomic(bitmap->sb_page, KM_USER0); sb = kmap_atomic(bitmap->sb_page);
chunksize = le32_to_cpu(sb->chunksize); chunksize = le32_to_cpu(sb->chunksize);
daemon_sleep = le32_to_cpu(sb->daemon_sleep) * HZ; daemon_sleep = le32_to_cpu(sb->daemon_sleep) * HZ;
...@@ -664,7 +664,7 @@ static int bitmap_read_sb(struct bitmap *bitmap) ...@@ -664,7 +664,7 @@ static int bitmap_read_sb(struct bitmap *bitmap)
bitmap->events_cleared = bitmap->mddev->events; bitmap->events_cleared = bitmap->mddev->events;
err = 0; err = 0;
out: out:
kunmap_atomic(sb, KM_USER0); kunmap_atomic(sb);
if (err) if (err)
bitmap_print_sb(bitmap); bitmap_print_sb(bitmap);
return err; return err;
...@@ -689,7 +689,7 @@ static int bitmap_mask_state(struct bitmap *bitmap, enum bitmap_state bits, ...@@ -689,7 +689,7 @@ static int bitmap_mask_state(struct bitmap *bitmap, enum bitmap_state bits,
return 0; return 0;
} }
spin_unlock_irqrestore(&bitmap->lock, flags); spin_unlock_irqrestore(&bitmap->lock, flags);
sb = kmap_atomic(bitmap->sb_page, KM_USER0); sb = kmap_atomic(bitmap->sb_page);
old = le32_to_cpu(sb->state) & bits; old = le32_to_cpu(sb->state) & bits;
switch (op) { switch (op) {
case MASK_SET: case MASK_SET:
...@@ -703,7 +703,7 @@ static int bitmap_mask_state(struct bitmap *bitmap, enum bitmap_state bits, ...@@ -703,7 +703,7 @@ static int bitmap_mask_state(struct bitmap *bitmap, enum bitmap_state bits,
default: default:
BUG(); BUG();
} }
kunmap_atomic(sb, KM_USER0); kunmap_atomic(sb);
return old; return old;
} }
...@@ -881,12 +881,12 @@ static void bitmap_file_set_bit(struct bitmap *bitmap, sector_t block) ...@@ -881,12 +881,12 @@ static void bitmap_file_set_bit(struct bitmap *bitmap, sector_t block)
bit = file_page_offset(bitmap, chunk); bit = file_page_offset(bitmap, chunk);
/* set the bit */ /* set the bit */
kaddr = kmap_atomic(page, KM_USER0); kaddr = kmap_atomic(page);
if (bitmap->flags & BITMAP_HOSTENDIAN) if (bitmap->flags & BITMAP_HOSTENDIAN)
set_bit(bit, kaddr); set_bit(bit, kaddr);
else else
__set_bit_le(bit, kaddr); __set_bit_le(bit, kaddr);
kunmap_atomic(kaddr, KM_USER0); kunmap_atomic(kaddr);
pr_debug("set file bit %lu page %lu\n", bit, page->index); pr_debug("set file bit %lu page %lu\n", bit, page->index);
/* record page number so it gets flushed to disk when unplug occurs */ /* record page number so it gets flushed to disk when unplug occurs */
set_page_attr(bitmap, page, BITMAP_PAGE_DIRTY); set_page_attr(bitmap, page, BITMAP_PAGE_DIRTY);
...@@ -1050,10 +1050,10 @@ static int bitmap_init_from_disk(struct bitmap *bitmap, sector_t start) ...@@ -1050,10 +1050,10 @@ static int bitmap_init_from_disk(struct bitmap *bitmap, sector_t start)
* if bitmap is out of date, dirty the * if bitmap is out of date, dirty the
* whole page and write it out * whole page and write it out
*/ */
paddr = kmap_atomic(page, KM_USER0); paddr = kmap_atomic(page);
memset(paddr + offset, 0xff, memset(paddr + offset, 0xff,
PAGE_SIZE - offset); PAGE_SIZE - offset);
kunmap_atomic(paddr, KM_USER0); kunmap_atomic(paddr);
write_page(bitmap, page, 1); write_page(bitmap, page, 1);
ret = -EIO; ret = -EIO;
...@@ -1061,12 +1061,12 @@ static int bitmap_init_from_disk(struct bitmap *bitmap, sector_t start) ...@@ -1061,12 +1061,12 @@ static int bitmap_init_from_disk(struct bitmap *bitmap, sector_t start)
goto err; goto err;
} }
} }
paddr = kmap_atomic(page, KM_USER0); paddr = kmap_atomic(page);
if (bitmap->flags & BITMAP_HOSTENDIAN) if (bitmap->flags & BITMAP_HOSTENDIAN)
b = test_bit(bit, paddr); b = test_bit(bit, paddr);
else else
b = test_bit_le(bit, paddr); b = test_bit_le(bit, paddr);
kunmap_atomic(paddr, KM_USER0); kunmap_atomic(paddr);
if (b) { if (b) {
/* if the disk bit is set, set the memory bit */ /* if the disk bit is set, set the memory bit */
int needed = ((sector_t)(i+1) << (CHUNK_BLOCK_SHIFT(bitmap)) int needed = ((sector_t)(i+1) << (CHUNK_BLOCK_SHIFT(bitmap))
...@@ -1209,10 +1209,10 @@ void bitmap_daemon_work(struct mddev *mddev) ...@@ -1209,10 +1209,10 @@ void bitmap_daemon_work(struct mddev *mddev)
mddev->bitmap_info.external == 0) { mddev->bitmap_info.external == 0) {
bitmap_super_t *sb; bitmap_super_t *sb;
bitmap->need_sync = 0; bitmap->need_sync = 0;
sb = kmap_atomic(bitmap->sb_page, KM_USER0); sb = kmap_atomic(bitmap->sb_page);
sb->events_cleared = sb->events_cleared =
cpu_to_le64(bitmap->events_cleared); cpu_to_le64(bitmap->events_cleared);
kunmap_atomic(sb, KM_USER0); kunmap_atomic(sb);
write_page(bitmap, bitmap->sb_page, 1); write_page(bitmap, bitmap->sb_page, 1);
} }
spin_lock_irqsave(&bitmap->lock, flags); spin_lock_irqsave(&bitmap->lock, flags);
...@@ -1235,7 +1235,7 @@ void bitmap_daemon_work(struct mddev *mddev) ...@@ -1235,7 +1235,7 @@ void bitmap_daemon_work(struct mddev *mddev)
-1); -1);
/* clear the bit */ /* clear the bit */
paddr = kmap_atomic(page, KM_USER0); paddr = kmap_atomic(page);
if (bitmap->flags & BITMAP_HOSTENDIAN) if (bitmap->flags & BITMAP_HOSTENDIAN)
clear_bit(file_page_offset(bitmap, j), clear_bit(file_page_offset(bitmap, j),
paddr); paddr);
...@@ -1244,7 +1244,7 @@ void bitmap_daemon_work(struct mddev *mddev) ...@@ -1244,7 +1244,7 @@ void bitmap_daemon_work(struct mddev *mddev)
file_page_offset(bitmap, file_page_offset(bitmap,
j), j),
paddr); paddr);
kunmap_atomic(paddr, KM_USER0); kunmap_atomic(paddr);
} else if (*bmc <= 2) { } else if (*bmc <= 2) {
*bmc = 1; /* maybe clear the bit next time */ *bmc = 1; /* maybe clear the bit next time */
set_page_attr(bitmap, page, BITMAP_PAGE_PENDING); set_page_attr(bitmap, page, BITMAP_PAGE_PENDING);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册