diff options
Diffstat (limited to 'drivers/md/bitmap.c')
-rw-r--r-- | drivers/md/bitmap.c | 44 |
1 files changed, 22 insertions, 22 deletions
diff --git a/drivers/md/bitmap.c b/drivers/md/bitmap.c index b65c36d9e240..fc05d1205aa0 100644 --- a/drivers/md/bitmap.c +++ b/drivers/md/bitmap.c | |||
@@ -341,7 +341,7 @@ static int write_page(struct bitmap *bitmap, struct page *page, int wait) | |||
341 | /* add to list to be waited for by daemon */ | 341 | /* add to list to be waited for by daemon */ |
342 | struct page_list *item = mempool_alloc(bitmap->write_pool, GFP_NOIO); | 342 | struct page_list *item = mempool_alloc(bitmap->write_pool, GFP_NOIO); |
343 | item->page = page; | 343 | item->page = page; |
344 | page_cache_get(page); | 344 | get_page(page); |
345 | spin_lock(&bitmap->write_lock); | 345 | spin_lock(&bitmap->write_lock); |
346 | list_add(&item->list, &bitmap->complete_pages); | 346 | list_add(&item->list, &bitmap->complete_pages); |
347 | spin_unlock(&bitmap->write_lock); | 347 | spin_unlock(&bitmap->write_lock); |
@@ -357,10 +357,10 @@ static struct page *read_page(struct file *file, unsigned long index, | |||
357 | struct inode *inode = file->f_mapping->host; | 357 | struct inode *inode = file->f_mapping->host; |
358 | struct page *page = NULL; | 358 | struct page *page = NULL; |
359 | loff_t isize = i_size_read(inode); | 359 | loff_t isize = i_size_read(inode); |
360 | unsigned long end_index = isize >> PAGE_CACHE_SHIFT; | 360 | unsigned long end_index = isize >> PAGE_SHIFT; |
361 | 361 | ||
362 | PRINTK("read bitmap file (%dB @ %Lu)\n", (int)PAGE_CACHE_SIZE, | 362 | PRINTK("read bitmap file (%dB @ %Lu)\n", (int)PAGE_SIZE, |
363 | (unsigned long long)index << PAGE_CACHE_SHIFT); | 363 | (unsigned long long)index << PAGE_SHIFT); |
364 | 364 | ||
365 | page = read_cache_page(inode->i_mapping, index, | 365 | page = read_cache_page(inode->i_mapping, index, |
366 | (filler_t *)inode->i_mapping->a_ops->readpage, file); | 366 | (filler_t *)inode->i_mapping->a_ops->readpage, file); |
@@ -368,7 +368,7 @@ static struct page *read_page(struct file *file, unsigned long index, | |||
368 | goto out; | 368 | goto out; |
369 | wait_on_page_locked(page); | 369 | wait_on_page_locked(page); |
370 | if (!PageUptodate(page) || PageError(page)) { | 370 | if (!PageUptodate(page) || PageError(page)) { |
371 | page_cache_release(page); | 371 | put_page(page); |
372 | page = ERR_PTR(-EIO); | 372 | page = ERR_PTR(-EIO); |
373 | goto out; | 373 | goto out; |
374 | } | 374 | } |
@@ -376,14 +376,14 @@ static struct page *read_page(struct file *file, unsigned long index, | |||
376 | if (index > end_index) /* we have read beyond EOF */ | 376 | if (index > end_index) /* we have read beyond EOF */ |
377 | *bytes_read = 0; | 377 | *bytes_read = 0; |
378 | else if (index == end_index) /* possible short read */ | 378 | else if (index == end_index) /* possible short read */ |
379 | *bytes_read = isize & ~PAGE_CACHE_MASK; | 379 | *bytes_read = isize & ~PAGE_MASK; |
380 | else | 380 | else |
381 | *bytes_read = PAGE_CACHE_SIZE; /* got a full page */ | 381 | *bytes_read = PAGE_SIZE; /* got a full page */ |
382 | out: | 382 | out: |
383 | if (IS_ERR(page)) | 383 | if (IS_ERR(page)) |
384 | printk(KERN_ALERT "md: bitmap read error: (%dB @ %Lu): %ld\n", | 384 | printk(KERN_ALERT "md: bitmap read error: (%dB @ %Lu): %ld\n", |
385 | (int)PAGE_CACHE_SIZE, | 385 | (int)PAGE_SIZE, |
386 | (unsigned long long)index << PAGE_CACHE_SHIFT, | 386 | (unsigned long long)index << PAGE_SHIFT, |
387 | PTR_ERR(page)); | 387 | PTR_ERR(page)); |
388 | return page; | 388 | return page; |
389 | } | 389 | } |
@@ -558,7 +558,7 @@ static void bitmap_mask_state(struct bitmap *bitmap, enum bitmap_state bits, | |||
558 | spin_unlock_irqrestore(&bitmap->lock, flags); | 558 | spin_unlock_irqrestore(&bitmap->lock, flags); |
559 | return; | 559 | return; |
560 | } | 560 | } |
561 | page_cache_get(bitmap->sb_page); | 561 | get_page(bitmap->sb_page); |
562 | spin_unlock_irqrestore(&bitmap->lock, flags); | 562 | spin_unlock_irqrestore(&bitmap->lock, flags); |
563 | sb = (bitmap_super_t *)kmap(bitmap->sb_page); | 563 | sb = (bitmap_super_t *)kmap(bitmap->sb_page); |
564 | switch (op) { | 564 | switch (op) { |
@@ -569,7 +569,7 @@ static void bitmap_mask_state(struct bitmap *bitmap, enum bitmap_state bits, | |||
569 | default: BUG(); | 569 | default: BUG(); |
570 | } | 570 | } |
571 | kunmap(bitmap->sb_page); | 571 | kunmap(bitmap->sb_page); |
572 | page_cache_release(bitmap->sb_page); | 572 | put_page(bitmap->sb_page); |
573 | } | 573 | } |
574 | 574 | ||
575 | /* | 575 | /* |
@@ -622,12 +622,12 @@ static void bitmap_file_unmap(struct bitmap *bitmap) | |||
622 | 622 | ||
623 | while (pages--) | 623 | while (pages--) |
624 | if (map[pages]->index != 0) /* 0 is sb_page, release it below */ | 624 | if (map[pages]->index != 0) /* 0 is sb_page, release it below */ |
625 | page_cache_release(map[pages]); | 625 | put_page(map[pages]); |
626 | kfree(map); | 626 | kfree(map); |
627 | kfree(attr); | 627 | kfree(attr); |
628 | 628 | ||
629 | if (sb_page) | 629 | if (sb_page) |
630 | page_cache_release(sb_page); | 630 | put_page(sb_page); |
631 | } | 631 | } |
632 | 632 | ||
633 | static void bitmap_stop_daemon(struct bitmap *bitmap); | 633 | static void bitmap_stop_daemon(struct bitmap *bitmap); |
@@ -654,7 +654,7 @@ static void drain_write_queues(struct bitmap *bitmap) | |||
654 | 654 | ||
655 | while ((item = dequeue_page(bitmap))) { | 655 | while ((item = dequeue_page(bitmap))) { |
656 | /* don't bother to wait */ | 656 | /* don't bother to wait */ |
657 | page_cache_release(item->page); | 657 | put_page(item->page); |
658 | mempool_free(item, bitmap->write_pool); | 658 | mempool_free(item, bitmap->write_pool); |
659 | } | 659 | } |
660 | 660 | ||
@@ -763,7 +763,7 @@ static void bitmap_file_set_bit(struct bitmap *bitmap, sector_t block) | |||
763 | 763 | ||
764 | /* make sure the page stays cached until it gets written out */ | 764 | /* make sure the page stays cached until it gets written out */ |
765 | if (! (get_page_attr(bitmap, page) & BITMAP_PAGE_DIRTY)) | 765 | if (! (get_page_attr(bitmap, page) & BITMAP_PAGE_DIRTY)) |
766 | page_cache_get(page); | 766 | get_page(page); |
767 | 767 | ||
768 | /* set the bit */ | 768 | /* set the bit */ |
769 | kaddr = kmap_atomic(page, KM_USER0); | 769 | kaddr = kmap_atomic(page, KM_USER0); |
@@ -938,7 +938,7 @@ static int bitmap_init_from_disk(struct bitmap *bitmap, sector_t start) | |||
938 | if (ret) { | 938 | if (ret) { |
939 | kunmap(page); | 939 | kunmap(page); |
940 | /* release, page not in filemap yet */ | 940 | /* release, page not in filemap yet */ |
941 | page_cache_release(page); | 941 | put_page(page); |
942 | goto out; | 942 | goto out; |
943 | } | 943 | } |
944 | } | 944 | } |
@@ -1043,7 +1043,7 @@ int bitmap_daemon_work(struct bitmap *bitmap) | |||
1043 | /* skip this page unless it's marked as needing cleaning */ | 1043 | /* skip this page unless it's marked as needing cleaning */ |
1044 | if (!((attr=get_page_attr(bitmap, page)) & BITMAP_PAGE_CLEAN)) { | 1044 | if (!((attr=get_page_attr(bitmap, page)) & BITMAP_PAGE_CLEAN)) { |
1045 | if (attr & BITMAP_PAGE_NEEDWRITE) { | 1045 | if (attr & BITMAP_PAGE_NEEDWRITE) { |
1046 | page_cache_get(page); | 1046 | get_page(page); |
1047 | clear_page_attr(bitmap, page, BITMAP_PAGE_NEEDWRITE); | 1047 | clear_page_attr(bitmap, page, BITMAP_PAGE_NEEDWRITE); |
1048 | } | 1048 | } |
1049 | spin_unlock_irqrestore(&bitmap->lock, flags); | 1049 | spin_unlock_irqrestore(&bitmap->lock, flags); |
@@ -1057,13 +1057,13 @@ int bitmap_daemon_work(struct bitmap *bitmap) | |||
1057 | default: | 1057 | default: |
1058 | bitmap_file_kick(bitmap); | 1058 | bitmap_file_kick(bitmap); |
1059 | } | 1059 | } |
1060 | page_cache_release(page); | 1060 | put_page(page); |
1061 | } | 1061 | } |
1062 | continue; | 1062 | continue; |
1063 | } | 1063 | } |
1064 | 1064 | ||
1065 | /* grab the new page, sync and release the old */ | 1065 | /* grab the new page, sync and release the old */ |
1066 | page_cache_get(page); | 1066 | get_page(page); |
1067 | if (lastpage != NULL) { | 1067 | if (lastpage != NULL) { |
1068 | if (get_page_attr(bitmap, lastpage) & BITMAP_PAGE_NEEDWRITE) { | 1068 | if (get_page_attr(bitmap, lastpage) & BITMAP_PAGE_NEEDWRITE) { |
1069 | clear_page_attr(bitmap, lastpage, BITMAP_PAGE_NEEDWRITE); | 1069 | clear_page_attr(bitmap, lastpage, BITMAP_PAGE_NEEDWRITE); |
@@ -1078,7 +1078,7 @@ int bitmap_daemon_work(struct bitmap *bitmap) | |||
1078 | spin_unlock_irqrestore(&bitmap->lock, flags); | 1078 | spin_unlock_irqrestore(&bitmap->lock, flags); |
1079 | } | 1079 | } |
1080 | kunmap(lastpage); | 1080 | kunmap(lastpage); |
1081 | page_cache_release(lastpage); | 1081 | put_page(lastpage); |
1082 | if (err) | 1082 | if (err) |
1083 | bitmap_file_kick(bitmap); | 1083 | bitmap_file_kick(bitmap); |
1084 | } else | 1084 | } else |
@@ -1133,7 +1133,7 @@ int bitmap_daemon_work(struct bitmap *bitmap) | |||
1133 | spin_unlock_irqrestore(&bitmap->lock, flags); | 1133 | spin_unlock_irqrestore(&bitmap->lock, flags); |
1134 | } | 1134 | } |
1135 | 1135 | ||
1136 | page_cache_release(lastpage); | 1136 | put_page(lastpage); |
1137 | } | 1137 | } |
1138 | 1138 | ||
1139 | return err; | 1139 | return err; |
@@ -1184,7 +1184,7 @@ static void bitmap_writeback_daemon(mddev_t *mddev) | |||
1184 | PRINTK("finished page writeback: %p\n", page); | 1184 | PRINTK("finished page writeback: %p\n", page); |
1185 | 1185 | ||
1186 | err = PageError(page); | 1186 | err = PageError(page); |
1187 | page_cache_release(page); | 1187 | put_page(page); |
1188 | if (err) { | 1188 | if (err) { |
1189 | printk(KERN_WARNING "%s: bitmap file writeback " | 1189 | printk(KERN_WARNING "%s: bitmap file writeback " |
1190 | "failed (page %lu): %d\n", | 1190 | "failed (page %lu): %d\n", |