Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp3942925ybl; Mon, 9 Dec 2019 02:47:17 -0800 (PST) X-Google-Smtp-Source: APXvYqyFZ4NHtSGwdj6gv2hnJ7mXz5uPCkv25AXMj0oz8k3v2TjI2qODpEuZPIh0DNRNaMp7Sm2K X-Received: by 2002:aca:3ed5:: with SMTP id l204mr17144118oia.92.1575888437561; Mon, 09 Dec 2019 02:47:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1575888437; cv=none; d=google.com; s=arc-20160816; b=Ik6RmLM3AfH3kW6qScgHT8ktbdNb9a2fHg/4LiSlUiF1hySJjlizG5zsXGBLp7OXc5 OOT56rDaBK4s6cy2CIYTP+If/GTjMYgahQ/txC3359+e65kdV3rhwn51EhMiiXKeolqj chrr0rx1XNQyhfJ7hvGUSgSwB8h/oV1hTQsVqnafpY1u5nA0yoqG33hidGh62bnLS/cY 5ZS4II9++xwXIW/iHl2kiWXWioGstWqbbxvov5LsT4JhylMu4sGsIBe+cRuBs4DqG7tF L4HNw7341p8xYXyBI6EEn4TOGnQc22WHrYCMUBZNXOxcLURdfCZZDdxCDWEqbdzjYoM1 pH8g== 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:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=5wpZqct9zId1JMwIvIkTx98tJap0IvMG3KRrK6bEBDM=; b=AG1dh2D0wtEmoc5UocZjEsgZBmvH0QwO4wXv6Kv0qXa2euqQflkP9y2vnJHt+Frk7b XimVe2fIauzw7HtU4SU5YV+ameWTADqIqXosEFklp5fxAuEzbEl0vkxSLZdU4tQheBLA 0Y6YF2S/VfIj3jmhP8MFXJ2erhoaPII6iyLFBXbgrJloC1q4Ujogu3AE/eCUfjWVfGAA Iq+U2FETGZ2nBJW2RijKQcMTg45LOQw/ex+3L3EZY5460NM+U+IwndkNjSLmOZAOrG/k DsLNkc4XjTrrIcu+YQplAWUcV421cfrg9Mwx2jQUuY+yZhTn+T6ZI5Yu72Pj6N4e5SEX GgPg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=IEzijxr3; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p71si11253650oic.138.2019.12.09.02.47.05; Mon, 09 Dec 2019 02:47:17 -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; dkim=pass header.i=@gmail.com header.s=20161025 header.b=IEzijxr3; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727305AbfLIKVU (ORCPT + 99 others); Mon, 9 Dec 2019 05:21:20 -0500 Received: from mail-qk1-f194.google.com ([209.85.222.194]:39052 "EHLO mail-qk1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726377AbfLIKVU (ORCPT ); Mon, 9 Dec 2019 05:21:20 -0500 Received: by mail-qk1-f194.google.com with SMTP id c16so4132805qko.6; Mon, 09 Dec 2019 02:21:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=5wpZqct9zId1JMwIvIkTx98tJap0IvMG3KRrK6bEBDM=; b=IEzijxr3E1MusXczAG2YYKgDDebdtwecdNChK8m0OZEuPTczGvG/jF8TIAj6eRHJbn zGKRwTp/VOf6TQ4y52WYJZaFpC2mXgQTNWw/cQEdlOdzNkkuG3OkrE/taG3vtua5mPQx vzXPMmV9ks6Nu8rrxwjMFew9TrRekYdQyaS5uz9nvWnjyt0lNHOImUh5uWPYcCKqYr6O Ftvijxlneg7V9vTHmu3cGwn5idi4FUap9nZnjbartbHGqUgkBWWCm5lfdPe5mBZSolt2 KYajD2UnoEgw+wCTLOUGik1/3aob3g4MwpOJIbC76wuF/ZlEKrd+bhwdWVoIucJu+RK3 M8bQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=5wpZqct9zId1JMwIvIkTx98tJap0IvMG3KRrK6bEBDM=; b=VMyvf86C8yJG+xn7gWOOdzghPOXXf2mQK68UzoBFQFugfCHM7VVXVka1+3+gnhr4gN LjBoNNVfO0VUPgBL4X2RA0q1kWCrJpxX8SOHVuQJEw+Rmt/MHtdhVhOlKz2qnfU6tGqh XhdEyEEhMgCl7SRdjxfzLvTyR8BSNahiuluxZc/LLd2Bz3+bwcEMLo8ILaObiIrDWUrh oXP3dppHw6kMcd4uSidZz9sMKnQMAVkLKvtzepxbv/R/WK1Y12YK7XSRE8VggLteblAT pmxifBVhSzBBlAWHRNX1iT6wIkJ4fyXJnqulfvqKR0FQfIVbHJTbzkHSN46iS6PMF4zx J8kw== X-Gm-Message-State: APjAAAWUDsh12UFZWCB8705dCu2h7f25tduqg6xyFWVvh1dZXq+0HsgM HVWxj1rSm528lQ143QQtyxI4oVH0ubHXook9QWI= X-Received: by 2002:ae9:e30e:: with SMTP id v14mr25857560qkf.344.1575886878939; Mon, 09 Dec 2019 02:21:18 -0800 (PST) MIME-Version: 1.0 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> In-Reply-To: From: Liang C Date: Mon, 9 Dec 2019 18:21:07 +0800 Message-ID: Subject: Re: [PATCH 2/2] [PATCH] bcache: __write_super to handle page sizes other than 4k To: Coly Li Cc: Christoph Hellwig , Kent Overstreet , linux-kernel@vger.kernel.org, linux-bcache@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org No problem. I will change the patch to remove this extra read. Thanks. On Mon, Dec 9, 2019 at 5:52 PM Coly Li wrote: > > On 2019/12/9 3:37 =E4=B8=8B=E5=8D=88, Christoph Hellwig wrote: > > On Fri, Dec 06, 2019 at 05:44:38PM +0800, Coly Li wrote: > >>> { > >>> - struct cache_sb *out =3D 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 =3D __bread(bdev, 1, SB_SIZE); > >>> + if (!bh) > >>> + goto out_bh; > >>> + > >>> + out =3D (struct cache_sb *) bh->b_data; > >> > >> This is quite tricky here. Could you please to move this code piece in= to > >> 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