|
@@ -838,7 +838,7 @@ static void bitmap_file_set_bit(struct bitmap *bitmap, sector_t block)
|
|
unsigned long bit;
|
|
unsigned long bit;
|
|
struct page *page;
|
|
struct page *page;
|
|
void *kaddr;
|
|
void *kaddr;
|
|
- unsigned long chunk = block >> CHUNK_BLOCK_SHIFT(bitmap);
|
|
|
|
|
|
+ unsigned long chunk = block >> bitmap->chunkshift;
|
|
|
|
|
|
if (!bitmap->filemap)
|
|
if (!bitmap->filemap)
|
|
return;
|
|
return;
|
|
@@ -1037,10 +1037,10 @@ static int bitmap_init_from_disk(struct bitmap *bitmap, sector_t start)
|
|
kunmap_atomic(paddr, KM_USER0);
|
|
kunmap_atomic(paddr, KM_USER0);
|
|
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) << bitmap->chunkshift
|
|
>= start);
|
|
>= start);
|
|
bitmap_set_memory_bits(bitmap,
|
|
bitmap_set_memory_bits(bitmap,
|
|
- (sector_t)i << CHUNK_BLOCK_SHIFT(bitmap),
|
|
|
|
|
|
+ (sector_t)i << bitmap->chunkshift,
|
|
needed);
|
|
needed);
|
|
bit_cnt++;
|
|
bit_cnt++;
|
|
}
|
|
}
|
|
@@ -1084,7 +1084,7 @@ void bitmap_write_all(struct bitmap *bitmap)
|
|
|
|
|
|
static void bitmap_count_page(struct bitmap *bitmap, sector_t offset, int inc)
|
|
static void bitmap_count_page(struct bitmap *bitmap, sector_t offset, int inc)
|
|
{
|
|
{
|
|
- sector_t chunk = offset >> CHUNK_BLOCK_SHIFT(bitmap);
|
|
|
|
|
|
+ sector_t chunk = offset >> bitmap->chunkshift;
|
|
unsigned long page = chunk >> PAGE_COUNTER_SHIFT;
|
|
unsigned long page = chunk >> PAGE_COUNTER_SHIFT;
|
|
bitmap->bp[page].count += inc;
|
|
bitmap->bp[page].count += inc;
|
|
bitmap_checkfree(bitmap, page);
|
|
bitmap_checkfree(bitmap, page);
|
|
@@ -1190,7 +1190,7 @@ void bitmap_daemon_work(struct mddev *mddev)
|
|
bitmap->allclean = 0;
|
|
bitmap->allclean = 0;
|
|
}
|
|
}
|
|
bmc = bitmap_get_counter(bitmap,
|
|
bmc = bitmap_get_counter(bitmap,
|
|
- (sector_t)j << CHUNK_BLOCK_SHIFT(bitmap),
|
|
|
|
|
|
+ (sector_t)j << bitmap->chunkshift,
|
|
&blocks, 0);
|
|
&blocks, 0);
|
|
if (!bmc)
|
|
if (!bmc)
|
|
j |= PAGE_COUNTER_MASK;
|
|
j |= PAGE_COUNTER_MASK;
|
|
@@ -1199,7 +1199,7 @@ void bitmap_daemon_work(struct mddev *mddev)
|
|
/* we can clear the bit */
|
|
/* we can clear the bit */
|
|
*bmc = 0;
|
|
*bmc = 0;
|
|
bitmap_count_page(bitmap,
|
|
bitmap_count_page(bitmap,
|
|
- (sector_t)j << CHUNK_BLOCK_SHIFT(bitmap),
|
|
|
|
|
|
+ (sector_t)j << bitmap->chunkshift,
|
|
-1);
|
|
-1);
|
|
|
|
|
|
/* clear the bit */
|
|
/* clear the bit */
|
|
@@ -1253,7 +1253,7 @@ __acquires(bitmap->lock)
|
|
* The lock must have been taken with interrupts enabled.
|
|
* The lock must have been taken with interrupts enabled.
|
|
* If !create, we don't release the lock.
|
|
* If !create, we don't release the lock.
|
|
*/
|
|
*/
|
|
- sector_t chunk = offset >> CHUNK_BLOCK_SHIFT(bitmap);
|
|
|
|
|
|
+ sector_t chunk = offset >> bitmap->chunkshift;
|
|
unsigned long page = chunk >> PAGE_COUNTER_SHIFT;
|
|
unsigned long page = chunk >> PAGE_COUNTER_SHIFT;
|
|
unsigned long pageoff = (chunk & PAGE_COUNTER_MASK) << COUNTER_BYTE_SHIFT;
|
|
unsigned long pageoff = (chunk & PAGE_COUNTER_MASK) << COUNTER_BYTE_SHIFT;
|
|
sector_t csize;
|
|
sector_t csize;
|
|
@@ -1263,10 +1263,10 @@ __acquires(bitmap->lock)
|
|
|
|
|
|
if (bitmap->bp[page].hijacked ||
|
|
if (bitmap->bp[page].hijacked ||
|
|
bitmap->bp[page].map == NULL)
|
|
bitmap->bp[page].map == NULL)
|
|
- csize = ((sector_t)1) << (CHUNK_BLOCK_SHIFT(bitmap) +
|
|
|
|
|
|
+ csize = ((sector_t)1) << (bitmap->chunkshift +
|
|
PAGE_COUNTER_SHIFT - 1);
|
|
PAGE_COUNTER_SHIFT - 1);
|
|
else
|
|
else
|
|
- csize = ((sector_t)1) << (CHUNK_BLOCK_SHIFT(bitmap));
|
|
|
|
|
|
+ csize = ((sector_t)1) << bitmap->chunkshift;
|
|
*blocks = csize - (offset & (csize - 1));
|
|
*blocks = csize - (offset & (csize - 1));
|
|
|
|
|
|
if (err < 0)
|
|
if (err < 0)
|
|
@@ -1392,7 +1392,7 @@ void bitmap_endwrite(struct bitmap *bitmap, sector_t offset, unsigned long secto
|
|
set_page_attr(bitmap,
|
|
set_page_attr(bitmap,
|
|
filemap_get_page(
|
|
filemap_get_page(
|
|
bitmap,
|
|
bitmap,
|
|
- offset >> CHUNK_BLOCK_SHIFT(bitmap)),
|
|
|
|
|
|
+ offset >> bitmap->chunkshift),
|
|
BITMAP_PAGE_PENDING);
|
|
BITMAP_PAGE_PENDING);
|
|
bitmap->allclean = 0;
|
|
bitmap->allclean = 0;
|
|
}
|
|
}
|
|
@@ -1480,7 +1480,7 @@ void bitmap_end_sync(struct bitmap *bitmap, sector_t offset, sector_t *blocks, i
|
|
else {
|
|
else {
|
|
if (*bmc <= 2) {
|
|
if (*bmc <= 2) {
|
|
set_page_attr(bitmap,
|
|
set_page_attr(bitmap,
|
|
- filemap_get_page(bitmap, offset >> CHUNK_BLOCK_SHIFT(bitmap)),
|
|
|
|
|
|
+ filemap_get_page(bitmap, offset >> bitmap->chunkshift),
|
|
BITMAP_PAGE_PENDING);
|
|
BITMAP_PAGE_PENDING);
|
|
bitmap->allclean = 0;
|
|
bitmap->allclean = 0;
|
|
}
|
|
}
|
|
@@ -1527,7 +1527,7 @@ void bitmap_cond_end_sync(struct bitmap *bitmap, sector_t sector)
|
|
|
|
|
|
bitmap->mddev->curr_resync_completed = sector;
|
|
bitmap->mddev->curr_resync_completed = sector;
|
|
set_bit(MD_CHANGE_CLEAN, &bitmap->mddev->flags);
|
|
set_bit(MD_CHANGE_CLEAN, &bitmap->mddev->flags);
|
|
- sector &= ~((1ULL << CHUNK_BLOCK_SHIFT(bitmap)) - 1);
|
|
|
|
|
|
+ sector &= ~((1ULL << bitmap->chunkshift) - 1);
|
|
s = 0;
|
|
s = 0;
|
|
while (s < sector && s < bitmap->mddev->resync_max_sectors) {
|
|
while (s < sector && s < bitmap->mddev->resync_max_sectors) {
|
|
bitmap_end_sync(bitmap, s, &blocks, 0);
|
|
bitmap_end_sync(bitmap, s, &blocks, 0);
|
|
@@ -1557,7 +1557,7 @@ static void bitmap_set_memory_bits(struct bitmap *bitmap, sector_t offset, int n
|
|
struct page *page;
|
|
struct page *page;
|
|
*bmc = 2 | (needed ? NEEDED_MASK : 0);
|
|
*bmc = 2 | (needed ? NEEDED_MASK : 0);
|
|
bitmap_count_page(bitmap, offset, 1);
|
|
bitmap_count_page(bitmap, offset, 1);
|
|
- page = filemap_get_page(bitmap, offset >> CHUNK_BLOCK_SHIFT(bitmap));
|
|
|
|
|
|
+ page = filemap_get_page(bitmap, offset >> bitmap->chunkshift);
|
|
set_page_attr(bitmap, page, BITMAP_PAGE_PENDING);
|
|
set_page_attr(bitmap, page, BITMAP_PAGE_PENDING);
|
|
bitmap->allclean = 0;
|
|
bitmap->allclean = 0;
|
|
}
|
|
}
|
|
@@ -1570,7 +1570,7 @@ void bitmap_dirty_bits(struct bitmap *bitmap, unsigned long s, unsigned long e)
|
|
unsigned long chunk;
|
|
unsigned long chunk;
|
|
|
|
|
|
for (chunk = s; chunk <= e; chunk++) {
|
|
for (chunk = s; chunk <= e; chunk++) {
|
|
- sector_t sec = (sector_t)chunk << CHUNK_BLOCK_SHIFT(bitmap);
|
|
|
|
|
|
+ sector_t sec = (sector_t)chunk << bitmap->chunkshift;
|
|
bitmap_set_memory_bits(bitmap, sec, 1);
|
|
bitmap_set_memory_bits(bitmap, sec, 1);
|
|
spin_lock_irq(&bitmap->lock);
|
|
spin_lock_irq(&bitmap->lock);
|
|
bitmap_file_set_bit(bitmap, sec);
|
|
bitmap_file_set_bit(bitmap, sec);
|
|
@@ -1727,11 +1727,12 @@ int bitmap_create(struct mddev *mddev)
|
|
goto error;
|
|
goto error;
|
|
|
|
|
|
bitmap->daemon_lastrun = jiffies;
|
|
bitmap->daemon_lastrun = jiffies;
|
|
- bitmap->chunkshift = ffz(~mddev->bitmap_info.chunksize);
|
|
|
|
|
|
+ bitmap->chunkshift = (ffz(~mddev->bitmap_info.chunksize)
|
|
|
|
+ - BITMAP_BLOCK_SHIFT);
|
|
|
|
|
|
/* now that chunksize and chunkshift are set, we can use these macros */
|
|
/* now that chunksize and chunkshift are set, we can use these macros */
|
|
- chunks = (blocks + CHUNK_BLOCK_RATIO(bitmap) - 1) >>
|
|
|
|
- CHUNK_BLOCK_SHIFT(bitmap);
|
|
|
|
|
|
+ chunks = (blocks + bitmap->chunkshift - 1) >>
|
|
|
|
+ bitmap->chunkshift;
|
|
pages = (chunks + PAGE_COUNTER_RATIO - 1) / PAGE_COUNTER_RATIO;
|
|
pages = (chunks + PAGE_COUNTER_RATIO - 1) / PAGE_COUNTER_RATIO;
|
|
|
|
|
|
BUG_ON(!pages);
|
|
BUG_ON(!pages);
|