simple md.c cleanups
cover simple md.c cleanups
Hi
here are eight simple cleanup patches to md.c against linus-current.git. Please review.
Andre
Signature · 1 line
The only person who always got his work done by Friday was Robinson Crusoe
PATCH 1/8 md_ioctl(): Fix misleading indentation.
--- drivers/md/md.c | 8 +++----- 1 files changed, 3 insertions(+), 5 deletions(-)
drivers/md/md.c +3 -5
@@ -4807,13 +4807,11 @@ static int md_ioctl(struct inode *inode, struct file *file,* here and hit the 'default' below, so only disallow * 'md' ioctls, and switch to rw mode if started auto-readonly. */ -if (_IOC_TYPE (cmd) ==MD_MAJOR && - mddev->ro && mddev->pers) { +if (_IOC_TYPE (cmd) ==MD_MAJOR && mddev->ro && mddev->pers) {if (mddev->ro ==2 ) { mddev->ro =0 ; -set_bit (MD_RECOVERY_NEEDED , &mddev->recovery); -md_wakeup_thread (mddev->thread); - +set_bit (MD_RECOVERY_NEEDED , &mddev->recovery); +md_wakeup_thread (mddev->thread); }else { err = -EROFS ; goto abort_unlock;
Signature · 1 line
1.5.3.8
PATCH 2/8 md_getgeo(): Move comment to proper position.
In reply to Andre Noll--- drivers/md/md.c | 12 ++++++------ 1 files changed, 6 insertions(+), 6 deletions(-)
drivers/md/md.c +6 -6
@@ -4641,6 +4641,12 @@ static int set_disk_faulty(mddev_t *mddev, dev_t dev)return 0 ; } +/* +* We have a problem here : there is no easy way to give a CHS +* virtual geometry. We currently pretend that we have a 2 heads +* 4 sectors (with a BIG number of cylinders...). This drives +* dosfs just mad... ;-) +*/ static int md_getgeo (struct block_device *bdev,struct hd_geometry *geo) {mddev_t *mddev = bdev->bd_disk->private_data;
@@ -4792,12 +4798,6 @@ static int md_ioctl(struct inode *inode, struct file *file, err =do_md_stop (mddev,1 ); goto done_unlock; -/* -* We have a problem here : there is no easy way to give a CHS -* virtual geometry. We currently pretend that we have a 2 heads -* 4 sectors (with a BIG number of cylinders...). This drives -* dosfs just mad... ;-) -*/ }/*
Signature · 1 line
1.5.3.8
PATCH 3/8 do_md_run(): Fix misleading error message.
In reply to Andre NollIn case pers->run() succeeds but creating the bitmap fails, we print an error message stating that pers->run() has failed.
Print this message only if pers->run() really failed.
--- drivers/md/md.c | 5 +++-- 1 files changed, 3 insertions(+), 2 deletions(-)
drivers/md/md.c +3 -2
@@ -3519,7 +3519,9 @@ static int do_md_run(mddev_t * mddev) mddev->ro =2 ;/* read-only, but switch on first write */ err = mddev->pers->run (mddev); -if (!err && mddev->pers->sync_request) { +if (err) +printk (KERN_ERR "md: pers->run() failed ...\n" ); +else if (mddev->pers->sync_request) { err =bitmap_create (mddev);if (err) { printk(KERN_ERR "%s: failed to create bitmap (%d)\n",
@@ -3528,7 +3530,6 @@ static int do_md_run(mddev_t * mddev) } }if (err) { -printk (KERN_ERR "md: pers->run() failed ...\n" );module_put (mddev->pers->owner); mddev->pers =NULL ;bitmap_destroy (mddev);
Signature · 1 line
1.5.3.8
PATCH 4/8 sync_speed_show(): Trivial cleanups.
In reply to Andre Noll- Remove superfluous parentheses.
- Make format string match the type of the variable that is printed.
--- drivers/md/md.c | 8 ++++---- 1 files changed, 4 insertions(+), 4 deletions(-)
drivers/md/md.c +4 -4
@@ -3049,11 +3049,11 @@ static ssize_t sync_speed_show(mddev_t *mddev, char *page) {unsigned long resync, dt, db; - resync = (mddev->curr_mark_cnt -atomic_read (&mddev->recovery_active)); - dt = ((jiffies - mddev->resync_mark) /HZ ); + resync = mddev->curr_mark_cnt -atomic_read (&mddev->recovery_active); + dt = (jiffies - mddev->resync_mark) /HZ ;if (!dt) dt++; - db = resync - (mddev->resync_mark_cnt); -return sprintf (page,"%ld\n" , db/dt/2 );/* K/sec */ + db = resync - mddev->resync_mark_cnt; +return sprintf (page,"%lu\n" , db/dt/2 );/* K/sec */ }static struct md_sysfs_entry md_sync_speed =__ATTR_RO (sync_speed);
Signature · 1 line
1.5.3.8
PATCH 5/8 Fix typo in array_state comment.
In reply to Andre Noll--- drivers/md/md.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/md/md.c +1 -1
@@ -2512,7 +2512,7 @@ __ATTR(resync_start, S_IRUGO|S_IWUSR, resync_start_show, resync_start_store);* When written, doesn't tear down array, but just stops it * suspended (not supported yet) * All IO requests will block. The array can be reconfigured. -* Writing this, if accepted, will block until array is quiessent +* Writing this, if accepted, will block until array is quiescent * readonly * no resync can happen. no superblocks get written. * write requests fail
Signature · 1 line
1.5.3.8
PATCH 6/8 Fix a typo in the comment to cmd_match().
In reply to Andre Noll--- drivers/md/md.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/md/md.c +1 -1
@@ -1787,7 +1787,7 @@ repeat: } -/* words written to sysfs files may, or my not, be \n terminated. +/* words written to sysfs files may, or may not, be \n terminated. * We want to accept with case. For this we use cmd_match. */ static int cmd_match (const char *cmd,const char *str)
Signature · 1 line
1.5.3.8
PATCH 7/8 sb_equal(): Fix misleading printk.
In reply to Andre Noll--- drivers/md/md.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/md/md.c +1 -1
@@ -564,7 +564,7 @@ static int sb_equal(mdp_super_t *sb1, mdp_super_t *sb2)if (!tmp1 || !tmp2) { ret =0 ; -printk (KERN_INFO "md.c: sb1 is not equal to sb2!\n" ); +printk (KERN_INFO "md.c sb_equal(): failed to allocate memory!\n" ); goto abort; }
Signature · 1 line
1.5.3.8
PATCH 8/8 Kill unused parameter mddev in md_new_event_inintr().
In reply to Andre Noll--- drivers/md/md.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)
drivers/md/md.c +2 -2
@@ -176,7 +176,7 @@ EXPORT_SYMBOL_GPL(md_new_event);/* Alternate version that can be called from interrupts * when calling sysfs_notify isn't needed. */ -static void md_new_event_inintr (mddev_t *mddev) +static void md_new_event_inintr (void ) {atomic_inc (&md_event_count);wake_up (&md_event_waiters);
@@ -5031,7 +5031,7 @@ void md_error(mddev_t *mddev, mdk_rdev_t *rdev)set_bit (MD_RECOVERY_INTR , &mddev->recovery);set_bit (MD_RECOVERY_NEEDED , &mddev->recovery);md_wakeup_thread (mddev->thread); -md_new_event_inintr (mddev); +md_new_event_inintr (); }/* seq_file implementation /proc/mdstat */
Signature · 1 line
1.5.3.8
Quoted 4 lines · On Monday July 7, [email protected] wrote:
Hi
here are eight simple cleanup patches to
md.cagainst linus-current.git. Please review.
Thanks. I
- added "md: " to the start of the subject line
- fixed the conflicts with the first patch against my current tree:
I think I already fixed some of that indenting
- dropped the last patch.... I don't have a clear justification, but I currently want to leave the 'mddev' parameter there to remind me to review the implementation as I might want to do something a bit different there ... not sure yet.
They are now in my "for-next" branch which can be viewed at
http://neil.brown.name/git?p=md;a=shortlog;h=refs/heads/for-next
NeilBrown
Quoted 15 lines · Neil Brown
Quoted 4 lines · On Monday July 7, [email protected] wrote:
Hi
here are eight simple cleanup patches to
md.cagainst linus-current.git. Please review.Thanks. I
- added "md: " to the start of the subject line
- fixed the conflicts with the first patch against my current tree:
I think I already fixed some of that indenting
- dropped the last patch.... I don't have a clear justification, but I currently want to leave the 'mddev' parameter there to remind me to review the implementation as I might want to do something a bit different there ... not sure yet.
Quoted 3 lines
They are now in my "for-next" branch which can be viewed at
http://neil.brown.name/git?p=md;a=shortlog;h=refs/heads/for-next
Thanks for including the changes so quickly.
I have some more patches which are also simple, but slighlty more involved. I'll queue them up and send them to the list for review later today.
Andre
Signature · 1 line
The only person who always got his work done by Friday was Robinson Crusoe