aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNeilBrown <neilb@suse.de>2009-01-08 16:31:05 -0500
committerNeilBrown <neilb@suse.de>2009-01-08 16:31:05 -0500
commit0c3573f19d135d718264e38c46597295bd6154b7 (patch)
tree0943035f89d163d9d7b354445303fb03e5ea7fb1
parent538452700d95480c16e7aa6b10ff77cd937d33f4 (diff)
md: use sysfs_notify_dirent to notify changes to md/sync_action.
There is no compelling need for this, but sysfs_notify_dirent is a nicer interface and the change is good for consistency. Signed-off-by: NeilBrown <neilb@suse.de>
-rw-r--r--drivers/md/md.c20
-rw-r--r--include/linux/raid/md_k.h1
2 files changed, 14 insertions, 7 deletions
diff --git a/drivers/md/md.c b/drivers/md/md.c
index 1b1d32694f6f..ee759b193e9a 100644
--- a/drivers/md/md.c
+++ b/drivers/md/md.c
@@ -3046,7 +3046,7 @@ action_store(mddev_t *mddev, const char *page, size_t len)
3046 } 3046 }
3047 set_bit(MD_RECOVERY_NEEDED, &mddev->recovery); 3047 set_bit(MD_RECOVERY_NEEDED, &mddev->recovery);
3048 md_wakeup_thread(mddev->thread); 3048 md_wakeup_thread(mddev->thread);
3049 sysfs_notify(&mddev->kobj, NULL, "sync_action"); 3049 sysfs_notify_dirent(mddev->sysfs_action);
3050 return len; 3050 return len;
3051} 3051}
3052 3052
@@ -3684,6 +3684,7 @@ static int do_md_run(mddev_t * mddev)
3684 printk(KERN_WARNING 3684 printk(KERN_WARNING
3685 "md: cannot register extra attributes for %s\n", 3685 "md: cannot register extra attributes for %s\n",
3686 mdname(mddev)); 3686 mdname(mddev));
3687 mddev->sysfs_action = sysfs_get_dirent(mddev->kobj.sd, "sync_action");
3687 } else if (mddev->ro == 2) /* auto-readonly not meaningful */ 3688 } else if (mddev->ro == 2) /* auto-readonly not meaningful */
3688 mddev->ro = 0; 3689 mddev->ro = 0;
3689 3690
@@ -3754,7 +3755,8 @@ static int do_md_run(mddev_t * mddev)
3754 mddev->changed = 1; 3755 mddev->changed = 1;
3755 md_new_event(mddev); 3756 md_new_event(mddev);
3756 sysfs_notify_dirent(mddev->sysfs_state); 3757 sysfs_notify_dirent(mddev->sysfs_state);
3757 sysfs_notify(&mddev->kobj, NULL, "sync_action"); 3758 if (mddev->sysfs_action)
3759 sysfs_notify_dirent(mddev->sysfs_action);
3758 sysfs_notify(&mddev->kobj, NULL, "degraded"); 3760 sysfs_notify(&mddev->kobj, NULL, "degraded");
3759 kobject_uevent(&disk_to_dev(mddev->gendisk)->kobj, KOBJ_CHANGE); 3761 kobject_uevent(&disk_to_dev(mddev->gendisk)->kobj, KOBJ_CHANGE);
3760 return 0; 3762 return 0;
@@ -3854,9 +3856,12 @@ static int do_md_stop(mddev_t * mddev, int mode, int is_open)
3854 mddev->queue->merge_bvec_fn = NULL; 3856 mddev->queue->merge_bvec_fn = NULL;
3855 mddev->queue->unplug_fn = NULL; 3857 mddev->queue->unplug_fn = NULL;
3856 mddev->queue->backing_dev_info.congested_fn = NULL; 3858 mddev->queue->backing_dev_info.congested_fn = NULL;
3857 if (mddev->pers->sync_request) 3859 if (mddev->pers->sync_request) {
3858 sysfs_remove_group(&mddev->kobj, &md_redundancy_group); 3860 sysfs_remove_group(&mddev->kobj, &md_redundancy_group);
3859 3861 if (mddev->sysfs_action)
3862 sysfs_put(mddev->sysfs_action);
3863 mddev->sysfs_action = NULL;
3864 }
3860 module_put(mddev->pers->owner); 3865 module_put(mddev->pers->owner);
3861 mddev->pers = NULL; 3866 mddev->pers = NULL;
3862 /* tell userspace to handle 'inactive' */ 3867 /* tell userspace to handle 'inactive' */
@@ -6155,7 +6160,7 @@ void md_check_recovery(mddev_t *mddev)
6155 mddev->recovery = 0; 6160 mddev->recovery = 0;
6156 /* flag recovery needed just to double check */ 6161 /* flag recovery needed just to double check */
6157 set_bit(MD_RECOVERY_NEEDED, &mddev->recovery); 6162 set_bit(MD_RECOVERY_NEEDED, &mddev->recovery);
6158 sysfs_notify(&mddev->kobj, NULL, "sync_action"); 6163 sysfs_notify_dirent(mddev->sysfs_action);
6159 md_new_event(mddev); 6164 md_new_event(mddev);
6160 goto unlock; 6165 goto unlock;
6161 } 6166 }
@@ -6216,7 +6221,7 @@ void md_check_recovery(mddev_t *mddev)
6216 mddev->recovery = 0; 6221 mddev->recovery = 0;
6217 } else 6222 } else
6218 md_wakeup_thread(mddev->sync_thread); 6223 md_wakeup_thread(mddev->sync_thread);
6219 sysfs_notify(&mddev->kobj, NULL, "sync_action"); 6224 sysfs_notify_dirent(mddev->sysfs_action);
6220 md_new_event(mddev); 6225 md_new_event(mddev);
6221 } 6226 }
6222 unlock: 6227 unlock:
@@ -6224,7 +6229,8 @@ void md_check_recovery(mddev_t *mddev)
6224 clear_bit(MD_RECOVERY_RUNNING, &mddev->recovery); 6229 clear_bit(MD_RECOVERY_RUNNING, &mddev->recovery);
6225 if (test_and_clear_bit(MD_RECOVERY_RECOVER, 6230 if (test_and_clear_bit(MD_RECOVERY_RECOVER,
6226 &mddev->recovery)) 6231 &mddev->recovery))
6227 sysfs_notify(&mddev->kobj, NULL, "sync_action"); 6232 if (mddev->sysfs_action)
6233 sysfs_notify_dirent(mddev->sysfs_action);
6228 } 6234 }
6229 mddev_unlock(mddev); 6235 mddev_unlock(mddev);
6230 } 6236 }
diff --git a/include/linux/raid/md_k.h b/include/linux/raid/md_k.h
index 8fc909ef6787..663803eaf0de 100644
--- a/include/linux/raid/md_k.h
+++ b/include/linux/raid/md_k.h
@@ -244,6 +244,7 @@ struct mddev_s
244 struct sysfs_dirent *sysfs_state; /* handle for 'array_state' 244 struct sysfs_dirent *sysfs_state; /* handle for 'array_state'
245 * file in sysfs. 245 * file in sysfs.
246 */ 246 */
247 struct sysfs_dirent *sysfs_action; /* handle for 'sync_action' */
247 248
248 spinlock_t write_lock; 249 spinlock_t write_lock;
249 wait_queue_head_t sb_wait; /* for waiting on superblock updates */ 250 wait_queue_head_t sb_wait; /* for waiting on superblock updates */