From: Nikanth Karthikesan <knikanth@suse.de>
To: Dave Chinner <david@fromorbit.com>
Cc: Christoph Hellwig <hch@infradead.org>,
xfs-masters@oss.sgi.com, xfs@oss.sgi.com,
Jens Axboe <jens.axboe@oracle.com>
Subject: [PATCH] xfs: fix xfs_alloc_ioend_bio code to try and get atleast a smaller bio
Date: Wed, 22 Apr 2009 12:15:17 +0530 [thread overview]
Message-ID: <200904221215.18335.knikanth@suse.de> (raw)
In-Reply-To: <20090420010237.GF16929@discord.disaster>
The intent of the code in xfs_alloc_ioend_bio() is that if we can't get a
large bio immediately, try a smaller one which is more likely to succeed when
we are under memory pressure. i.e. we will get IO moving faster than if we
waited for a maximally sized biovec to be allocated. But GFP_NOIO implies
__GFP_WAIT which would return only if it can allocate the bio. So the first
attempt to get a larger bio itself would return only after it succeeds, which
makes the logic useless.
Change it to try with GFP_NOWAIT for a bio. If not possible wait for it.
See http://oss.sgi.com/archives/xfs-masters/2009-04/msg00027.html for the
discussion.
Signed-off-by: Nikanth Karthikesan <knikanth@suse.de>
---
diff --git a/fs/xfs/linux-2.6/xfs_aops.c b/fs/xfs/linux-2.6/xfs_aops.c
index 7ec89fc..002ce7f 100644
--- a/fs/xfs/linux-2.6/xfs_aops.c
+++ b/fs/xfs/linux-2.6/xfs_aops.c
@@ -419,12 +419,15 @@ xfs_alloc_ioend_bio(
struct buffer_head *bh)
{
struct bio *bio;
- int nvecs = bio_get_nr_vecs(bh->b_bdev);
+ int nr_iovecs = bio_get_nr_vecs(bh->b_bdev);
+ int nvecs = nr_iovecs;
do {
- bio = bio_alloc(GFP_NOIO, nvecs);
- nvecs >>= 1;
- } while (!bio);
+ bio = bio_alloc(GFP_NOWAIT, nvecs);
+ } while (!bio && (nvecs >>= 1));
+
+ if (unlikely(!bio))
+ bio = bio_alloc(GFP_NOIO, nr_iovecs);
ASSERT(bio->bi_private == NULL);
bio->bi_sector = bh->b_blocknr * (bh->b_size >> 9);
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
prev parent reply other threads:[~2009-04-22 6:47 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-04-15 10:39 [RESEND][PATCH 6/7] xfs: Remove code handling bio_alloc failure with __GFP_WAIT Nikanth Karthikesan
2009-04-20 1:02 ` [xfs-masters] " Dave Chinner
2009-04-20 8:23 ` Nikanth Karthikesan
2009-04-22 6:45 ` Nikanth Karthikesan [this message]
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=200904221215.18335.knikanth@suse.de \
--to=knikanth@suse.de \
--cc=david@fromorbit.com \
--cc=hch@infradead.org \
--cc=jens.axboe@oracle.com \
--cc=xfs-masters@oss.sgi.com \
--cc=xfs@oss.sgi.com \
/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