From: Paul Clements <paul.clements@steeleye.com>
To: Neil Brown <neilb@cse.unsw.edu.au>
Cc: jejb@steeleye.com, linux-raid@vger.kernel.org
Subject: Re: [ANNOUNCE][PATCH 2.6] md: persistent (file-backed) bitmap and async writes
Date: Tue, 12 Oct 2004 17:16:48 -0400 [thread overview]
Message-ID: <416C49C0.8070906@steeleye.com> (raw)
In-Reply-To: <416BE4DA.1040408@steeleye.com>
[-- Attachment #1: Type: text/plain, Size: 1734 bytes --]
Neil,
patch to fix the issues mentioned below has been tested and is attached.
Should apply on top of 2.6.9-rc2 + md_bitmap.
--
Paul
Paul Clements wrote:
> Neil Brown wrote:
>
>>> Paul Clements wrote:
>
>
>>> itself. Check out the new patch here:
>>>
>>> http://parisc-linux.org/~jejb/md_bitmap/md_bitmap_2_37_2_6_9_rc2.diff
>>>
>
>> Further comments.
>>
>> bitmap_events
>> 1/ You have inserted bitmap_event_hi/lo *before* recovery_cp, thus
>> moving recovery_cp, and thus breaking backwards comparability.
>
>
> Yes. I guess when recovery_cp came along I failed to notice that...
>
>> 2/ The test in hot_add_disk:
>> + if (refsb && sb && uuid_equal(sb, refsb) &&
>> + sb->events_hi >= refsb->bitmap_events_hi &&
>> + sb->events_lo >= refsb->bitmap_events_lo) {
>> + bitmap_invalidate = 0;
>> is wrong. The events count must be compared as a 64bit
>> number. e.g. it is only meaningful to compare events_lo if both
>> events_hi are equal.
>
>
> Yes, that is broken.
>
>> pending_bio_list
>> 1/ Do you really need a separate pending_bio_lock, or would
>> the current device_lock be adequate to the task.
>
>
> Probably so...especially with the following change...
>
>> 2/ I think there can be a race with new requests being added to
>> this list while bitmap_unplug is running in unplug_slaves.
>> I think you should "bio_get_list" before calling bitmap_unplug,
>> So that you only then submit requests that were made definitely
>> *before* the call the bitmap_unplug. This would have the added
>> advantage that you don't need to keep claiming and dropping
>> pending_bio_lock.
>
>
> Yes, that would make sense.
[-- Attachment #2: md_bitmap_bugfix_2_37_2_6_9_rc2.diff --]
[-- Type: text/plain, Size: 5644 bytes --]
diff -purN --exclude-from /export/public/clemep/tmp/dontdiff linux-2.6.9-rc2-BITMAP/drivers/md/md.c linux-2.6.9-rc2-BITMAP-NEW/drivers/md/md.c
--- linux-2.6.9-rc2-BITMAP/drivers/md/md.c Tue Sep 14 14:11:07 2004
+++ linux-2.6.9-rc2-BITMAP-NEW/drivers/md/md.c Tue Oct 12 12:23:13 2004
@@ -2375,8 +2375,9 @@ static int hot_add_disk(mddev_t * mddev,
if (rdev->sb_loaded)
sb = (mdp_super_t *)page_address(rdev->sb_page);
if (refsb && sb && uuid_equal(sb, refsb) &&
- sb->events_hi >= refsb->bitmap_events_hi &&
- sb->events_lo >= refsb->bitmap_events_lo) {
+ (sb->events_hi > refsb->bitmap_events_hi ||
+ (sb->events_hi == refsb->bitmap_events_hi &&
+ sb->events_lo >= refsb->bitmap_events_lo))) {
bitmap_invalidate = 0;
} else if (!mddev->persistent) { /* assume bitmap is valid */
bitmap_invalidate = 0;
diff -purN --exclude-from /export/public/clemep/tmp/dontdiff linux-2.6.9-rc2-BITMAP/drivers/md/raid1.c linux-2.6.9-rc2-BITMAP-NEW/drivers/md/raid1.c
--- linux-2.6.9-rc2-BITMAP/drivers/md/raid1.c Tue Sep 14 14:13:47 2004
+++ linux-2.6.9-rc2-BITMAP-NEW/drivers/md/raid1.c Tue Oct 12 16:23:54 2004
@@ -455,18 +455,21 @@ static void unplug_slaves(mddev_t *mddev
struct bio *bio;
unsigned long flags;
+ /* pull writes off the pending queue and (later) submit them */
+ spin_lock_irqsave(&conf->device_lock, flags);
+ bio = bio_list_get(&conf->pending_bio_list);
+ spin_unlock_irqrestore(&conf->device_lock, flags);
+
/* flush any pending bitmap writes to disk before proceeding w/ I/O */
if (bitmap_unplug(mddev->bitmap) != 0)
printk("%s: bitmap file write failed!\n", mdname(mddev));
- /* pull writes off the pending queue and submit them */
- spin_lock_irqsave(&conf->pending_bio_lock, flags);
- while ((bio = bio_list_pop(&conf->pending_bio_list))) {
- spin_unlock_irqrestore(&conf->pending_bio_lock, flags);
+ while (bio) { /* submit pending writes */
+ struct bio *next = bio->bi_next;
+ bio->bi_next = NULL;
generic_make_request(bio);
- spin_lock_irqsave(&conf->pending_bio_lock, flags);
+ bio = next;
}
- spin_unlock_irqrestore(&conf->pending_bio_lock, flags);
spin_lock_irqsave(&conf->device_lock, flags);
for (i=0; i<mddev->raid_disks; i++) {
@@ -666,9 +669,9 @@ static int make_request(request_queue_t
atomic_inc(&r1_bio->remaining);
/* queue the write...it will be submitted when we unplug */
- spin_lock_irqsave(&conf->pending_bio_lock, flags);
+ spin_lock_irqsave(&conf->device_lock, flags);
bio_list_add(&conf->pending_bio_list, mbio);
- spin_unlock_irqrestore(&conf->pending_bio_lock, flags);
+ spin_unlock_irqrestore(&conf->device_lock, flags);
}
if (atomic_dec_and_test(&r1_bio->remaining)) {
@@ -965,9 +968,9 @@ static void sync_request_write(mddev_t *
"while resyncing!\n", mdname(mddev), err);
/* queue the write...it will be submitted when we unplug */
- spin_lock_irqsave(&conf->pending_bio_lock, flags);
+ spin_lock_irqsave(&conf->device_lock, flags);
bio_list_add(&conf->pending_bio_list, wbio);
- spin_unlock_irqrestore(&conf->pending_bio_lock, flags);
+ spin_unlock_irqrestore(&conf->device_lock, flags);
}
if (atomic_dec_and_test(&r1_bio->remaining)) {
@@ -1307,7 +1310,6 @@ static int run(mddev_t *mddev)
init_waitqueue_head(&conf->wait_idle);
init_waitqueue_head(&conf->wait_resume);
- conf->pending_bio_lock = SPIN_LOCK_UNLOCKED;
bio_list_init(&conf->pending_bio_list);
if (!conf->working_disks) {
diff -purN --exclude-from /export/public/clemep/tmp/dontdiff linux-2.6.9-rc2-BITMAP/include/linux/raid/md_p.h linux-2.6.9-rc2-BITMAP-NEW/include/linux/raid/md_p.h
--- linux-2.6.9-rc2-BITMAP/include/linux/raid/md_p.h Tue Sep 14 12:12:55 2004
+++ linux-2.6.9-rc2-BITMAP-NEW/include/linux/raid/md_p.h Tue Oct 12 12:21:12 2004
@@ -133,17 +133,20 @@ typedef struct mdp_superblock_s {
__u32 events_lo; /* 8 low-order of superblock update count */
__u32 cp_events_hi; /* 9 high-order of checkpoint update count */
__u32 cp_events_lo; /* 10 low-order of checkpoint update count */
- __u32 bitmap_events_hi; /* 11 high-order of bitmap update count */
- __u32 bitmap_events_lo; /* 12 low-order of bitmap update count */
#else
__u32 events_lo; /* 7 low-order of superblock update count */
__u32 events_hi; /* 8 high-order of superblock update count */
__u32 cp_events_lo; /* 9 low-order of checkpoint update count */
__u32 cp_events_hi; /* 10 high-order of checkpoint update count */
- __u32 bitmap_events_lo; /* 11 low-order of bitmap update count */
+#endif
+ __u32 recovery_cp; /* 11 recovery checkpoint sector count */
+#ifdef __BIG_ENDIAN
__u32 bitmap_events_hi; /* 12 high-order of bitmap update count */
+ __u32 bitmap_events_lo; /* 13 low-order of bitmap update count */
+#else
+ __u32 bitmap_events_lo; /* 12 low-order of bitmap update count */
+ __u32 bitmap_events_hi; /* 13 high-order of bitmap update count */
#endif
- __u32 recovery_cp; /* 13 recovery checkpoint sector count */
__u32 gstate_sreserved[MD_SB_GENERIC_STATE_WORDS - 14];
/*
diff -purN --exclude-from /export/public/clemep/tmp/dontdiff linux-2.6.9-rc2-BITMAP/include/linux/raid/raid1.h linux-2.6.9-rc2-BITMAP-NEW/include/linux/raid/raid1.h
--- linux-2.6.9-rc2-BITMAP/include/linux/raid/raid1.h Tue Sep 14 14:09:11 2004
+++ linux-2.6.9-rc2-BITMAP-NEW/include/linux/raid/raid1.h Tue Oct 12 12:30:03 2004
@@ -37,7 +37,6 @@ struct r1_private_data_s {
/* queue pending writes and submit them on unplug */
struct bio_list pending_bio_list;
- spinlock_t pending_bio_lock;
/* for use when syncing mirrors: */
next prev parent reply other threads:[~2004-10-12 21:16 UTC|newest]
Thread overview: 34+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-01-29 22:51 [ANNOUNCE][PATCH 2.6] md: persistent (file-backed) bitmap and async writes Paul Clements
2004-01-30 22:52 ` Paul Clements
2004-02-09 2:51 ` Neil Brown
2004-02-09 19:45 ` Paul Clements
2004-02-10 0:04 ` Neil Brown
2004-02-10 16:20 ` Paul Clements
2004-02-10 16:57 ` Paul Clements
2004-02-13 20:58 ` Paul Clements
2004-03-05 5:06 ` Neil Brown
2004-03-05 22:05 ` Paul Clements
2004-03-31 18:38 ` Paul Clements
2004-04-28 18:10 ` Paul Clements
2004-04-28 18:53 ` Peter T. Breuer
2004-04-29 8:41 ` Neil Brown
2004-05-04 20:08 ` Paul Clements
2004-06-08 20:53 ` Paul Clements
2004-06-08 22:47 ` Neil Brown
2004-06-14 23:39 ` Neil Brown
2004-06-14 23:59 ` James Bottomley
2004-06-15 6:27 ` Neil Brown
2004-06-17 17:57 ` Paul Clements
2004-06-18 20:48 ` Paul Clements
2004-06-23 21:48 ` Paul Clements
2004-06-23 21:50 ` Paul Clements
2004-07-06 14:52 ` Paul Clements
[not found] ` <40F7E50F.2040308@steeleye.com>
[not found] ` <16649.61212.310271.36561@cse.unsw.edu.au>
2004-08-10 21:37 ` Paul Clements
2004-08-13 3:04 ` Neil Brown
2004-09-21 3:28 ` Paul Clements
2004-09-21 19:19 ` Paul Clements
2004-10-12 2:15 ` Neil Brown
2004-10-12 14:06 ` Paul Clements
2004-10-12 21:16 ` Paul Clements [this message]
2004-11-10 0:37 ` md: persistent (file-backed) bitmap Neil Brown
2004-11-10 18:28 ` Paul Clements
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=416C49C0.8070906@steeleye.com \
--to=paul.clements@steeleye.com \
--cc=jejb@steeleye.com \
--cc=linux-raid@vger.kernel.org \
--cc=neilb@cse.unsw.edu.au \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).