* [PATCH] ext4: remove loop around bio_alloc()
@ 2011-06-30 1:44 Theodore Ts'o
2011-06-30 2:12 ` Steven Liu
2011-06-30 2:15 ` Steven Liu
0 siblings, 2 replies; 4+ messages in thread
From: Theodore Ts'o @ 2011-06-30 1:44 UTC (permalink / raw)
To: Ext4 Developers List; +Cc: Theodore Ts'o
These days, bio_alloc() is guaranteed to never fail (as long as nvecs
is less than BIO_MAX_PAGES), so we don't need the loop around the
struct bio allocation.
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
---
fs/ext4/page-io.c | 6 +-----
1 files changed, 1 insertions(+), 5 deletions(-)
diff --git a/fs/ext4/page-io.c b/fs/ext4/page-io.c
index 7bb8f76..430c401 100644
--- a/fs/ext4/page-io.c
+++ b/fs/ext4/page-io.c
@@ -285,11 +285,7 @@ static int io_submit_init(struct ext4_io_submit *io,
io_end = ext4_init_io_end(inode, GFP_NOFS);
if (!io_end)
return -ENOMEM;
- do {
- bio = bio_alloc(GFP_NOIO, nvecs);
- nvecs >>= 1;
- } while (bio == NULL);
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] ext4: remove loop around bio_alloc()
2011-06-30 1:44 [PATCH] ext4: remove loop around bio_alloc() Theodore Ts'o
@ 2011-06-30 2:12 ` Steven Liu
2011-06-30 2:20 ` Ted Ts'o
2011-06-30 2:15 ` Steven Liu
1 sibling, 1 reply; 4+ messages in thread
From: Steven Liu @ 2011-06-30 2:12 UTC (permalink / raw)
To: Theodore Ts'o, linux-ext4
Hi Ted,
2011/6/30 Theodore Ts'o <tytso@mit.edu>:
> These days, bio_alloc() is guaranteed to never fail (as long as nvecs
> is less than BIO_MAX_PAGES), so we don't need the loop around the
> struct bio allocation.
>
> Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
> ---
> fs/ext4/page-io.c | 6 +-----
> 1 files changed, 1 insertions(+), 5 deletions(-)
>
> diff --git a/fs/ext4/page-io.c b/fs/ext4/page-io.c
> index 7bb8f76..430c401 100644
> --- a/fs/ext4/page-io.c
> +++ b/fs/ext4/page-io.c
> @@ -285,11 +285,7 @@ static int io_submit_init(struct ext4_io_submit *io,
> io_end = ext4_init_io_end(inode, GFP_NOFS);
> if (!io_end)
> return -ENOMEM;
> - do {
> - bio = bio_alloc(GFP_NOIO, nvecs);
> - nvecs >>= 1;
> - } while (bio == NULL);
> -
> + bio = bio_alloc(GFP_NOIO, min(nvecs, BIO_MAX_PAGES));
Is this needn't to check if bio_alloc success?
> bio->bi_sector = bh->b_blocknr * (bh->b_size >> 9);
> bio->bi_bdev = bh->b_bdev;
> bio->bi_private = io->io_end = io_end;
> --
> 1.7.4.1.22.gec8e1.dirty
>
> --
Asked-by: LiuQi <lingjiujianke@gmail.com>
--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" 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: [PATCH] ext4: remove loop around bio_alloc()
2011-06-30 1:44 [PATCH] ext4: remove loop around bio_alloc() Theodore Ts'o
2011-06-30 2:12 ` Steven Liu
@ 2011-06-30 2:15 ` Steven Liu
1 sibling, 0 replies; 4+ messages in thread
From: Steven Liu @ 2011-06-30 2:15 UTC (permalink / raw)
To: Theodore Ts'o; +Cc: Ext4 Developers List
2011/6/30 Theodore Ts'o <tytso@mit.edu>:
> These days, bio_alloc() is guaranteed to never fail (as long as nvecs
> is less than BIO_MAX_PAGES), so we don't need the loop around the
> struct bio allocation.
>
> Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
> ---
> fs/ext4/page-io.c | 6 +-----
> 1 files changed, 1 insertions(+), 5 deletions(-)
>
> diff --git a/fs/ext4/page-io.c b/fs/ext4/page-io.c
> index 7bb8f76..430c401 100644
> --- a/fs/ext4/page-io.c
> +++ b/fs/ext4/page-io.c
> @@ -285,11 +285,7 @@ static int io_submit_init(struct ext4_io_submit *io,
> io_end = ext4_init_io_end(inode, GFP_NOFS);
> if (!io_end)
> return -ENOMEM;
> - do {
> - bio = bio_alloc(GFP_NOIO, nvecs);
> - nvecs >>= 1;
> - } while (bio == NULL);
> -
> + bio = bio_alloc(GFP_NOIO, min(nvecs, BIO_MAX_PAGES));
I think , If this do not need to loop around the struct bio allocation
insurance, if it check allocation value and give the faild message,
maybe better. is it?
> bio->bi_sector = bh->b_blocknr * (bh->b_size >> 9);
> bio->bi_bdev = bh->b_bdev;
> bio->bi_private = io->io_end = io_end;
> --
> 1.7.4.1.22.gec8e1.dirty
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" 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: [PATCH] ext4: remove loop around bio_alloc()
2011-06-30 2:12 ` Steven Liu
@ 2011-06-30 2:20 ` Ted Ts'o
0 siblings, 0 replies; 4+ messages in thread
From: Ted Ts'o @ 2011-06-30 2:20 UTC (permalink / raw)
To: Steven Liu; +Cc: linux-ext4
On Thu, Jun 30, 2011 at 10:12:25AM +0800, Steven Liu wrote:
> > + bio = bio_alloc(GFP_NOIO, min(nvecs, BIO_MAX_PAGES));
> Is this needn't to check if bio_alloc success?
No, that was the point of this patch. See the commit description.
Also see the comment for bio_alloc() in fs/bio.c, and note that
the __GFP_WAIT bit is set in GFP_NOFS.
Regards,
- Ted
--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" 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
end of thread, other threads:[~2011-06-30 2:20 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-06-30 1:44 [PATCH] ext4: remove loop around bio_alloc() Theodore Ts'o
2011-06-30 2:12 ` Steven Liu
2011-06-30 2:20 ` Ted Ts'o
2011-06-30 2:15 ` Steven Liu
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).