* [PATCH 2/2] md:Rewrite the md_write_start().
@ 2012-06-02 8:16 majianpeng
2012-06-03 21:11 ` Dan Williams
0 siblings, 1 reply; 4+ messages in thread
From: majianpeng @ 2012-06-02 8:16 UTC (permalink / raw)
To: Neil Brown; +Cc: linux-raid
Remove the judgement "bio_data_dir(bi) != WRITE" in md_write_start().Put
it before call md_write_start.
Signed-off-by: majianpeng <majianpeng@gmail.com>
---
drivers/md/md.c | 4 +---
drivers/md/md.h | 2 +-
drivers/md/raid1.c | 4 ++--
drivers/md/raid10.c | 3 ++-
drivers/md/raid5.c | 3 ++-
5 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/drivers/md/md.c b/drivers/md/md.c
index 1c2f904..e009f1d 100644
--- a/drivers/md/md.c
+++ b/drivers/md/md.c
@@ -7198,11 +7198,9 @@ void md_done_sync(struct mddev *mddev, int blocks, int ok)
* in superblock) before writing, schedule a superblock update
* and wait for it to complete.
*/
-void md_write_start(struct mddev *mddev, struct bio *bi)
+void md_write_start(struct mddev *mddev)
{
int did_change = 0;
- if (bio_data_dir(bi) != WRITE)
- return;
BUG_ON(mddev->ro == 1);
if (mddev->ro == 2) {
diff --git a/drivers/md/md.h b/drivers/md/md.h
index 7b4a3c3..906e3db 100644
--- a/drivers/md/md.h
+++ b/drivers/md/md.h
@@ -593,7 +593,7 @@ extern struct md_thread *md_register_thread(
extern void md_unregister_thread(struct md_thread **threadp);
extern void md_wakeup_thread(struct md_thread *thread);
extern void md_check_recovery(struct mddev *mddev);
-extern void md_write_start(struct mddev *mddev, struct bio *bi);
+extern void md_write_start(struct mddev *mddev);
extern void md_write_end(struct mddev *mddev);
extern void md_done_sync(struct mddev *mddev, int blocks, int ok);
extern void md_error(struct mddev *mddev, struct md_rdev *rdev);
diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c
index 835de71..4bfa77d 100644
--- a/drivers/md/raid1.c
+++ b/drivers/md/raid1.c
@@ -893,8 +893,8 @@ static void make_request(struct mddev *mddev, struct bio * bio)
* thread has put up a bar for new requests.
* Continue immediately if no resync is active currently.
*/
-
- md_write_start(mddev, bio); /* wait on superblock update early */
+ if (rw == WRITE)
+ md_write_start(mddev); /* wait on superblock update early */
if (bio_data_dir(bio) == WRITE &&
bio->bi_sector + bio->bi_size/512 > mddev->suspend_lo &&
diff --git a/drivers/md/raid10.c b/drivers/md/raid10.c
index 987db37..b10cb99 100644
--- a/drivers/md/raid10.c
+++ b/drivers/md/raid10.c
@@ -1098,7 +1098,8 @@ static void make_request(struct mddev *mddev, struct bio * bio)
return;
}
- md_write_start(mddev, bio);
+ if (rw == WRITE)
+ md_write_start(mddev);
/*
* Register the new request and wait if the reconstruction
diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c
index 5653125..8e330f8 100644
--- a/drivers/md/raid5.c
+++ b/drivers/md/raid5.c
@@ -3983,7 +3983,8 @@ static void make_request(struct mddev *mddev, struct bio * bi)
chunk_aligned_read(mddev,bi))
return;
- md_write_start(mddev, bi);
+ if (rw == WRITE)
+ md_write_start(mddev);
logical_sector = bi->bi_sector & ~((sector_t)STRIPE_SECTORS-1);
last_sector = bi->bi_sector + (bi->bi_size>>9);
--
1.7.5.4
--------------
majianpeng
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH 2/2] md:Rewrite the md_write_start().
2012-06-02 8:16 [PATCH 2/2] md:Rewrite the md_write_start() majianpeng
@ 2012-06-03 21:11 ` Dan Williams
2012-06-04 1:03 ` majianpeng
0 siblings, 1 reply; 4+ messages in thread
From: Dan Williams @ 2012-06-03 21:11 UTC (permalink / raw)
To: majianpeng; +Cc: Neil Brown, linux-raid
On Sat, Jun 2, 2012 at 1:16 AM, majianpeng <majianpeng@gmail.com> wrote:
> Remove the judgement "bio_data_dir(bi) != WRITE" in md_write_start().Put
> it before call md_write_start.
>
> Signed-off-by: majianpeng <majianpeng@gmail.com>
> ---
> drivers/md/md.c | 4 +---
> drivers/md/md.h | 2 +-
> drivers/md/raid1.c | 4 ++--
> drivers/md/raid10.c | 3 ++-
> drivers/md/raid5.c | 3 ++-
> 5 files changed, 8 insertions(+), 8 deletions(-)
If the deletions had outnumbered the insertions then maybe, but I
think just like kfree() allowing NULL pointers it's cleaner if the
caller need not worry.
--
Dan
--
To unsubscribe from this list: send the line "unsubscribe linux-raid" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Re: [PATCH 2/2] md:Rewrite the md_write_start().
2012-06-03 21:11 ` Dan Williams
@ 2012-06-04 1:03 ` majianpeng
2012-06-04 1:12 ` NeilBrown
0 siblings, 1 reply; 4+ messages in thread
From: majianpeng @ 2012-06-04 1:03 UTC (permalink / raw)
To: Dan Williams; +Cc: Neil Brown, linux-raid
On Sun, 3 Jun 2012 14:11:41 -0700, Dan Williams wrote:
>On Sat, Jun 2, 2012 at 1:16 AM, majianpeng <majianpeng@gmail.com> wrote:
>> Remove the judgement "bio_data_dir(bi) != WRITE" in md_write_start().Put
>> it before call md_write_start.
>>
>> Signed-off-by: majianpeng <majianpeng@gmail.com>
>> ---
>> ?drivers/md/md.c ? ? | ? ?4 +---
>> ?drivers/md/md.h ? ? | ? ?2 +-
>> ?drivers/md/raid1.c ?| ? ?4 ++--
>> ?drivers/md/raid10.c | ? ?3 ++-
>> ?drivers/md/raid5.c ?| ? ?3 ++-
>> ?5 files changed, 8 insertions(+), 8 deletions(-)
>
>If the deletions had outnumbered the insertions then maybe, but I
>think just like kfree() allowing NULL pointers it's cleaner if the
>caller need not worry.
>
>--
>Dan
The patch had a anthor reason: first check,if read so not call function.
Call function takes long time than check statment.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 2/2] md:Rewrite the md_write_start().
2012-06-04 1:03 ` majianpeng
@ 2012-06-04 1:12 ` NeilBrown
0 siblings, 0 replies; 4+ messages in thread
From: NeilBrown @ 2012-06-04 1:12 UTC (permalink / raw)
To: majianpeng; +Cc: Dan Williams, linux-raid
[-- Attachment #1: Type: text/plain, Size: 1063 bytes --]
On Mon, 4 Jun 2012 09:03:57 +0800 majianpeng <majianpeng@gmail.com> wrote:
> On Sun, 3 Jun 2012 14:11:41 -0700, Dan Williams wrote:
> >On Sat, Jun 2, 2012 at 1:16 AM, majianpeng <majianpeng@gmail.com> wrote:
> >> Remove the judgement "bio_data_dir(bi) != WRITE" in md_write_start().Put
> >> it before call md_write_start.
> >>
> >> Signed-off-by: majianpeng <majianpeng@gmail.com>
> >> ---
> >> ?drivers/md/md.c ? ? | ? ?4 +---
> >> ?drivers/md/md.h ? ? | ? ?2 +-
> >> ?drivers/md/raid1.c ?| ? ?4 ++--
> >> ?drivers/md/raid10.c | ? ?3 ++-
> >> ?drivers/md/raid5.c ?| ? ?3 ++-
> >> ?5 files changed, 8 insertions(+), 8 deletions(-)
> >
> >If the deletions had outnumbered the insertions then maybe, but I
> >think just like kfree() allowing NULL pointers it's cleaner if the
> >caller need not worry.
> >
> >--
> >Dan
> The patch had a anthor reason: first check,if read so not call function.
> Call function takes long time than check statment.
>
This is micro-optimisation that really isn't worth spending any time on.
NeilBrown
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 828 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2012-06-04 1:12 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-06-02 8:16 [PATCH 2/2] md:Rewrite the md_write_start() majianpeng
2012-06-03 21:11 ` Dan Williams
2012-06-04 1:03 ` majianpeng
2012-06-04 1:12 ` NeilBrown
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).