Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756012AbbGGJEO (ORCPT ); Tue, 7 Jul 2015 05:04:14 -0400 Received: from mx1.redhat.com ([209.132.183.28]:41127 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755391AbbGGJEG (ORCPT ); Tue, 7 Jul 2015 05:04:06 -0400 Message-ID: <559B9601.9040507@redhat.com> Date: Tue, 07 Jul 2015 10:04:01 +0100 From: Steven Whitehouse User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.7.0 MIME-Version: 1.0 To: Ming Lin CC: lkml , Christoph Hellwig , Jens Axboe , Kent Overstreet , Dongsu Park , Mike Snitzer , Ming Lin Subject: Re: [PATCH v5 10/11] block: remove bio_get_nr_vecs() References: <1436168690-32102-1-git-send-email-mlin@kernel.org> <1436168690-32102-10-git-send-email-mlin@kernel.org> <559A5F5A.9020703@redhat.com> In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1947 Lines: 53 Hi, On 06/07/15 18:21, Ming Lin wrote: > On Mon, Jul 6, 2015 at 3:58 AM, Steven Whitehouse wrote: >> Hi, >> >> >> On 06/07/15 08:44, Ming Lin wrote: >>> From: Kent Overstreet >>> >>> We can always fill up the bio now, no need to estimate the possible >>> size based on queue parameters. >> [snip] >>> diff --git a/fs/gfs2/lops.c b/fs/gfs2/lops.c >>> index 2c1ae86..64d3116 100644 >>> --- a/fs/gfs2/lops.c >>> +++ b/fs/gfs2/lops.c >>> @@ -261,18 +261,11 @@ void gfs2_log_flush_bio(struct gfs2_sbd *sdp, int rw) >>> static struct bio *gfs2_log_alloc_bio(struct gfs2_sbd *sdp, u64 blkno) >>> { >>> struct super_block *sb = sdp->sd_vfs; >>> - unsigned nrvecs = bio_get_nr_vecs(sb->s_bdev); >>> struct bio *bio; >>> BUG_ON(sdp->sd_log_bio); >>> - while (1) { >>> - bio = bio_alloc(GFP_NOIO, nrvecs); >>> - if (likely(bio)) >>> - break; >>> - nrvecs = max(nrvecs/2, 1U); >>> - } >>> - >>> + bio = bio_alloc(GFP_NOIO, BIO_MAX_PAGES); >>> bio->bi_iter.bi_sector = blkno * (sb->s_blocksize >> 9); >>> bio->bi_bdev = sb->s_bdev; >>> bio->bi_end_io = gfs2_end_log_write; >> >> When I wrote this loop I understood that bio_alloc(GFP_NOIO, x) was only guaranteed to be successful in the case x = 1, and that for x > 1, it might return NULL. Does this now mean that for x = BIO_MAX_PAGES it will be guaranteed to never return NULL in this case? > Yes, it's guaranteed. > > https://lkml.org/lkml/2013/11/26/47 > > commit df2cb6daa4cbc Ok. Feel free to add: Acked-by: Steven Whitehouse Steve. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/