FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Redhat > Device-mapper Development

 
 
LinkBack Thread Tools
 
Old 09-11-2012, 12:22 AM
Kent Overstreet
 
Default raid1: use bio_reset()

I couldn't figure out what sbio->bi_end_io in process_checks() was
supposed to be, so I took the easy way out.

Signed-off-by: Kent Overstreet <koverstreet@google.com>
CC: Jens Axboe <axboe@kernel.dk>
CC: NeilBrown <neilb@suse.de>
---
drivers/md/raid1.c | 22 +++++-----------------
1 file changed, 5 insertions(+), 17 deletions(-)

diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c
index ee85154..bd3e3b9 100644
--- a/drivers/md/raid1.c
+++ b/drivers/md/raid1.c
@@ -1835,6 +1835,7 @@ static int process_checks(struct r1bio *r1_bio)
int primary;
int i;
int vcnt;
+ bio_end_io_t *bi_end_io;

for (primary = 0; primary < conf->raid_disks * 2; primary++)
if (r1_bio->bios[primary]->bi_end_io == end_sync_read &&
@@ -1876,13 +1877,11 @@ static int process_checks(struct r1bio *r1_bio)
continue;
}
/* fixup the bio for reuse */
+ bi_end_io = sbio->bi_end_io;
+ bio_reset(sbio);
+
sbio->bi_vcnt = vcnt;
sbio->bi_size = r1_bio->sectors << 9;
- sbio->bi_idx = 0;
- sbio->bi_phys_segments = 0;
- sbio->bi_flags &= ~(BIO_POOL_MASK - 1);
- sbio->bi_flags |= 1 << BIO_UPTODATE;
- sbio->bi_next = NULL;
sbio->bi_sector = r1_bio->sector +
conf->mirrors[i].rdev->data_offset;
sbio->bi_bdev = conf->mirrors[i].rdev->bdev;
@@ -2426,18 +2425,7 @@ static sector_t sync_request(struct mddev *mddev, sector_t sector_nr, int *skipp
for (i = 0; i < conf->raid_disks * 2; i++) {
struct md_rdev *rdev;
bio = r1_bio->bios[i];
-
- /* take from bio_init */
- bio->bi_next = NULL;
- bio->bi_flags &= ~(BIO_POOL_MASK-1);
- bio->bi_flags |= 1 << BIO_UPTODATE;
- bio->bi_rw = READ;
- bio->bi_vcnt = 0;
- bio->bi_idx = 0;
- bio->bi_phys_segments = 0;
- bio->bi_size = 0;
- bio->bi_end_io = NULL;
- bio->bi_private = NULL;
+ bio_reset(bio);

rdev = rcu_dereference(conf->mirrors[i].rdev);
if (rdev == NULL ||
--
1.7.12

--
dm-devel mailing list
dm-devel@redhat.com
https://www.redhat.com/mailman/listinfo/dm-devel
 
Old 09-11-2012, 04:59 AM
NeilBrown
 
Default raid1: use bio_reset()

On Mon, 10 Sep 2012 17:22:23 -0700 Kent Overstreet <koverstreet@google.com>
wrote:

> I couldn't figure out what sbio->bi_end_io in process_checks() was
> supposed to be, so I took the easy way out.

Almost.
You save 'sbio->bi_end_io' to 'bi_end_io', then do nothing with it...

A little way above the 'fixup the bio for reuse' comment you'll find:

struct bio *sbio = r1_bio->bios[i];
....
if (r1_bio->bios[i]->bi_end_io != end_sync_read)
continue;

which implies that if we don't 'continue', then sbio->bi_end_io ==
end_sync_read.

So I suspect you want to add
sbio->bi_end_io = end_sync_read;
somewhere after the 'bio_reset()'.

If you happened to also fix that 'if' that I quoted so that it reads:

if (sbio->bi_end_io != end_sync_read)
continue;

I wouldn't complain at all :-)

Thanks,
NeilBrown


>
> Signed-off-by: Kent Overstreet <koverstreet@google.com>
> CC: Jens Axboe <axboe@kernel.dk>
> CC: NeilBrown <neilb@suse.de>
> ---
> drivers/md/raid1.c | 22 +++++-----------------
> 1 file changed, 5 insertions(+), 17 deletions(-)
>
> diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c
> index ee85154..bd3e3b9 100644
> --- a/drivers/md/raid1.c
> +++ b/drivers/md/raid1.c
> @@ -1835,6 +1835,7 @@ static int process_checks(struct r1bio *r1_bio)
> int primary;
> int i;
> int vcnt;
> + bio_end_io_t *bi_end_io;
>
> for (primary = 0; primary < conf->raid_disks * 2; primary++)
> if (r1_bio->bios[primary]->bi_end_io == end_sync_read &&
> @@ -1876,13 +1877,11 @@ static int process_checks(struct r1bio *r1_bio)
> continue;
> }
> /* fixup the bio for reuse */
> + bi_end_io = sbio->bi_end_io;
> + bio_reset(sbio);
> +
> sbio->bi_vcnt = vcnt;
> sbio->bi_size = r1_bio->sectors << 9;
> - sbio->bi_idx = 0;
> - sbio->bi_phys_segments = 0;
> - sbio->bi_flags &= ~(BIO_POOL_MASK - 1);
> - sbio->bi_flags |= 1 << BIO_UPTODATE;
> - sbio->bi_next = NULL;
> sbio->bi_sector = r1_bio->sector +
> conf->mirrors[i].rdev->data_offset;
> sbio->bi_bdev = conf->mirrors[i].rdev->bdev;
> @@ -2426,18 +2425,7 @@ static sector_t sync_request(struct mddev *mddev, sector_t sector_nr, int *skipp
> for (i = 0; i < conf->raid_disks * 2; i++) {
> struct md_rdev *rdev;
> bio = r1_bio->bios[i];
> -
> - /* take from bio_init */
> - bio->bi_next = NULL;
> - bio->bi_flags &= ~(BIO_POOL_MASK-1);
> - bio->bi_flags |= 1 << BIO_UPTODATE;
> - bio->bi_rw = READ;
> - bio->bi_vcnt = 0;
> - bio->bi_idx = 0;
> - bio->bi_phys_segments = 0;
> - bio->bi_size = 0;
> - bio->bi_end_io = NULL;
> - bio->bi_private = NULL;
> + bio_reset(bio);
>
> rdev = rcu_dereference(conf->mirrors[i].rdev);
> if (rdev == NULL ||

--
dm-devel mailing list
dm-devel@redhat.com
https://www.redhat.com/mailman/listinfo/dm-devel
 
Old 09-11-2012, 06:28 PM
Kent Overstreet
 
Default raid1: use bio_reset()

On Tue, Sep 11, 2012 at 02:59:13PM +1000, NeilBrown wrote:
> On Mon, 10 Sep 2012 17:22:23 -0700 Kent Overstreet <koverstreet@google.com>
> wrote:
>
> > I couldn't figure out what sbio->bi_end_io in process_checks() was
> > supposed to be, so I took the easy way out.
>
> Almost.
> You save 'sbio->bi_end_io' to 'bi_end_io', then do nothing with it...

Whoops I think I must've gotten distracted and forgot to finish with
that patch, I wasn't setting bi_private either.

>
> A little way above the 'fixup the bio for reuse' comment you'll find:
>
> struct bio *sbio = r1_bio->bios[i];
> ....
> if (r1_bio->bios[i]->bi_end_io != end_sync_read)
> continue;
>
> which implies that if we don't 'continue', then sbio->bi_end_io ==
> end_sync_read.

Ahh. I remember reading that, but I missed that that was sbio that was
being checked.

>
> So I suspect you want to add
> sbio->bi_end_io = end_sync_read;
> somewhere after the 'bio_reset()'.
>
> If you happened to also fix that 'if' that I quoted so that it reads:
>
> if (sbio->bi_end_io != end_sync_read)
> continue;

Will do! How's this look?


commit 40a4645a4346edd040066baedcf2184ac4211ba7
Author: Kent Overstreet <koverstreet@google.com>
Date: Tue Sep 11 11:26:12 2012 -0700

raid1: use bio_reset()

Signed-off-by: Kent Overstreet <koverstreet@google.com>
CC: Jens Axboe <axboe@kernel.dk>
CC: NeilBrown <neilb@suse.de>

diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c
index ee85154..df68691 100644
--- a/drivers/md/raid1.c
+++ b/drivers/md/raid1.c
@@ -1851,7 +1851,7 @@ static int process_checks(struct r1bio *r1_bio)
struct bio *sbio = r1_bio->bios[i];
int size;

- if (r1_bio->bios[i]->bi_end_io != end_sync_read)
+ if (sbio->bi_end_io != end_sync_read)
continue;

if (test_bit(BIO_UPTODATE, &sbio->bi_flags)) {
@@ -1876,16 +1876,15 @@ static int process_checks(struct r1bio *r1_bio)
continue;
}
/* fixup the bio for reuse */
+ bio_reset(sbio);
sbio->bi_vcnt = vcnt;
sbio->bi_size = r1_bio->sectors << 9;
- sbio->bi_idx = 0;
- sbio->bi_phys_segments = 0;
- sbio->bi_flags &= ~(BIO_POOL_MASK - 1);
- sbio->bi_flags |= 1 << BIO_UPTODATE;
- sbio->bi_next = NULL;
sbio->bi_sector = r1_bio->sector +
conf->mirrors[i].rdev->data_offset;
sbio->bi_bdev = conf->mirrors[i].rdev->bdev;
+ sbio->bi_end_io = end_sync_read;
+ sbio->bi_private = r1_bio;
+
size = sbio->bi_size;
for (j = 0; j < vcnt ; j++) {
struct bio_vec *bi;
@@ -2426,18 +2425,7 @@ static sector_t sync_request(struct mddev *mddev, sector_t sector_nr, int *skipp
for (i = 0; i < conf->raid_disks * 2; i++) {
struct md_rdev *rdev;
bio = r1_bio->bios[i];
-
- /* take from bio_init */
- bio->bi_next = NULL;
- bio->bi_flags &= ~(BIO_POOL_MASK-1);
- bio->bi_flags |= 1 << BIO_UPTODATE;
- bio->bi_rw = READ;
- bio->bi_vcnt = 0;
- bio->bi_idx = 0;
- bio->bi_phys_segments = 0;
- bio->bi_size = 0;
- bio->bi_end_io = NULL;
- bio->bi_private = NULL;
+ bio_reset(bio);

rdev = rcu_dereference(conf->mirrors[i].rdev);
if (rdev == NULL ||

--
dm-devel mailing list
dm-devel@redhat.com
https://www.redhat.com/mailman/listinfo/dm-devel
 
Old 09-11-2012, 09:17 PM
NeilBrown
 
Default raid1: use bio_reset()

On Tue, 11 Sep 2012 11:28:25 -0700 Kent Overstreet <koverstreet@google.com>
wrote:

> On Tue, Sep 11, 2012 at 02:59:13PM +1000, NeilBrown wrote:
> > On Mon, 10 Sep 2012 17:22:23 -0700 Kent Overstreet <koverstreet@google.com>
> > wrote:
> >
> > > I couldn't figure out what sbio->bi_end_io in process_checks() was
> > > supposed to be, so I took the easy way out.
> >
> > Almost.
> > You save 'sbio->bi_end_io' to 'bi_end_io', then do nothing with it...
>
> Whoops I think I must've gotten distracted and forgot to finish with
> that patch, I wasn't setting bi_private either.
>
> >
> > A little way above the 'fixup the bio for reuse' comment you'll find:
> >
> > struct bio *sbio = r1_bio->bios[i];
> > ....
> > if (r1_bio->bios[i]->bi_end_io != end_sync_read)
> > continue;
> >
> > which implies that if we don't 'continue', then sbio->bi_end_io ==
> > end_sync_read.
>
> Ahh. I remember reading that, but I missed that that was sbio that was
> being checked.
>
> >
> > So I suspect you want to add
> > sbio->bi_end_io = end_sync_read;
> > somewhere after the 'bio_reset()'.
> >
> > If you happened to also fix that 'if' that I quoted so that it reads:
> >
> > if (sbio->bi_end_io != end_sync_read)
> > continue;
>
> Will do! How's this look?

Looks good.

Acked-by: NeilBrown <neilb@suse.de>

NeilBrown


>
>
> commit 40a4645a4346edd040066baedcf2184ac4211ba7
> Author: Kent Overstreet <koverstreet@google.com>
> Date: Tue Sep 11 11:26:12 2012 -0700
>
> raid1: use bio_reset()
>
> Signed-off-by: Kent Overstreet <koverstreet@google.com>
> CC: Jens Axboe <axboe@kernel.dk>
> CC: NeilBrown <neilb@suse.de>
>
> diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c
> index ee85154..df68691 100644
> --- a/drivers/md/raid1.c
> +++ b/drivers/md/raid1.c
> @@ -1851,7 +1851,7 @@ static int process_checks(struct r1bio *r1_bio)
> struct bio *sbio = r1_bio->bios[i];
> int size;
>
> - if (r1_bio->bios[i]->bi_end_io != end_sync_read)
> + if (sbio->bi_end_io != end_sync_read)
> continue;
>
> if (test_bit(BIO_UPTODATE, &sbio->bi_flags)) {
> @@ -1876,16 +1876,15 @@ static int process_checks(struct r1bio *r1_bio)
> continue;
> }
> /* fixup the bio for reuse */
> + bio_reset(sbio);
> sbio->bi_vcnt = vcnt;
> sbio->bi_size = r1_bio->sectors << 9;
> - sbio->bi_idx = 0;
> - sbio->bi_phys_segments = 0;
> - sbio->bi_flags &= ~(BIO_POOL_MASK - 1);
> - sbio->bi_flags |= 1 << BIO_UPTODATE;
> - sbio->bi_next = NULL;
> sbio->bi_sector = r1_bio->sector +
> conf->mirrors[i].rdev->data_offset;
> sbio->bi_bdev = conf->mirrors[i].rdev->bdev;
> + sbio->bi_end_io = end_sync_read;
> + sbio->bi_private = r1_bio;
> +
> size = sbio->bi_size;
> for (j = 0; j < vcnt ; j++) {
> struct bio_vec *bi;
> @@ -2426,18 +2425,7 @@ static sector_t sync_request(struct mddev *mddev, sector_t sector_nr, int *skipp
> for (i = 0; i < conf->raid_disks * 2; i++) {
> struct md_rdev *rdev;
> bio = r1_bio->bios[i];
> -
> - /* take from bio_init */
> - bio->bi_next = NULL;
> - bio->bi_flags &= ~(BIO_POOL_MASK-1);
> - bio->bi_flags |= 1 << BIO_UPTODATE;
> - bio->bi_rw = READ;
> - bio->bi_vcnt = 0;
> - bio->bi_idx = 0;
> - bio->bi_phys_segments = 0;
> - bio->bi_size = 0;
> - bio->bi_end_io = NULL;
> - bio->bi_private = NULL;
> + bio_reset(bio);
>
> rdev = rcu_dereference(conf->mirrors[i].rdev);
> if (rdev == NULL ||

--
dm-devel mailing list
dm-devel@redhat.com
https://www.redhat.com/mailman/listinfo/dm-devel
 
Old 09-24-2012, 10:34 PM
Kent Overstreet
 
Default raid1: use bio_reset()

Signed-off-by: Kent Overstreet <koverstreet@google.com>
CC: Jens Axboe <axboe@kernel.dk>
CC: NeilBrown <neilb@suse.de>
---
drivers/md/raid1.c | 24 ++++++------------------
1 file changed, 6 insertions(+), 18 deletions(-)

diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c
index 28f506a..4614b9e 100644
--- a/drivers/md/raid1.c
+++ b/drivers/md/raid1.c
@@ -1851,7 +1851,7 @@ static int process_checks(struct r1bio *r1_bio)
struct bio *sbio = r1_bio->bios[i];
int size;

- if (r1_bio->bios[i]->bi_end_io != end_sync_read)
+ if (sbio->bi_end_io != end_sync_read)
continue;

if (test_bit(BIO_UPTODATE, &sbio->bi_flags)) {
@@ -1876,16 +1876,15 @@ static int process_checks(struct r1bio *r1_bio)
continue;
}
/* fixup the bio for reuse */
+ bio_reset(sbio);
sbio->bi_vcnt = vcnt;
sbio->bi_size = r1_bio->sectors << 9;
- sbio->bi_idx = 0;
- sbio->bi_phys_segments = 0;
- sbio->bi_flags &= ~(BIO_POOL_MASK - 1);
- sbio->bi_flags |= 1 << BIO_UPTODATE;
- sbio->bi_next = NULL;
sbio->bi_sector = r1_bio->sector +
conf->mirrors[i].rdev->data_offset;
sbio->bi_bdev = conf->mirrors[i].rdev->bdev;
+ sbio->bi_end_io = end_sync_read;
+ sbio->bi_private = r1_bio;
+
size = sbio->bi_size;
for (j = 0; j < vcnt ; j++) {
struct bio_vec *bi;
@@ -2426,18 +2425,7 @@ static sector_t sync_request(struct mddev *mddev, sector_t sector_nr, int *skipp
for (i = 0; i < conf->raid_disks * 2; i++) {
struct md_rdev *rdev;
bio = r1_bio->bios[i];
-
- /* take from bio_init */
- bio->bi_next = NULL;
- bio->bi_flags &= ~(BIO_POOL_MASK-1);
- bio->bi_flags |= 1 << BIO_UPTODATE;
- bio->bi_rw = READ;
- bio->bi_vcnt = 0;
- bio->bi_idx = 0;
- bio->bi_phys_segments = 0;
- bio->bi_size = 0;
- bio->bi_end_io = NULL;
- bio->bi_private = NULL;
+ bio_reset(bio);

rdev = rcu_dereference(conf->mirrors[i].rdev);
if (rdev == NULL ||
--
1.7.12

--
dm-devel mailing list
dm-devel@redhat.com
https://www.redhat.com/mailman/listinfo/dm-devel
 
Old 10-15-2012, 08:08 PM
Kent Overstreet
 
Default raid1: use bio_reset()

Signed-off-by: Kent Overstreet <koverstreet@google.com>
CC: Jens Axboe <axboe@kernel.dk>
CC: NeilBrown <neilb@suse.de>
---
drivers/md/raid1.c | 24 ++++++------------------
1 file changed, 6 insertions(+), 18 deletions(-)

diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c
index 28f506a..4614b9e 100644
--- a/drivers/md/raid1.c
+++ b/drivers/md/raid1.c
@@ -1851,7 +1851,7 @@ static int process_checks(struct r1bio *r1_bio)
struct bio *sbio = r1_bio->bios[i];
int size;

- if (r1_bio->bios[i]->bi_end_io != end_sync_read)
+ if (sbio->bi_end_io != end_sync_read)
continue;

if (test_bit(BIO_UPTODATE, &sbio->bi_flags)) {
@@ -1876,16 +1876,15 @@ static int process_checks(struct r1bio *r1_bio)
continue;
}
/* fixup the bio for reuse */
+ bio_reset(sbio);
sbio->bi_vcnt = vcnt;
sbio->bi_size = r1_bio->sectors << 9;
- sbio->bi_idx = 0;
- sbio->bi_phys_segments = 0;
- sbio->bi_flags &= ~(BIO_POOL_MASK - 1);
- sbio->bi_flags |= 1 << BIO_UPTODATE;
- sbio->bi_next = NULL;
sbio->bi_sector = r1_bio->sector +
conf->mirrors[i].rdev->data_offset;
sbio->bi_bdev = conf->mirrors[i].rdev->bdev;
+ sbio->bi_end_io = end_sync_read;
+ sbio->bi_private = r1_bio;
+
size = sbio->bi_size;
for (j = 0; j < vcnt ; j++) {
struct bio_vec *bi;
@@ -2426,18 +2425,7 @@ static sector_t sync_request(struct mddev *mddev, sector_t sector_nr, int *skipp
for (i = 0; i < conf->raid_disks * 2; i++) {
struct md_rdev *rdev;
bio = r1_bio->bios[i];
-
- /* take from bio_init */
- bio->bi_next = NULL;
- bio->bi_flags &= ~(BIO_POOL_MASK-1);
- bio->bi_flags |= 1 << BIO_UPTODATE;
- bio->bi_rw = READ;
- bio->bi_vcnt = 0;
- bio->bi_idx = 0;
- bio->bi_phys_segments = 0;
- bio->bi_size = 0;
- bio->bi_end_io = NULL;
- bio->bi_private = NULL;
+ bio_reset(bio);

rdev = rcu_dereference(conf->mirrors[i].rdev);
if (rdev == NULL ||
--
1.7.12

--
dm-devel mailing list
dm-devel@redhat.com
https://www.redhat.com/mailman/listinfo/dm-devel
 
Old 10-15-2012, 08:09 PM
Kent Overstreet
 
Default raid1: use bio_reset()

I couldn't figure out what sbio->bi_end_io in process_checks() was
supposed to be, so I took the easy way out.

Signed-off-by: Kent Overstreet <koverstreet@google.com>
CC: Jens Axboe <axboe@kernel.dk>
CC: NeilBrown <neilb@suse.de>
---
drivers/md/raid1.c | 22 +++++-----------------
1 file changed, 5 insertions(+), 17 deletions(-)

diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c
index ee85154..bd3e3b9 100644
--- a/drivers/md/raid1.c
+++ b/drivers/md/raid1.c
@@ -1835,6 +1835,7 @@ static int process_checks(struct r1bio *r1_bio)
int primary;
int i;
int vcnt;
+ bio_end_io_t *bi_end_io;

for (primary = 0; primary < conf->raid_disks * 2; primary++)
if (r1_bio->bios[primary]->bi_end_io == end_sync_read &&
@@ -1876,13 +1877,11 @@ static int process_checks(struct r1bio *r1_bio)
continue;
}
/* fixup the bio for reuse */
+ bi_end_io = sbio->bi_end_io;
+ bio_reset(sbio);
+
sbio->bi_vcnt = vcnt;
sbio->bi_size = r1_bio->sectors << 9;
- sbio->bi_idx = 0;
- sbio->bi_phys_segments = 0;
- sbio->bi_flags &= ~(BIO_POOL_MASK - 1);
- sbio->bi_flags |= 1 << BIO_UPTODATE;
- sbio->bi_next = NULL;
sbio->bi_sector = r1_bio->sector +
conf->mirrors[i].rdev->data_offset;
sbio->bi_bdev = conf->mirrors[i].rdev->bdev;
@@ -2426,18 +2425,7 @@ static sector_t sync_request(struct mddev *mddev, sector_t sector_nr, int *skipp
for (i = 0; i < conf->raid_disks * 2; i++) {
struct md_rdev *rdev;
bio = r1_bio->bios[i];
-
- /* take from bio_init */
- bio->bi_next = NULL;
- bio->bi_flags &= ~(BIO_POOL_MASK-1);
- bio->bi_flags |= 1 << BIO_UPTODATE;
- bio->bi_rw = READ;
- bio->bi_vcnt = 0;
- bio->bi_idx = 0;
- bio->bi_phys_segments = 0;
- bio->bi_size = 0;
- bio->bi_end_io = NULL;
- bio->bi_private = NULL;
+ bio_reset(bio);

rdev = rcu_dereference(conf->mirrors[i].rdev);
if (rdev == NULL ||
--
1.7.12

--
dm-devel mailing list
dm-devel@redhat.com
https://www.redhat.com/mailman/listinfo/dm-devel
 

Thread Tools




All times are GMT. The time now is 01:43 PM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org