linux-raid.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/3] md/raid5: fix raid5_set_bi_hw_segments
@ 2011-06-13 14:48 Namhyung Kim
  2011-06-13 14:48 ` [PATCH 2/3] md/raid5: fix FUA request handling in ops_run_io() Namhyung Kim
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Namhyung Kim @ 2011-06-13 14:48 UTC (permalink / raw)
  To: Neil Brown; +Cc: linux-raid, linux-kernel

The @bio->bi_phys_segments consists of active stripes count in the
lower 16 bits and processed stripes count in the upper 16 bits. So
logical-OR operator should be bitwise one.

Signed-off-by: Namhyung Kim <namhyung@gmail.com>
---
 drivers/md/raid5.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c
index 346e69bfdab3..fa6ac70dc72f 100644
--- a/drivers/md/raid5.c
+++ b/drivers/md/raid5.c
@@ -129,7 +129,7 @@ static inline int raid5_dec_bi_hw_segments(struct bio *bio)
 
 static inline void raid5_set_bi_hw_segments(struct bio *bio, unsigned int cnt)
 {
-	bio->bi_phys_segments = raid5_bi_phys_segments(bio) || (cnt << 16);
+	bio->bi_phys_segments = raid5_bi_phys_segments(bio) | (cnt << 16);
 }
 
 /* Find first data disk in a raid6 stripe */
-- 
1.7.5.2


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 2/3] md/raid5: fix FUA request handling in ops_run_io()
  2011-06-13 14:48 [PATCH 1/3] md/raid5: fix raid5_set_bi_hw_segments Namhyung Kim
@ 2011-06-13 14:48 ` Namhyung Kim
  2011-06-13 14:48 ` [PATCH 3/3] md/raid5: remove unusual use of bio_iovec_idx() Namhyung Kim
  2011-06-14  4:12 ` [PATCH 1/3] md/raid5: fix raid5_set_bi_hw_segments NeilBrown
  2 siblings, 0 replies; 4+ messages in thread
From: Namhyung Kim @ 2011-06-13 14:48 UTC (permalink / raw)
  To: Neil Brown; +Cc: linux-raid, linux-kernel, Tejun Heo

Commit e9c7469bb4f5 ("md: implment REQ_FLUSH/FUA support")
introduced R5_WantFUA flag and set rw to WRITE_FUA in that case.
However remaining code still checks whether rw is exactly same
as WRITE or not, so FUAed-write ends up with being treated as
READ. Fix it.

Cc: Tejun Heo <tj@kernel.org>
Signed-off-by: Namhyung Kim <namhyung@gmail.com>
---
 drivers/md/raid5.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c
index fa6ac70dc72f..026452bbb030 100644
--- a/drivers/md/raid5.c
+++ b/drivers/md/raid5.c
@@ -514,7 +514,7 @@ static void ops_run_io(struct stripe_head *sh, struct stripe_head_state *s)
 		bi = &sh->dev[i].req;
 
 		bi->bi_rw = rw;
-		if (rw == WRITE)
+		if (rw & WRITE)
 			bi->bi_end_io = raid5_end_write_request;
 		else
 			bi->bi_end_io = raid5_end_read_request;
@@ -548,13 +548,13 @@ static void ops_run_io(struct stripe_head *sh, struct stripe_head_state *s)
 			bi->bi_io_vec[0].bv_offset = 0;
 			bi->bi_size = STRIPE_SIZE;
 			bi->bi_next = NULL;
-			if (rw == WRITE &&
+			if (rw & WRITE &&
 			    test_bit(R5_ReWrite, &sh->dev[i].flags))
 				atomic_add(STRIPE_SECTORS,
 					&rdev->corrected_errors);
 			generic_make_request(bi);
 		} else {
-			if (rw == WRITE)
+			if (rw & WRITE)
 				set_bit(STRIPE_DEGRADED, &sh->state);
 			pr_debug("skip op %ld on disc %d for sector %llu\n",
 				bi->bi_rw, i, (unsigned long long)sh->sector);
-- 
1.7.5.2


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 3/3] md/raid5: remove unusual use of bio_iovec_idx()
  2011-06-13 14:48 [PATCH 1/3] md/raid5: fix raid5_set_bi_hw_segments Namhyung Kim
  2011-06-13 14:48 ` [PATCH 2/3] md/raid5: fix FUA request handling in ops_run_io() Namhyung Kim
@ 2011-06-13 14:48 ` Namhyung Kim
  2011-06-14  4:12 ` [PATCH 1/3] md/raid5: fix raid5_set_bi_hw_segments NeilBrown
  2 siblings, 0 replies; 4+ messages in thread
From: Namhyung Kim @ 2011-06-13 14:48 UTC (permalink / raw)
  To: Neil Brown; +Cc: linux-raid, linux-kernel, Dan Williams

In the bio_for_each_segment loop, bvl always points current
bio_vec, so the same as bio_iovec_idx(, i). Let's get rid of
it.

Cc: Dan Williams <dan.j.williams@intel.com>
Signed-off-by: Namhyung Kim <namhyung@gmail.com>
---
 drivers/md/raid5.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c
index 026452bbb030..0760716d0e3e 100644
--- a/drivers/md/raid5.c
+++ b/drivers/md/raid5.c
@@ -585,7 +585,7 @@ async_copy_data(int frombio, struct bio *bio, struct page *page,
 	init_async_submit(&submit, flags, tx, NULL, NULL, NULL);
 
 	bio_for_each_segment(bvl, bio, i) {
-		int len = bio_iovec_idx(bio, i)->bv_len;
+		int len = bvl->bv_len;
 		int clen;
 		int b_offset = 0;
 
@@ -601,8 +601,8 @@ async_copy_data(int frombio, struct bio *bio, struct page *page,
 			clen = len;
 
 		if (clen > 0) {
-			b_offset += bio_iovec_idx(bio, i)->bv_offset;
-			bio_page = bio_iovec_idx(bio, i)->bv_page;
+			b_offset += bvl->bv_offset;
+			bio_page = bvl->bv_page;
 			if (frombio)
 				tx = async_memcpy(page, bio_page, page_offset,
 						  b_offset, clen, &submit);
-- 
1.7.5.2

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH 1/3] md/raid5: fix raid5_set_bi_hw_segments
  2011-06-13 14:48 [PATCH 1/3] md/raid5: fix raid5_set_bi_hw_segments Namhyung Kim
  2011-06-13 14:48 ` [PATCH 2/3] md/raid5: fix FUA request handling in ops_run_io() Namhyung Kim
  2011-06-13 14:48 ` [PATCH 3/3] md/raid5: remove unusual use of bio_iovec_idx() Namhyung Kim
@ 2011-06-14  4:12 ` NeilBrown
  2 siblings, 0 replies; 4+ messages in thread
From: NeilBrown @ 2011-06-14  4:12 UTC (permalink / raw)
  To: Namhyung Kim; +Cc: linux-raid, linux-kernel

On Mon, 13 Jun 2011 23:48:22 +0900 Namhyung Kim <namhyung@gmail.com> wrote:

> The @bio->bi_phys_segments consists of active stripes count in the
> lower 16 bits and processed stripes count in the upper 16 bits. So
> logical-OR operator should be bitwise one.
> 
> Signed-off-by: Namhyung Kim <namhyung@gmail.com>
> ---
>  drivers/md/raid5.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c
> index 346e69bfdab3..fa6ac70dc72f 100644
> --- a/drivers/md/raid5.c
> +++ b/drivers/md/raid5.c
> @@ -129,7 +129,7 @@ static inline int raid5_dec_bi_hw_segments(struct bio *bio)
>  
>  static inline void raid5_set_bi_hw_segments(struct bio *bio, unsigned int cnt)
>  {
> -	bio->bi_phys_segments = raid5_bi_phys_segments(bio) || (cnt << 16);
> +	bio->bi_phys_segments = raid5_bi_phys_segments(bio) | (cnt << 16);
>  }
>  
>  /* Find first data disk in a raid6 stripe */


Thanks for this and the other 2!!
I have added "Cc: stable@kernel.org" to the first two and applied them.  I
expect to send them off to Linus later today.

Thanks,
NeilBrown

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2011-06-14  4:12 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-06-13 14:48 [PATCH 1/3] md/raid5: fix raid5_set_bi_hw_segments Namhyung Kim
2011-06-13 14:48 ` [PATCH 2/3] md/raid5: fix FUA request handling in ops_run_io() Namhyung Kim
2011-06-13 14:48 ` [PATCH 3/3] md/raid5: remove unusual use of bio_iovec_idx() Namhyung Kim
2011-06-14  4:12 ` [PATCH 1/3] md/raid5: fix raid5_set_bi_hw_segments 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).