BITMAP_PAGE_NEEDWRITE = 2, /* there are cleared bits that need to be synced */
};
-static inline void set_page_attr(struct bitmap *bitmap, struct page *page,
- enum bitmap_page_attr attr)
+static inline void set_page_attr(struct bitmap *bitmap, int pnum,
+ enum bitmap_page_attr attr)
{
- __set_bit((page->index<<2) + attr, bitmap->filemap_attr);
+ __set_bit((pnum<<2) + attr, bitmap->filemap_attr);
}
-static inline void clear_page_attr(struct bitmap *bitmap, struct page *page,
- enum bitmap_page_attr attr)
+static inline void clear_page_attr(struct bitmap *bitmap, int pnum,
+ enum bitmap_page_attr attr)
{
- __clear_bit((page->index<<2) + attr, bitmap->filemap_attr);
+ __clear_bit((pnum<<2) + attr, bitmap->filemap_attr);
}
-static inline unsigned long test_page_attr(struct bitmap *bitmap, struct page *page,
+static inline unsigned long test_page_attr(struct bitmap *bitmap, int pnum,
enum bitmap_page_attr attr)
{
- return test_bit((page->index<<2) + attr, bitmap->filemap_attr);
+ return test_bit((pnum<<2) + attr, bitmap->filemap_attr);
}
/*
kunmap_atomic(kaddr);
pr_debug("set file bit %lu page %lu\n", bit, page->index);
/* 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->index, BITMAP_PAGE_DIRTY);
}
static void bitmap_file_clear_bit(struct bitmap *bitmap, sector_t block)
else
__clear_bit_le(bit, paddr);
kunmap_atomic(paddr);
- if (!test_page_attr(bitmap, page, BITMAP_PAGE_NEEDWRITE)) {
- set_page_attr(bitmap, page, BITMAP_PAGE_PENDING);
+ if (!test_page_attr(bitmap, page->index, BITMAP_PAGE_NEEDWRITE)) {
+ set_page_attr(bitmap, page->index, BITMAP_PAGE_PENDING);
bitmap->allclean = 0;
}
}
{
unsigned long i, flags;
int dirty, need_write;
- struct page *page;
int wait = 0;
if (!bitmap || !bitmap->filemap)
spin_unlock_irqrestore(&bitmap->lock, flags);
return;
}
- page = bitmap->filemap[i];
- dirty = test_page_attr(bitmap, page, BITMAP_PAGE_DIRTY);
- need_write = test_page_attr(bitmap, page, BITMAP_PAGE_NEEDWRITE);
- clear_page_attr(bitmap, page, BITMAP_PAGE_DIRTY);
- clear_page_attr(bitmap, page, BITMAP_PAGE_NEEDWRITE);
+ dirty = test_page_attr(bitmap, i, BITMAP_PAGE_DIRTY);
+ need_write = test_page_attr(bitmap, i, BITMAP_PAGE_NEEDWRITE);
+ clear_page_attr(bitmap, i, BITMAP_PAGE_DIRTY);
+ clear_page_attr(bitmap, i, BITMAP_PAGE_NEEDWRITE);
if (dirty || need_write)
- clear_page_attr(bitmap, page, BITMAP_PAGE_PENDING);
+ clear_page_attr(bitmap, i, BITMAP_PAGE_PENDING);
if (dirty)
wait = 1;
spin_unlock_irqrestore(&bitmap->lock, flags);
if (dirty || need_write)
- write_page(bitmap, page, 0);
+ write_page(bitmap, bitmap->filemap[i], 0);
}
if (wait) { /* if any writes were performed, we need to wait on them */
if (bitmap->file)
spin_lock_irq(&bitmap->lock);
for (i = 0; i < bitmap->file_pages; i++)
- set_page_attr(bitmap, bitmap->filemap[i],
+ set_page_attr(bitmap, i,
BITMAP_PAGE_NEEDWRITE);
bitmap->allclean = 0;
spin_unlock_irq(&bitmap->lock);
*/
spin_lock_irqsave(&bitmap->lock, flags);
for (j = 0; j < bitmap->file_pages; j++)
- if (test_page_attr(bitmap, bitmap->filemap[j],
+ if (test_page_attr(bitmap, j,
BITMAP_PAGE_PENDING)) {
- set_page_attr(bitmap, bitmap->filemap[j],
+ set_page_attr(bitmap, j,
BITMAP_PAGE_NEEDWRITE);
- clear_page_attr(bitmap, bitmap->filemap[j],
+ clear_page_attr(bitmap, j,
BITMAP_PAGE_PENDING);
}
sb->events_cleared =
cpu_to_le64(bitmap->events_cleared);
kunmap_atomic(sb);
- set_page_attr(bitmap, bitmap->sb_page,
+ set_page_attr(bitmap, 0,
BITMAP_PAGE_NEEDWRITE);
}
}
* We mustn't write any other blocks before the superblock.
*/
for (j = 0; j < bitmap->file_pages; j++) {
- struct page *page = bitmap->filemap[j];
- if (test_page_attr(bitmap, page,
+ if (test_page_attr(bitmap, j,
BITMAP_PAGE_DIRTY))
/* bitmap_unplug will handle the rest */
break;
- if (test_page_attr(bitmap, page,
+ if (test_page_attr(bitmap, j,
BITMAP_PAGE_NEEDWRITE)) {
- clear_page_attr(bitmap, page,
+ clear_page_attr(bitmap, j,
BITMAP_PAGE_NEEDWRITE);
spin_unlock_irqrestore(&bitmap->lock, flags);
- write_page(bitmap, page, 0);
+ write_page(bitmap, bitmap->filemap[j], 0);
spin_lock_irqsave(&bitmap->lock, flags);
if (!bitmap->filemap)
break;