raid5.c (9d66a875ecc7d6dd414121e4508340d6c08f51b0) raid5.c (1532d9e87e8b2377f12929f9e40724d5fbe6ecc5)
1/*
2 * raid5.c : Multiple Devices driver for Linux
3 * Copyright (C) 1996, 1997 Ingo Molnar, Miguel de Icaza, Gadi Oxman
4 * Copyright (C) 1999, 2000 Ingo Molnar
5 * Copyright (C) 2002, 2003 H. Peter Anvin
6 *
7 * RAID-4/5/6 management functions.
8 * Thanks to Penguin Computing for making the RAID-6 development possible

--- 5549 unchanged lines hidden (view full) ---

5558 sector_t logical_sector, last_sector;
5559 struct stripe_head *sh;
5560 const int rw = bio_data_dir(bi);
5561 DEFINE_WAIT(w);
5562 bool do_prepare;
5563 bool do_flush = false;
5564
5565 if (unlikely(bi->bi_opf & REQ_PREFLUSH)) {
1/*
2 * raid5.c : Multiple Devices driver for Linux
3 * Copyright (C) 1996, 1997 Ingo Molnar, Miguel de Icaza, Gadi Oxman
4 * Copyright (C) 1999, 2000 Ingo Molnar
5 * Copyright (C) 2002, 2003 H. Peter Anvin
6 *
7 * RAID-4/5/6 management functions.
8 * Thanks to Penguin Computing for making the RAID-6 development possible

--- 5549 unchanged lines hidden (view full) ---

5558 sector_t logical_sector, last_sector;
5559 struct stripe_head *sh;
5560 const int rw = bio_data_dir(bi);
5561 DEFINE_WAIT(w);
5562 bool do_prepare;
5563 bool do_flush = false;
5564
5565 if (unlikely(bi->bi_opf & REQ_PREFLUSH)) {
5566 int ret = r5l_handle_flush_request(conf->log, bi);
5566 int ret = log_handle_flush_request(conf, bi);
5567
5568 if (ret == 0)
5569 return true;
5570 if (ret == -ENODEV) {
5571 md_flush_request(mddev, bi);
5572 return true;
5573 }
5574 /* ret == -EAGAIN, fallback */

--- 588 unchanged lines hidden (view full) ---

6163 batch[batch_size++] = sh;
6164
6165 if (batch_size == 0) {
6166 for (i = 0; i < NR_STRIPE_HASH_LOCKS; i++)
6167 if (!list_empty(temp_inactive_list + i))
6168 break;
6169 if (i == NR_STRIPE_HASH_LOCKS) {
6170 spin_unlock_irq(&conf->device_lock);
5567
5568 if (ret == 0)
5569 return true;
5570 if (ret == -ENODEV) {
5571 md_flush_request(mddev, bi);
5572 return true;
5573 }
5574 /* ret == -EAGAIN, fallback */

--- 588 unchanged lines hidden (view full) ---

6163 batch[batch_size++] = sh;
6164
6165 if (batch_size == 0) {
6166 for (i = 0; i < NR_STRIPE_HASH_LOCKS; i++)
6167 if (!list_empty(temp_inactive_list + i))
6168 break;
6169 if (i == NR_STRIPE_HASH_LOCKS) {
6170 spin_unlock_irq(&conf->device_lock);
6171 r5l_flush_stripe_to_raid(conf->log);
6171 log_flush_stripe_to_raid(conf);
6172 spin_lock_irq(&conf->device_lock);
6173 return batch_size;
6174 }
6175 release_inactive = true;
6176 }
6177 spin_unlock_irq(&conf->device_lock);
6178
6179 release_inactive_stripe_list(conf, temp_inactive_list,

--- 1875 unchanged lines hidden (view full) ---

8055 } else {
8056 /* re-enable writes */
8057 lock_all_device_hash_locks_irq(conf);
8058 conf->quiesce = 0;
8059 wake_up(&conf->wait_for_quiescent);
8060 wake_up(&conf->wait_for_overlap);
8061 unlock_all_device_hash_locks_irq(conf);
8062 }
6172 spin_lock_irq(&conf->device_lock);
6173 return batch_size;
6174 }
6175 release_inactive = true;
6176 }
6177 spin_unlock_irq(&conf->device_lock);
6178
6179 release_inactive_stripe_list(conf, temp_inactive_list,

--- 1875 unchanged lines hidden (view full) ---

8055 } else {
8056 /* re-enable writes */
8057 lock_all_device_hash_locks_irq(conf);
8058 conf->quiesce = 0;
8059 wake_up(&conf->wait_for_quiescent);
8060 wake_up(&conf->wait_for_overlap);
8061 unlock_all_device_hash_locks_irq(conf);
8062 }
8063 r5l_quiesce(conf->log, quiesce);
8063 log_quiesce(conf, quiesce);
8064}
8065
8066static void *raid45_takeover_raid0(struct mddev *mddev, int level)
8067{
8068 struct r0conf *raid0_conf = mddev->private;
8069 sector_t sectors;
8070
8071 /* for raid0 takeover only one zone is supported */

--- 287 unchanged lines hidden (view full) ---

8359 if (!err)
8360 md_update_sb(mddev, 1);
8361
8362 mddev_unlock(mddev);
8363
8364 return err;
8365}
8366
8064}
8065
8066static void *raid45_takeover_raid0(struct mddev *mddev, int level)
8067{
8068 struct r0conf *raid0_conf = mddev->private;
8069 sector_t sectors;
8070
8071 /* for raid0 takeover only one zone is supported */

--- 287 unchanged lines hidden (view full) ---

8359 if (!err)
8360 md_update_sb(mddev, 1);
8361
8362 mddev_unlock(mddev);
8363
8364 return err;
8365}
8366
8367static int raid5_start(struct mddev *mddev)
8368{
8369 struct r5conf *conf = mddev->private;
8370
8371 return r5l_start(conf->log);
8372}
8373
8367static struct md_personality raid6_personality =
8368{
8369 .name = "raid6",
8370 .level = 6,
8371 .owner = THIS_MODULE,
8372 .make_request = raid5_make_request,
8373 .run = raid5_run,
8374static struct md_personality raid6_personality =
8375{
8376 .name = "raid6",
8377 .level = 6,
8378 .owner = THIS_MODULE,
8379 .make_request = raid5_make_request,
8380 .run = raid5_run,
8381 .start = raid5_start,
8374 .free = raid5_free,
8375 .status = raid5_status,
8376 .error_handler = raid5_error,
8377 .hot_add_disk = raid5_add_disk,
8378 .hot_remove_disk= raid5_remove_disk,
8379 .spare_active = raid5_spare_active,
8380 .sync_request = raid5_sync_request,
8381 .resize = raid5_resize,

--- 8 unchanged lines hidden (view full) ---

8390};
8391static struct md_personality raid5_personality =
8392{
8393 .name = "raid5",
8394 .level = 5,
8395 .owner = THIS_MODULE,
8396 .make_request = raid5_make_request,
8397 .run = raid5_run,
8382 .free = raid5_free,
8383 .status = raid5_status,
8384 .error_handler = raid5_error,
8385 .hot_add_disk = raid5_add_disk,
8386 .hot_remove_disk= raid5_remove_disk,
8387 .spare_active = raid5_spare_active,
8388 .sync_request = raid5_sync_request,
8389 .resize = raid5_resize,

--- 8 unchanged lines hidden (view full) ---

8398};
8399static struct md_personality raid5_personality =
8400{
8401 .name = "raid5",
8402 .level = 5,
8403 .owner = THIS_MODULE,
8404 .make_request = raid5_make_request,
8405 .run = raid5_run,
8406 .start = raid5_start,
8398 .free = raid5_free,
8399 .status = raid5_status,
8400 .error_handler = raid5_error,
8401 .hot_add_disk = raid5_add_disk,
8402 .hot_remove_disk= raid5_remove_disk,
8403 .spare_active = raid5_spare_active,
8404 .sync_request = raid5_sync_request,
8405 .resize = raid5_resize,

--- 9 unchanged lines hidden (view full) ---

8415
8416static struct md_personality raid4_personality =
8417{
8418 .name = "raid4",
8419 .level = 4,
8420 .owner = THIS_MODULE,
8421 .make_request = raid5_make_request,
8422 .run = raid5_run,
8407 .free = raid5_free,
8408 .status = raid5_status,
8409 .error_handler = raid5_error,
8410 .hot_add_disk = raid5_add_disk,
8411 .hot_remove_disk= raid5_remove_disk,
8412 .spare_active = raid5_spare_active,
8413 .sync_request = raid5_sync_request,
8414 .resize = raid5_resize,

--- 9 unchanged lines hidden (view full) ---

8424
8425static struct md_personality raid4_personality =
8426{
8427 .name = "raid4",
8428 .level = 4,
8429 .owner = THIS_MODULE,
8430 .make_request = raid5_make_request,
8431 .run = raid5_run,
8432 .start = raid5_start,
8423 .free = raid5_free,
8424 .status = raid5_status,
8425 .error_handler = raid5_error,
8426 .hot_add_disk = raid5_add_disk,
8427 .hot_remove_disk= raid5_remove_disk,
8428 .spare_active = raid5_spare_active,
8429 .sync_request = raid5_sync_request,
8430 .resize = raid5_resize,

--- 58 unchanged lines hidden ---
8433 .free = raid5_free,
8434 .status = raid5_status,
8435 .error_handler = raid5_error,
8436 .hot_add_disk = raid5_add_disk,
8437 .hot_remove_disk= raid5_remove_disk,
8438 .spare_active = raid5_spare_active,
8439 .sync_request = raid5_sync_request,
8440 .resize = raid5_resize,

--- 58 unchanged lines hidden ---