Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp3897542ybl; Mon, 9 Dec 2019 01:53:55 -0800 (PST) X-Google-Smtp-Source: APXvYqyqZ7Cc3sAtIW1hl19NZaag2c+In1QpCYTyQldmR4/G/XIB/tMu87AWcn6hY3h1POIj9ZeL X-Received: by 2002:aca:54cc:: with SMTP id i195mr17614436oib.126.1575885235877; Mon, 09 Dec 2019 01:53:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1575885235; cv=none; d=google.com; s=arc-20160816; b=YQ4U7qo3vpwRc+Y4YN49AI5DDSSI+Rh6Q9b4Tplea/VG1GLUXxJquA5KejC3S38col EnEbODa/l0tufRbrPWgShJ6tIdw7l2dmln7qnEfi4xG2mOQPsP/Kptk6VfMJYOAY3lFC y4Pl3WG12iHaehC7HKz+ZW8J3y2JTiazCNEqTN5qkXEdayASK+TqN8uRHvKPYxLAZPV3 R4/8XxeCc1mxIKFGISkZmZnLWnBgqWVik+KL/fkw6DL/IFwgm5ApbzCa2Q81Eidu/0oE M0yB0Kwe9xfsO9vDf7xmyA0asvF5LLNSdLBeBPmrh4IpncaHhb1MW4OzUwPqhc4jdPVq hXsg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:organization:from:references:cc:to:subject; bh=zmhBlkY7XL1r2KrGPmteZ2uhB0kMANV0REFUJcuxb3g=; b=bGUaeXP95yiQTclg42McT2WadmDIQxebmaTkix/ZgrnFjI1/ByVNNgsTOqoqO+VIfI AufQJ8+ZJXjpTyzphCuONJm8/tSP5Rr7sAgScKj5jXYpy9JbI1YFbmTtoqpPOTQ4x2i6 jrhTfSjTQ0noRcZJWBG7VSSsm7DrQaBeLh0YUSrwloNgC7cK00g8gn7qSONExzJHaISh BsXpJ7a6A7YUSFKRaOYhZLwnTZ9KiZu7+P1FgASizNlJJEFe5c3u0tLsejZTlsxKo3Ii Cc7xuU5qvadkhx+2oMO4PC0Iko8Uuk6t7g+KPUxErRKZ70PNRMQeDejLzQjAkdn189pJ GjCw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c131si12071368oib.267.2019.12.09.01.53.45; Mon, 09 Dec 2019 01:53:55 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727208AbfLIJxB (ORCPT + 99 others); Mon, 9 Dec 2019 04:53:01 -0500 Received: from mx2.suse.de ([195.135.220.15]:56670 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1725994AbfLIJxA (ORCPT ); Mon, 9 Dec 2019 04:53:00 -0500 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id DB004B279; Mon, 9 Dec 2019 09:52:58 +0000 (UTC) Subject: Re: [PATCH 2/2] [PATCH] bcache: __write_super to handle page sizes other than 4k To: Christoph Hellwig Cc: Liang Chen , kent.overstreet@gmail.com, linux-kernel@vger.kernel.org, linux-bcache@vger.kernel.org References: <1575622543-22470-1-git-send-email-liangchen.linux@gmail.com> <1575622543-22470-2-git-send-email-liangchen.linux@gmail.com> <20191209073744.GB3852@infradead.org> From: Coly Li Organization: SUSE Labs Message-ID: Date: Mon, 9 Dec 2019 17:52:45 +0800 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:68.0) Gecko/20100101 Thunderbird/68.2.2 MIME-Version: 1.0 In-Reply-To: <20191209073744.GB3852@infradead.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2019/12/9 3:37 下午, Christoph Hellwig wrote: > 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. > Copied, if Liang does not have time to handle this as your suggestion, I will handle it. Thanks for the hint. -- Coly Li