From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.2 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6F40BC43603 for ; Mon, 9 Dec 2019 09:53:02 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 4AD7C24683 for ; Mon, 9 Dec 2019 09:53:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727283AbfLIJxB (ORCPT ); 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