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:   Sun, 8 Dec 2019 23:37:44 -0800
From:   Christoph Hellwig <hch@...radead.org>
To:     Coly Li <colyli@...e.de>
Cc:     Liang Chen <liangchen.linux@...il.com>, kent.overstreet@...il.com,
        linux-kernel@...r.kernel.org, linux-bcache@...r.kernel.org
Subject: Re: [PATCH 2/2] [PATCH] bcache: __write_super to handle page sizes
 other than 4k

On Fri, Dec 06, 2019 at 05:44:38PM +0800, Coly Li wrote:
> >  {
> > -	struct cache_sb *out = page_address(bio_first_page_all(bio));
> > +	struct cache_sb *out;
> >  	unsigned int i;
> > +	struct buffer_head *bh;
> > +
> > +	/*
> > +	 * The page is held since read_super, this __bread * should not
> > +	 * cause an extra io read.
> > +	 */
> > +	bh = __bread(bdev, 1, SB_SIZE);
> > +	if (!bh)
> > +		goto out_bh;
> > +
> > +	out = (struct cache_sb *) bh->b_data;
> 
> This is quite tricky here. Could you please to move this code piece into
> an inline function and add code comments to explain why a read is
> necessary for a write.

A read is not nessecary.  He only added it because he was too fearful
of calculating the data offset directly.  But calculating it directly
is almost trivial and should just be done here.  Alternatively if that
is still to hard just keep a pointer to the cache_sb around, which is
how most file systems do it.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ