Received: by 2002:a25:ef43:0:0:0:0:0 with SMTP id w3csp427002ybm; Thu, 28 May 2020 06:27:36 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwGtCHGvTuExa4Wi038XMP++puSYL7+ma/dUpVLSfwZ/nAqHKWw1ylXbijjjhxZgYTiWIuX X-Received: by 2002:a17:906:49da:: with SMTP id w26mr2936516ejv.548.1590672456541; Thu, 28 May 2020 06:27:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1590672456; cv=none; d=google.com; s=arc-20160816; b=PlgwnrjgL6dhWR/bb7cGQkKhOsnBz4pOEV6ezCB6J2MaCVxWl0uhV06RBGe1xdzGqp jt9RpUd1AXpDvtwcwfxKMPd+C6AZa6uwH57l1prFY+PZo07IzhRHg8c8uAm71Ft2IxWV e/C6pprFyAH077S6bByIuiviIjFcfTbQ1hQ2x6JBPtFgMRR2h15EM2i87EPfBx/7F5da QZxtS/CQKXTiWwyD+44mRffkA3vTsKjyyTWZlhp7Tuk8gLMVRAXFOtCFOfc120GqD27n oRkfWHBE/8F/t3tPp6KgU8MDtZNpbHAYkbvgvNmNhP8QBa+7VJGLOnmpP5Kc4N4sONSL SKzA== 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:from:references:cc:to:subject; bh=1A03BvA/TMgp3+GPS3S67FrZGA6z2cbu7WicHXorJ5E=; b=HNTLJvDuteRabABs2BSFryoV+wiVMIJ5Gwjq0Hjc4vtExUYoV5i528bu3IlFPoBjDY jdY4lIgQpmScdUemLbM2lfRACCNAeHzfoNNyZg/3eFmVhPW6vplV2ppSj+/dihC4zHgv A1VTdDEAjwY0pPmFO+cZk0llu0h9bTAtJ+z6vatjXvNBZCkvNb5cD2uBpi/wyDus36k1 GBp7UYQKDECs+k9VZN3FYSmRGcxydLHxLh4PxHG5mObd7ConPv+FK4npyHqodrMlyOGn H2ZN+NMfUlSxYWOJLfLIYLbQRlNQttcuQcRAJyD0/sy4Je45MVq3EoF77gU6GbZ8bgcb 0Ipg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id s7si3435292edq.256.2020.05.28.06.27.05; Thu, 28 May 2020 06:27:36 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2390369AbgE1NXd (ORCPT + 99 others); Thu, 28 May 2020 09:23:33 -0400 Received: from szxga05-in.huawei.com ([45.249.212.191]:5303 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S2390295AbgE1NXa (ORCPT ); Thu, 28 May 2020 09:23:30 -0400 Received: from DGGEMS402-HUB.china.huawei.com (unknown [172.30.72.59]) by Forcepoint Email with ESMTP id 8D23ECE5D4564FEC6464; Thu, 28 May 2020 21:23:26 +0800 (CST) Received: from [127.0.0.1] (10.166.215.198) by DGGEMS402-HUB.china.huawei.com (10.3.19.202) with Microsoft SMTP Server id 14.3.487.0; Thu, 28 May 2020 21:23:17 +0800 Subject: Re: [PATCH 02/10] fs: pick out ll_rw_one_block() helper function To: Christoph Hellwig CC: , , , , References: <20200526071754.33819-1-yi.zhang@huawei.com> <20200526071754.33819-3-yi.zhang@huawei.com> <20200528050757.GA14198@infradead.org> From: "zhangyi (F)" Message-ID: Date: Thu, 28 May 2020 21:23:16 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.3.0 MIME-Version: 1.0 In-Reply-To: <20200528050757.GA14198@infradead.org> Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: 7bit X-Originating-IP: [10.166.215.198] X-CFilter-Loop: Reflected Sender: linux-ext4-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org Hi, Christoph On 2020/5/28 13:07, Christoph Hellwig wrote: > On Tue, May 26, 2020 at 03:17:46PM +0800, zhangyi (F) wrote: >> Pick out ll_rw_one_block() helper function from ll_rw_block() for >> submitting one locked buffer for reading/writing. > > That should probably read factor out instead of pick out. > >> >> Signed-off-by: zhangyi (F) >> --- >> fs/buffer.c | 41 ++++++++++++++++++++++--------------- >> include/linux/buffer_head.h | 1 + >> 2 files changed, 26 insertions(+), 16 deletions(-) >> >> diff --git a/fs/buffer.c b/fs/buffer.c >> index a60f60396cfa..3a2226f88b2d 100644 >> --- a/fs/buffer.c >> +++ b/fs/buffer.c >> @@ -3081,6 +3081,29 @@ int submit_bh(int op, int op_flags, struct buffer_head *bh) >> } >> EXPORT_SYMBOL(submit_bh); >> >> +void ll_rw_one_block(int op, int op_flags, struct buffer_head *bh) >> +{ >> + BUG_ON(!buffer_locked(bh)); >> + >> + if (op == WRITE) { >> + if (test_clear_buffer_dirty(bh)) { >> + bh->b_end_io = end_buffer_write_sync; >> + get_bh(bh); >> + submit_bh(op, op_flags, bh); >> + return; >> + } >> + } else { >> + if (!buffer_uptodate(bh)) { >> + bh->b_end_io = end_buffer_read_sync; >> + get_bh(bh); >> + submit_bh(op, op_flags, bh); >> + return; >> + } >> + } >> + unlock_buffer(bh); >> +} >> +EXPORT_SYMBOL(ll_rw_one_block); > > I don't think you want separate read and write sides. In fact I'm not > sure you want the helper at all. At this point just open coding it > rather than adding more overhead to core code might be a better idea. > Yeah, what I want is only the read side, it's fine by me to open coding it. Thanks, Yi.