From: scjody@sun.com
To: linux-ext4@vger.kernel.org, linux-raid@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, Andreas Dilger <adilger@sun.com>
Subject: [patch 2/5] [md] Add syncraid buffer & bio flags
Date: Thu, 19 Nov 2009 16:22:43 -0500 [thread overview]
Message-ID: <20091119212358.875539573@sun.com> (raw)
In-Reply-To: 20091119212241.283629302@sun.com
[-- Attachment #1: md-add-bio-syncraid.patch --]
[-- Type: TEXT/PLAIN, Size: 5225 bytes --]
Adds the BIO_SYNCRAID bio flag and the syncraid buffer flag. These
are used to request a resync of the stripe containing the data being read
or written.
Signed-off-by: Jody McIntyre <scjody@sun.com>
Index: linux-2.6.18-128.7.1/drivers/md/raid5.c
===================================================================
--- linux-2.6.18-128.7.1.orig/drivers/md/raid5.c
+++ linux-2.6.18-128.7.1/drivers/md/raid5.c
@@ -1704,7 +1704,8 @@ static void handle_stripe5(struct stripe
}
}
if (failed > 1 && syncing) {
- md_done_sync(conf->mddev, STRIPE_SECTORS,0);
+ if (!test_bit(STRIPE_RESYNC_REQ, &sh->state))
+ md_done_sync(conf->mddev, STRIPE_SECTORS, 0);
clear_bit(STRIPE_SYNCING, &sh->state);
syncing = 0;
}
@@ -1941,7 +1942,8 @@ static void handle_stripe5(struct stripe
}
}
if (syncing && locked == 0 && test_bit(STRIPE_INSYNC, &sh->state)) {
- md_done_sync(conf->mddev, STRIPE_SECTORS,1);
+ if (!test_bit(STRIPE_RESYNC_REQ, &sh->state))
+ md_done_sync(conf->mddev, STRIPE_SECTORS, 1);
clear_bit(STRIPE_SYNCING, &sh->state);
}
@@ -2289,7 +2291,8 @@ static void handle_stripe6(struct stripe
}
}
if (failed > 2 && syncing) {
- md_done_sync(conf->mddev, STRIPE_SECTORS,0);
+ if (!test_bit(STRIPE_RESYNC_REQ, &sh->state))
+ md_done_sync(conf->mddev, STRIPE_SECTORS, 0);
clear_bit(STRIPE_SYNCING, &sh->state);
syncing = 0;
}
@@ -2589,6 +2592,8 @@ static void handle_stripe6(struct stripe
if (syncing && locked == 0 && test_bit(STRIPE_INSYNC, &sh->state)) {
md_done_sync(conf->mddev, STRIPE_SECTORS,1);
+ if (!test_bit(STRIPE_RESYNC_REQ, &sh->state))
+ md_done_sync(conf->mddev, STRIPE_SECTORS, 1);
clear_bit(STRIPE_SYNCING, &sh->state);
}
@@ -2880,6 +2885,9 @@ static int make_request(request_queue_t
else
atomic_inc(&conf->reads_in);
+ PRINTK("make_request on %llu, %s\n", bi->bi_sector,
+ ((rw == WRITE) ? "write" : "read"));
+
logical_sector = bi->bi_sector & ~((sector_t)STRIPE_SECTORS-1);
last_sector = bi->bi_sector + (bi->bi_size>>9);
bi->bi_next = NULL;
@@ -3006,6 +3014,19 @@ retry:
r_sector += sectors_per_chunk;
}
if (sh) {
+ if (bio_flagged(bi, BIO_SYNCRAID)) {
+ if (test_bit(STRIPE_RESYNC_REQ, &sh->state)) {
+ PRINTK("SYNCRAID on %llu, already "
+ "resynced\n", bi->bi_sector);
+ } else {
+ PRINTK("SYNCRAID on %llu, "
+ "resyncing\n", bi->bi_sector);
+ set_bit(STRIPE_SYNCING, &sh->state);
+ set_bit(STRIPE_RESYNC_REQ, &sh->state);
+ clear_bit(STRIPE_INSYNC, &sh->state);
+ }
+ }
+
handle_stripe(sh, NULL, bios);
release_stripe(sh);
sh = NULL;
@@ -3234,6 +3255,7 @@ static inline sector_t sync_request(mdde
spin_lock(&sh->lock);
set_bit(STRIPE_SYNCING, &sh->state);
clear_bit(STRIPE_INSYNC, &sh->state);
+ clear_bit(STRIPE_RESYNC_REQ, &sh->state);
spin_unlock(&sh->lock);
handle_stripe(sh, NULL, NULL);
Index: linux-2.6.18-128.7.1/fs/buffer.c
===================================================================
--- linux-2.6.18-128.7.1.orig/fs/buffer.c
+++ linux-2.6.18-128.7.1/fs/buffer.c
@@ -2861,6 +2861,8 @@ int submit_bh(int rw, struct buffer_head
if (buffer_fs_raidsync(bh))
set_bit(BIO_FS_RAIDSYNC, &bio->bi_flags);
+ if (buffer_syncraid(bh))
+ set_bit(BIO_SYNCRAID, &bio->bi_flags);
bio_get(bio);
submit_bio(rw, bio);
Index: linux-2.6.18-128.7.1/include/linux/bio.h
===================================================================
--- linux-2.6.18-128.7.1.orig/include/linux/bio.h
+++ linux-2.6.18-128.7.1/include/linux/bio.h
@@ -125,6 +125,7 @@ struct bio {
#define BIO_USER_MAPPED 6 /* contains user pages */
#define BIO_EOPNOTSUPP 7 /* not supported */
#define BIO_FS_RAIDSYNC 8 /* fs is responsible for RAID parity resync */
+#define BIO_SYNCRAID 9 /* perform RAID parity resync now */
#define bio_flagged(bio, flag) ((bio)->bi_flags & (1 << (flag)))
/*
Index: linux-2.6.18-128.7.1/include/linux/buffer_head.h
===================================================================
--- linux-2.6.18-128.7.1.orig/include/linux/buffer_head.h
+++ linux-2.6.18-128.7.1/include/linux/buffer_head.h
@@ -33,6 +33,7 @@ enum bh_state_bits {
BH_Ordered, /* ordered write */
BH_Eopnotsupp, /* operation not supported (barrier) */
BH_FS_Raidsync, /* FS is responsible for RAID parity resyncs */
+ BH_SyncRAID, /* Perform RAID parity resync now */
BH_PrivateStart,/* not a state bit, but the first bit available
* for private allocation by other entities
*/
@@ -126,6 +127,7 @@ BUFFER_FNS(Ordered, ordered)
BUFFER_FNS(Eopnotsupp, eopnotsupp)
BUFFER_FNS(Unwritten, unwritten)
BUFFER_FNS(FS_Raidsync, fs_raidsync)
+BUFFER_FNS(SyncRAID, syncraid)
#define bh_offset(bh) ((unsigned long)(bh)->b_data & ~PAGE_MASK)
#define touch_buffer(bh) mark_page_accessed(bh->b_page)
Index: linux-2.6.18-128.7.1/include/linux/raid/raid5.h
===================================================================
--- linux-2.6.18-128.7.1.orig/include/linux/raid/raid5.h
+++ linux-2.6.18-128.7.1/include/linux/raid/raid5.h
@@ -180,6 +180,8 @@ struct stripe_head {
#define STRIPE_EXPANDING 9
#define STRIPE_EXPAND_SOURCE 10
#define STRIPE_EXPAND_READY 11
+#define STRIPE_RESYNC_REQ 12
+
/*
* Plugging:
*
--
next prev parent reply other threads:[~2009-11-19 21:23 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-11-19 21:22 [patch 0/5] Journal guided resync and support scjody
2009-11-19 21:22 ` [patch 1/5] [md] Add fs_raidsync buffer & bio flags scjody
2009-11-19 21:22 ` scjody [this message]
2009-11-19 21:22 ` [patch 3/5] [jbd] Add support for journal guided resync scjody
2009-11-19 21:22 ` [patch 4/5] [ext3] Add journal guided resync (data=declared mode) scjody
2009-11-19 21:22 ` [patch 5/5] [md] Add SET_RESYNC_ALL and CLEAR_RESYNC_ALL ioctls scjody
2009-11-24 11:43 ` [patch 0/5] Journal guided resync and support Pavel Machek
2009-11-24 18:51 ` Andreas Dilger
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20091119212358.875539573@sun.com \
--to=scjody@sun.com \
--cc=adilger@sun.com \
--cc=linux-ext4@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-raid@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.