mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-13 23:34:05 +08:00
Merge branch 'for-linus' of git://neil.brown.name/md
* 'for-linus' of git://neil.brown.name/md: md: don't use locked_ioctl. md: don't update curr_resync_completed without also updating reshape_position. md: raid5: avoid sector values going negative when testing reshape progress. md: export 'frozen' resync state through sysfs md: bitmap: improve bitmap maintenance code. md: improve errno return when setting array_size md: always update level / chunk_size / layout when writing v1.x metadata.
This commit is contained in:
commit
e25e0920b5
@ -1097,14 +1097,12 @@ void bitmap_daemon_work(struct bitmap *bitmap)
|
||||
}
|
||||
bitmap->allclean = 1;
|
||||
|
||||
spin_lock_irqsave(&bitmap->lock, flags);
|
||||
for (j = 0; j < bitmap->chunks; j++) {
|
||||
bitmap_counter_t *bmc;
|
||||
spin_lock_irqsave(&bitmap->lock, flags);
|
||||
if (!bitmap->filemap) {
|
||||
if (!bitmap->filemap)
|
||||
/* error or shutdown */
|
||||
spin_unlock_irqrestore(&bitmap->lock, flags);
|
||||
break;
|
||||
}
|
||||
|
||||
page = filemap_get_page(bitmap, j);
|
||||
|
||||
@ -1121,6 +1119,8 @@ void bitmap_daemon_work(struct bitmap *bitmap)
|
||||
write_page(bitmap, page, 0);
|
||||
bitmap->allclean = 0;
|
||||
}
|
||||
spin_lock_irqsave(&bitmap->lock, flags);
|
||||
j |= (PAGE_BITS - 1);
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -1181,9 +1181,10 @@ void bitmap_daemon_work(struct bitmap *bitmap)
|
||||
ext2_clear_bit(file_page_offset(j), paddr);
|
||||
kunmap_atomic(paddr, KM_USER0);
|
||||
}
|
||||
}
|
||||
spin_unlock_irqrestore(&bitmap->lock, flags);
|
||||
} else
|
||||
j |= PAGE_COUNTER_MASK;
|
||||
}
|
||||
spin_unlock_irqrestore(&bitmap->lock, flags);
|
||||
|
||||
/* now sync the final page */
|
||||
if (lastpage != NULL) {
|
||||
|
@ -1375,6 +1375,9 @@ static void super_1_sync(mddev_t *mddev, mdk_rdev_t *rdev)
|
||||
|
||||
sb->raid_disks = cpu_to_le32(mddev->raid_disks);
|
||||
sb->size = cpu_to_le64(mddev->dev_sectors);
|
||||
sb->chunksize = cpu_to_le32(mddev->chunk_size >> 9);
|
||||
sb->level = cpu_to_le32(mddev->level);
|
||||
sb->layout = cpu_to_le32(mddev->layout);
|
||||
|
||||
if (mddev->bitmap && mddev->bitmap_file == NULL) {
|
||||
sb->bitmap_offset = cpu_to_le32((__u32)mddev->bitmap_offset);
|
||||
@ -3303,7 +3306,9 @@ static ssize_t
|
||||
action_show(mddev_t *mddev, char *page)
|
||||
{
|
||||
char *type = "idle";
|
||||
if (test_bit(MD_RECOVERY_RUNNING, &mddev->recovery) ||
|
||||
if (test_bit(MD_RECOVERY_FROZEN, &mddev->recovery))
|
||||
type = "frozen";
|
||||
else if (test_bit(MD_RECOVERY_RUNNING, &mddev->recovery) ||
|
||||
(!mddev->ro && test_bit(MD_RECOVERY_NEEDED, &mddev->recovery))) {
|
||||
if (test_bit(MD_RECOVERY_RESHAPE, &mddev->recovery))
|
||||
type = "reshape";
|
||||
@ -3326,7 +3331,12 @@ action_store(mddev_t *mddev, const char *page, size_t len)
|
||||
if (!mddev->pers || !mddev->pers->sync_request)
|
||||
return -EINVAL;
|
||||
|
||||
if (cmd_match(page, "idle")) {
|
||||
if (cmd_match(page, "frozen"))
|
||||
set_bit(MD_RECOVERY_FROZEN, &mddev->recovery);
|
||||
else
|
||||
clear_bit(MD_RECOVERY_FROZEN, &mddev->recovery);
|
||||
|
||||
if (cmd_match(page, "idle") || cmd_match(page, "frozen")) {
|
||||
if (mddev->sync_thread) {
|
||||
set_bit(MD_RECOVERY_INTR, &mddev->recovery);
|
||||
md_unregister_thread(mddev->sync_thread);
|
||||
@ -3680,7 +3690,7 @@ array_size_store(mddev_t *mddev, const char *buf, size_t len)
|
||||
if (strict_blocks_to_sectors(buf, §ors) < 0)
|
||||
return -EINVAL;
|
||||
if (mddev->pers && mddev->pers->size(mddev, 0, 0) < sectors)
|
||||
return -EINVAL;
|
||||
return -E2BIG;
|
||||
|
||||
mddev->external_size = 1;
|
||||
}
|
||||
@ -5557,7 +5567,7 @@ static struct block_device_operations md_fops =
|
||||
.owner = THIS_MODULE,
|
||||
.open = md_open,
|
||||
.release = md_release,
|
||||
.locked_ioctl = md_ioctl,
|
||||
.ioctl = md_ioctl,
|
||||
.getgeo = md_getgeo,
|
||||
.media_changed = md_media_changed,
|
||||
.revalidate_disk= md_revalidate,
|
||||
@ -6352,12 +6362,13 @@ void md_do_sync(mddev_t *mddev)
|
||||
|
||||
skipped = 0;
|
||||
|
||||
if ((mddev->curr_resync > mddev->curr_resync_completed &&
|
||||
(mddev->curr_resync - mddev->curr_resync_completed)
|
||||
> (max_sectors >> 4)) ||
|
||||
(j - mddev->curr_resync_completed)*2
|
||||
>= mddev->resync_max - mddev->curr_resync_completed
|
||||
) {
|
||||
if (!test_bit(MD_RECOVERY_RESHAPE, &mddev->recovery) &&
|
||||
((mddev->curr_resync > mddev->curr_resync_completed &&
|
||||
(mddev->curr_resync - mddev->curr_resync_completed)
|
||||
> (max_sectors >> 4)) ||
|
||||
(j - mddev->curr_resync_completed)*2
|
||||
>= mddev->resync_max - mddev->curr_resync_completed
|
||||
)) {
|
||||
/* time to update curr_resync_completed */
|
||||
blk_unplug(mddev->queue);
|
||||
wait_event(mddev->recovery_wait,
|
||||
|
@ -3811,13 +3811,13 @@ static sector_t reshape_request(mddev_t *mddev, sector_t sector_nr, int *skipped
|
||||
safepos = conf->reshape_safe;
|
||||
sector_div(safepos, data_disks);
|
||||
if (mddev->delta_disks < 0) {
|
||||
writepos -= reshape_sectors;
|
||||
writepos -= min(reshape_sectors, writepos);
|
||||
readpos += reshape_sectors;
|
||||
safepos += reshape_sectors;
|
||||
} else {
|
||||
writepos += reshape_sectors;
|
||||
readpos -= reshape_sectors;
|
||||
safepos -= reshape_sectors;
|
||||
readpos -= min(reshape_sectors, readpos);
|
||||
safepos -= min(reshape_sectors, safepos);
|
||||
}
|
||||
|
||||
/* 'writepos' is the most advanced device address we might write.
|
||||
|
Loading…
Reference in New Issue
Block a user