aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/md/raid1.c
diff options
context:
space:
mode:
authorNeilBrown <neilb@cse.unsw.edu.au>2005-06-21 20:17:13 -0400
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-06-21 22:07:43 -0400
commit57afd89f98a990747445f01c458ecae64263b2f8 (patch)
treecab9f5941f32299bc97936e111f6552ebcee9cf6 /drivers/md/raid1.c
parent06d91a5fe0b50c9060e70bdf7786f8a3c66249db (diff)
[PATCH] md: improve the interface to sync_request
1/ change the return value (which is number-of-sectors synced) from 'int' to 'sector_t'. The number of sectors is usually easily small enough to fit in an int, but if resync needs to abort, it may want to return the total number of remaining sectors, which could be large. Also errors cannot be returned as negative numbers now, so use 0 instead 2/ Add a 'skipped' return parameter to allow the array to report that it skipped the sectors. This allows md to take this into account in the speed calculations. Currently there is no important skipping, but the bitmap-based-resync that is coming will use this. Signed-off-by: Neil Brown <neilb@cse.unsw.edu.au> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers/md/raid1.c')
-rw-r--r--drivers/md/raid1.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c
index 3f1280bbaf39..3c5c916cb09e 100644
--- a/drivers/md/raid1.c
+++ b/drivers/md/raid1.c
@@ -1010,7 +1010,7 @@ static int init_resync(conf_t *conf)
1010 * that can be installed to exclude normal IO requests. 1010 * that can be installed to exclude normal IO requests.
1011 */ 1011 */
1012 1012
1013static int sync_request(mddev_t *mddev, sector_t sector_nr, int go_faster) 1013static sector_t sync_request(mddev_t *mddev, sector_t sector_nr, int *skipped, int go_faster)
1014{ 1014{
1015 conf_t *conf = mddev_to_conf(mddev); 1015 conf_t *conf = mddev_to_conf(mddev);
1016 mirror_info_t *mirror; 1016 mirror_info_t *mirror;
@@ -1023,7 +1023,7 @@ static int sync_request(mddev_t *mddev, sector_t sector_nr, int go_faster)
1023 1023
1024 if (!conf->r1buf_pool) 1024 if (!conf->r1buf_pool)
1025 if (init_resync(conf)) 1025 if (init_resync(conf))
1026 return -ENOMEM; 1026 return 0;
1027 1027
1028 max_sector = mddev->size << 1; 1028 max_sector = mddev->size << 1;
1029 if (sector_nr >= max_sector) { 1029 if (sector_nr >= max_sector) {
@@ -1107,8 +1107,8 @@ static int sync_request(mddev_t *mddev, sector_t sector_nr, int go_faster)
1107 /* There is nowhere to write, so all non-sync 1107 /* There is nowhere to write, so all non-sync
1108 * drives must be failed - so we are finished 1108 * drives must be failed - so we are finished
1109 */ 1109 */
1110 int rv = max_sector - sector_nr; 1110 sector_t rv = max_sector - sector_nr;
1111 md_done_sync(mddev, rv, 1); 1111 *skipped = 1;
1112 put_buf(r1_bio); 1112 put_buf(r1_bio);
1113 rdev_dec_pending(conf->mirrors[disk].rdev, mddev); 1113 rdev_dec_pending(conf->mirrors[disk].rdev, mddev);
1114 return rv; 1114 return rv;