lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Mon, 06 Jul 2015 11:58:34 +0100
From:	Steven Whitehouse <swhiteho@...hat.com>
To:	Ming Lin <mlin@...nel.org>, linux-kernel@...r.kernel.org
CC:	Christoph Hellwig <hch@....de>, Jens Axboe <axboe@...nel.dk>,
	Kent Overstreet <kent.overstreet@...il.com>,
	Dongsu Park <dpark@...teo.net>,
	Mike Snitzer <snitzer@...hat.com>,
	Ming Lin <ming.l@....samsung.com>
Subject: Re: [PATCH v5 10/11] block: remove bio_get_nr_vecs()

Hi,


On 06/07/15 08:44, Ming Lin wrote:
> From: Kent Overstreet <kent.overstreet@...il.com>
>
> 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?

Steve.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ