Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp4354889rdb; Mon, 11 Dec 2023 17:32:38 -0800 (PST) X-Google-Smtp-Source: AGHT+IHb9EzNHdeTKo84mbdrcKi7eVviCJYWkgNMEUZV9FRLlBuSZ5VEBS5Xiy+bHov9Vo0UW273 X-Received: by 2002:a05:6359:6a6:b0:170:406d:42e7 with SMTP id ei38-20020a05635906a600b00170406d42e7mr5730945rwb.39.1702344758575; Mon, 11 Dec 2023 17:32:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702344758; cv=none; d=google.com; s=arc-20160816; b=nyVNaFmwXR/MbM2kREICpcNCMmR0vEHJ6BYMZWx9VMrbniOVWoQuWL0eQbFztA+hbz rlkvTeTjr6M82MsyNrKr56pbUfCTZnFEZ7leEVlb+viv+ixjI6rla09GTlv4E/XK6ELM bbmDUHNyKGKIpzlAJCx7vQbjf3cGbLUicPn+QoLgGeBrLb3nB8HNy1P9nnK+09J+PgXk JgHzQDlH/4xhVgOIkPi3SrQNkjeAy6UaGdPjOxxDEJiuA5LI7Nw4quG/93I7vcHvx0zm QIpv4r+qFjcQX3FFZ9l9woAVk6Rp/12mIMTPU5dz9sO8HEiqkloTEvJWavFyoCavWmJX j1jw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:user-agent:date:message-id:from :references:cc:to:subject; bh=6lHNUCWZEJFF1inwyy+14ArNe/H0b7K8QHXs9qFysjU=; fh=BNUmRneZ7brB4gzl0hsKmkx6cT5M3MNSSWPMhxJwT+U=; b=dtWGJwCIeMtz8NPMvSqcjtlrx78clCR4FAuoQdiQAPLbY/ko0me+5acA/08jhXuJoG j5CdZDfSfWEhP45so3UWucRZXkP8aY0Uy0JOJ1RDcAx6mjmO8jvTyhkas6nMNg0b/iqL lV45Tz0daobG+UwLW4sAgdeL/KpDN4yCIo0IQIQdjORQ3VLSdpR6JDbscKxlMuCbXc2C kjoD6viQo0UQzUv+BQOENQt81r7Wko4tnS0sWUflEaWRUScjy7PxpinNXAvczmm14OS1 2gtPeU1ZpXDKSW1cU/FzaCxg9HUL70wXhKSuassCDlFvoEZeiVZB7fyXz2N4bxafXdXP cyjQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-ext4+bounces-385-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-ext4+bounces-385-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id o10-20020a17090ac70a00b0028a42f9d3e6si5748315pjt.168.2023.12.11.17.32.38 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Dec 2023 17:32:38 -0800 (PST) Received-SPF: pass (google.com: domain of linux-ext4+bounces-385-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-ext4+bounces-385-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-ext4+bounces-385-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 36CB92826BA for ; Tue, 12 Dec 2023 01:32:38 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 43AAD17E9; Tue, 12 Dec 2023 01:32:25 +0000 (UTC) X-Original-To: linux-ext4@vger.kernel.org Received: from dggsgout11.his.huawei.com (unknown [45.249.212.51]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 706BACE; Mon, 11 Dec 2023 17:32:21 -0800 (PST) Received: from mail.maildlp.com (unknown [172.19.163.235]) by dggsgout11.his.huawei.com (SkyGuard) with ESMTP id 4Sq1Lj3Z6Rz4f3lDc; Tue, 12 Dec 2023 09:32:13 +0800 (CST) Received: from mail02.huawei.com (unknown [10.116.40.112]) by mail.maildlp.com (Postfix) with ESMTP id 5C7FC1A0D83; Tue, 12 Dec 2023 09:32:18 +0800 (CST) Received: from [10.174.176.73] (unknown [10.174.176.73]) by APP1 (Coremail) with SMTP id cCh0CgCn9gwauHdlugyeDQ--.45656S3; Tue, 12 Dec 2023 09:32:13 +0800 (CST) Subject: Re: [PATCH RFC v2 for-6.8/block 15/18] buffer: add a new helper to read sb block To: Jan Kara , Yu Kuai Cc: axboe@kernel.dk, roger.pau@citrix.com, colyli@suse.de, kent.overstreet@gmail.com, joern@lazybastard.org, miquel.raynal@bootlin.com, richard@nod.at, vigneshr@ti.com, sth@linux.ibm.com, hoeppner@linux.ibm.com, hca@linux.ibm.com, gor@linux.ibm.com, agordeev@linux.ibm.com, jejb@linux.ibm.com, martin.petersen@oracle.com, clm@fb.com, josef@toxicpanda.com, dsterba@suse.com, viro@zeniv.linux.org.uk, brauner@kernel.org, nico@fluxnic.net, xiang@kernel.org, chao@kernel.org, tytso@mit.edu, adilger.kernel@dilger.ca, agruenba@redhat.com, jack@suse.com, konishi.ryusuke@gmail.com, willy@infradead.org, akpm@linux-foundation.org, p.raghav@samsung.com, hare@suse.de, linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, xen-devel@lists.xenproject.org, linux-bcache@vger.kernel.org, linux-mtd@lists.infradead.org, linux-s390@vger.kernel.org, linux-scsi@vger.kernel.org, linux-bcachefs@vger.kernel.org, linux-btrfs@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-erofs@lists.ozlabs.org, linux-ext4@vger.kernel.org, gfs2@lists.linux.dev, linux-nilfs@vger.kernel.org, yi.zhang@huawei.com, "yangerkun@huawei.com" , "yukuai (C)" References: <20231211140552.973290-1-yukuai1@huaweicloud.com> <20231211140753.975297-1-yukuai1@huaweicloud.com> <20231211172708.qpuk4rkwq4u2zbmj@quack3> From: Yu Kuai Message-ID: Date: Tue, 12 Dec 2023 09:32:10 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 Precedence: bulk X-Mailing-List: linux-ext4@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 In-Reply-To: <20231211172708.qpuk4rkwq4u2zbmj@quack3> Content-Type: text/plain; charset=gbk; format=flowed Content-Transfer-Encoding: 8bit X-CM-TRANSID:cCh0CgCn9gwauHdlugyeDQ--.45656S3 X-Coremail-Antispam: 1UD129KBjvJXoW7trWDZF4Dur4DWFWktF1xGrg_yoW8WF48pr ySkayakrZrAr1a9F12qw1rXFyrKa13G3WrCFyfJa4UAryagr13XrWxGF4UGFW3ZrnrAws8 Xa1FkayrZw15KFDanT9S1TB71UUUUUUqnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDU0xBIdaVrnRJUUU9q14x267AKxVWrJVCq3wAFc2x0x2IEx4CE42xK8VAvwI8IcIk0 rVWrJVCq3wAFIxvE14AKwVWUJVWUGwA2ocxC64kIII0Yj41l84x0c7CEw4AK67xGY2AK02 1l84ACjcxK6xIIjxv20xvE14v26F1j6w1UM28EF7xvwVC0I7IYx2IY6xkF7I0E14v26r4U JVWxJr1l84ACjcxK6I8E87Iv67AKxVW0oVCq3wA2z4x0Y4vEx4A2jsIEc7CjxVAFwI0_Gc CE3s1le2I262IYc4CY6c8Ij28IcVAaY2xG8wAqx4xG64xvF2IEw4CE5I8CrVC2j2WlYx0E 2Ix0cI8IcVAFwI0_JrI_JrylYx0Ex4A2jsIE14v26r1j6r4UMcvjeVCFs4IE7xkEbVWUJV W8JwACjcxG0xvEwIxGrwACjI8F5VA0II8E6IAqYI8I648v4I1lFIxGxcIEc7CjxVA2Y2ka 0xkIwI1lc7I2V7IY0VAS07AlzVAYIcxG8wCF04k20xvY0x0EwIxGrwCFx2IqxVCFs4IE7x kEbVWUJVW8JwC20s026c02F40E14v26r1j6r18MI8I3I0E7480Y4vE14v26r106r1rMI8E 67AF67kF1VAFwI0_Wrv_Gr1UMIIYrxkI7VAKI48JMIIF0xvE2Ix0cI8IcVAFwI0_Jr0_JF 4lIxAIcVC0I7IYx2IY6xkF7I0E14v26r4UJVWxJr1lIxAIcVCF04k26cxKx2IYs7xG6rWU JVWrZr1UMIIF0xvEx4A2jsIE14v26r1j6r4UMIIF0xvEx4A2jsIEc7CjxVAFwI0_Gr1j6F 4UJbIYCTnIWIevJa73UjIFyTuYvjfUFfHUDUUUU X-CM-SenderInfo: 51xn3trlr6x35dzhxuhorxvhhfrp/ Hi, ?? 2023/12/12 1:27, Jan Kara ะด??: > On Mon 11-12-23 22:07:53, Yu Kuai wrote: >> From: Yu Kuai >> >> Unlike __bread_gfp(), ext4 has special handing while reading sb block: >> >> 1) __GFP_NOFAIL is not set, and memory allocation can fail; >> 2) If buffer write failed before, set buffer uptodate and don't read >> block from disk; >> 3) REQ_META is set for all IO, and REQ_PRIO is set for reading xattr; >> 4) If failed, return error ptr instead of NULL; >> >> This patch add a new helper __bread_gfp2() that will match above 2 and 3( >> 1 will be used, and 4 will still be encapsulated by ext4), and prepare to >> prevent calling mapping_gfp_constraint() directly on bd_inode->i_mapping >> in ext4. >> >> Signed-off-by: Yu Kuai > ... >> +/* >> + * This works like __bread_gfp() except: >> + * 1) If buffer write failed before, set buffer uptodate and don't read >> + * block from disk; >> + * 2) Caller can pass in additional op_flags like REQ_META; >> + */ >> +struct buffer_head * >> +__bread_gfp2(struct block_device *bdev, sector_t block, unsigned int size, >> + blk_opf_t op_flags, gfp_t gfp) >> +{ >> + return bread_gfp(bdev, block, size, op_flags, gfp, true); >> +} >> +EXPORT_SYMBOL(__bread_gfp2); > > __bread_gfp2() is not a great name, why not just using bread_gfp() > directly? I'm not a huge fan of boolean arguments but three different flags > arguments would be too much for my taste ;) so I guess I can live with > that. I agree that __bread_gfp2 is not a greate name, if possible, I'll try to figure out a better name for v3. Thanks for reviewing this patchset! Kuai > > Honza >