Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 30369
b: refs/heads/master
c: e16b68b
h: refs/heads/master
i:
  30367: d5aaf83
v: v3
  • Loading branch information
NeilBrown authored and Linus Torvalds committed Jun 26, 2006
1 parent 3d4a939 commit 59067e2
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 8 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: ec7a3197f4777eff5039251d0e08a031b3372d6c
refs/heads/master: e16b68b6e456a61b895a198baf5aa473cf2a32bf
19 changes: 12 additions & 7 deletions trunk/drivers/md/bitmap.c
Original file line number Diff line number Diff line change
Expand Up @@ -700,27 +700,27 @@ static void bitmap_file_kick(struct bitmap *bitmap)
}

enum bitmap_page_attr {
BITMAP_PAGE_DIRTY = 1, // there are set bits that need to be synced
BITMAP_PAGE_CLEAN = 2, // there are bits that might need to be cleared
BITMAP_PAGE_NEEDWRITE=4, // there are cleared bits that need to be synced
BITMAP_PAGE_DIRTY = 0, // there are set bits that need to be synced
BITMAP_PAGE_CLEAN = 1, // there are bits that might need to be cleared
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)
{
bitmap->filemap_attr[page->index] |= attr;
__set_bit((page->index<<2) + attr, bitmap->filemap_attr);
}

static inline void clear_page_attr(struct bitmap *bitmap, struct page *page,
enum bitmap_page_attr attr)
{
bitmap->filemap_attr[page->index] &= ~attr;
__clear_bit((page->index<<2) + attr, bitmap->filemap_attr);
}

static inline unsigned long test_page_attr(struct bitmap *bitmap, struct page *page,
enum bitmap_page_attr attr)
{
return bitmap->filemap_attr[page->index] & attr;
return test_bit((page->index<<2) + attr, bitmap->filemap_attr);
}

/*
Expand Down Expand Up @@ -872,7 +872,12 @@ static int bitmap_init_from_disk(struct bitmap *bitmap, sector_t start)
if (!bitmap->filemap)
goto out;

bitmap->filemap_attr = kzalloc(sizeof(long) * num_pages, GFP_KERNEL);
/* We need 4 bits per page, rounded up to a multiple of sizeof(unsigned long) */
bitmap->filemap_attr = kzalloc(
(((num_pages*4/8)+sizeof(unsigned long)-1)
/sizeof(unsigned long))
*sizeof(unsigned long),
GFP_KERNEL);
if (!bitmap->filemap_attr)
goto out;

Expand Down

0 comments on commit 59067e2

Please sign in to comment.