raid5.c (b3143b9a38d5039bcd1f2d1c94039651bfba8043) raid5.c (b03e0ccb5ab9df3efbe51c87843a1ffbecbafa1f)
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

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

8003 mddev->layout = conf->algorithm;
8004 mddev->chunk_sectors = conf->chunk_sectors;
8005 mddev->reshape_position = MaxSector;
8006 mddev->delta_disks = 0;
8007 mddev->reshape_backwards = 0;
8008 }
8009}
8010
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

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

8003 mddev->layout = conf->algorithm;
8004 mddev->chunk_sectors = conf->chunk_sectors;
8005 mddev->reshape_position = MaxSector;
8006 mddev->delta_disks = 0;
8007 mddev->reshape_backwards = 0;
8008 }
8009}
8010
8011static void raid5_quiesce(struct mddev *mddev, int state)
8011static void raid5_quiesce(struct mddev *mddev, int quiesce)
8012{
8013 struct r5conf *conf = mddev->private;
8014
8012{
8013 struct r5conf *conf = mddev->private;
8014
8015 switch(state) {
8016 case 2: /* resume for a suspend */
8017 wake_up(&conf->wait_for_overlap);
8018 break;
8019
8020 case 1: /* stop all writes */
8015 if (quiesce) {
8016 /* stop all writes */
8021 lock_all_device_hash_locks_irq(conf);
8022 /* '2' tells resync/reshape to pause so that all
8023 * active stripes can drain
8024 */
8025 r5c_flush_cache(conf, INT_MAX);
8026 conf->quiesce = 2;
8027 wait_event_cmd(conf->wait_for_quiescent,
8028 atomic_read(&conf->active_stripes) == 0 &&
8029 atomic_read(&conf->active_aligned_reads) == 0,
8030 unlock_all_device_hash_locks_irq(conf),
8031 lock_all_device_hash_locks_irq(conf));
8032 conf->quiesce = 1;
8033 unlock_all_device_hash_locks_irq(conf);
8034 /* allow reshape to continue */
8035 wake_up(&conf->wait_for_overlap);
8017 lock_all_device_hash_locks_irq(conf);
8018 /* '2' tells resync/reshape to pause so that all
8019 * active stripes can drain
8020 */
8021 r5c_flush_cache(conf, INT_MAX);
8022 conf->quiesce = 2;
8023 wait_event_cmd(conf->wait_for_quiescent,
8024 atomic_read(&conf->active_stripes) == 0 &&
8025 atomic_read(&conf->active_aligned_reads) == 0,
8026 unlock_all_device_hash_locks_irq(conf),
8027 lock_all_device_hash_locks_irq(conf));
8028 conf->quiesce = 1;
8029 unlock_all_device_hash_locks_irq(conf);
8030 /* allow reshape to continue */
8031 wake_up(&conf->wait_for_overlap);
8036 break;
8037
8038 case 0: /* re-enable writes */
8032 } else {
8033 /* re-enable writes */
8039 lock_all_device_hash_locks_irq(conf);
8040 conf->quiesce = 0;
8041 wake_up(&conf->wait_for_quiescent);
8042 wake_up(&conf->wait_for_overlap);
8043 unlock_all_device_hash_locks_irq(conf);
8034 lock_all_device_hash_locks_irq(conf);
8035 conf->quiesce = 0;
8036 wake_up(&conf->wait_for_quiescent);
8037 wake_up(&conf->wait_for_overlap);
8038 unlock_all_device_hash_locks_irq(conf);
8044 break;
8045 }
8039 }
8046 r5l_quiesce(conf->log, state);
8040 r5l_quiesce(conf->log, quiesce);
8047}
8048
8049static void *raid45_takeover_raid0(struct mddev *mddev, int level)
8050{
8051 struct r0conf *raid0_conf = mddev->private;
8052 sector_t sectors;
8053
8054 /* for raid0 takeover only one zone is supported */

--- 417 unchanged lines hidden ---
8041}
8042
8043static void *raid45_takeover_raid0(struct mddev *mddev, int level)
8044{
8045 struct r0conf *raid0_conf = mddev->private;
8046 sector_t sectors;
8047
8048 /* for raid0 takeover only one zone is supported */

--- 417 unchanged lines hidden ---