Received: by 2002:a05:7412:b995:b0:f9:9502:5bb8 with SMTP id it21csp7674581rdb; Thu, 4 Jan 2024 04:23:38 -0800 (PST) X-Google-Smtp-Source: AGHT+IExsrmHiigSBtm6Y4RbsRCW9Wld9p1BJ4lhRS6R6mGUcc44mifwukc+ZamMdtvN/Sd8oOmb X-Received: by 2002:a05:600c:829:b0:40d:91a2:7115 with SMTP id k41-20020a05600c082900b0040d91a27115mr359335wmp.59.1704371018243; Thu, 04 Jan 2024 04:23:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704371018; cv=none; d=google.com; s=arc-20160816; b=Bzmm1+eum0wWGseX4wqrp7pE5eGMdSApe7lNCthEoCKWiJrx0BT6AE+PTX2BfDP4+C cQPfDojimbSG1uqu/Yiw0sSQdwCmZXlzO7f9rrMnt48IQdjt0q/I0k3hjxXWjNO64WaC EjVPYo6n0V1sp3GoDPnkMgCQLDHg+t+hJQeFxiVWcGI2/+cYEXOftFAxga6N9h/6ovIE sDvxivAVzZBAfkqtTlGSf42fxVtWmak4emZL9RDT59CNek7ji65777X06aZKuuRzaWXH jGYtPapKFjD7W2/jqYpSvRW8OI4NMouNx9ZR/xz4jzzHIchaXtNHlkJwvlOrzBlTUqVl jMvg== 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=RyJJ/RuAoDHhRuhXmZWId4dFH7gXR3rw1PTDSjr51CA=; fh=eph8YHeYyUVM7KfVPQx3s5ySkRxEhXZW+S8ERMulH2w=; b=UKEsATTH0Z1VqMhzeF/CcwtGfmywUXFIMdzudK47+h4MZgw7RpsvIGwV2VEfulJlkX 2xnBb2WE4otSM6MnRfkNc4wsNPHJrdbPDMRzyWFCQe367UQ0GxuoNWpZ08n831MyM5e3 N9xBBqRueDLRtw2utrhNHUfFU7PtKPRUAEHPjoYM6+eYpiGgGqL6/ogukkaSdJQbTaNE S3Lj77x37glXyI7e8NyCVCuR75KI0W5tzzBQ03XLKE7TP1RfKaFql5ZFicRQ+uXQpcPB EkcyFhRq4z8vfGpXoC/aislOm/OYnONIOilik+EUXoYkNT+jYRXt/IO6ZEsyhXd7PBlJ PTEQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-ext4+bounces-687-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-ext4+bounces-687-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id mf1-20020a1709071a4100b00a26ebca86b3si8702577ejc.806.2024.01.04.04.23.38 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Jan 2024 04:23:38 -0800 (PST) Received-SPF: pass (google.com: domain of linux-ext4+bounces-687-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-ext4+bounces-687-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-ext4+bounces-687-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 am.mirrors.kernel.org (Postfix) with ESMTPS id 054CF1F251E6 for ; Thu, 4 Jan 2024 12:23:38 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id F05972233C; Thu, 4 Jan 2024 12:22:43 +0000 (UTC) X-Original-To: linux-ext4@vger.kernel.org Received: from dggsgout11.his.huawei.com (unknown [45.249.212.51]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0ED19219F6; Thu, 4 Jan 2024 12:22:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=huaweicloud.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=huaweicloud.com Received: from mail.maildlp.com (unknown [172.19.163.235]) by dggsgout11.his.huawei.com (SkyGuard) with ESMTP id 4T5QhW3W54z4f3jJK; Thu, 4 Jan 2024 20:22:35 +0800 (CST) Received: from mail02.huawei.com (unknown [10.116.40.112]) by mail.maildlp.com (Postfix) with ESMTP id 3AB871A097E; Thu, 4 Jan 2024 20:22:37 +0800 (CST) Received: from [10.174.176.73] (unknown [10.174.176.73]) by APP1 (Coremail) with SMTP id cCh0CgAXZgwKo5ZlregEFg--.33832S3; Thu, 04 Jan 2024 20:22:36 +0800 (CST) Subject: Re: [PATCH RFC v3 for-6.8/block 04/17] mtd: block2mtd: use bdev apis 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, jack@suse.com, konishi.ryusuke@gmail.com, willy@infradead.org, akpm@linux-foundation.org, hare@suse.de, p.raghav@samsung.com, 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, linux-nilfs@vger.kernel.org, yi.zhang@huawei.com, yangerkun@huawei.com, "yukuai (C)" References: <20231221085712.1766333-1-yukuai1@huaweicloud.com> <20231221085712.1766333-5-yukuai1@huaweicloud.com> <20240104112855.uci45hhqaiitmsir@quack3> From: Yu Kuai Message-ID: Date: Thu, 4 Jan 2024 20:22:34 +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: <20240104112855.uci45hhqaiitmsir@quack3> Content-Type: text/plain; charset=gbk; format=flowed Content-Transfer-Encoding: 8bit X-CM-TRANSID:cCh0CgAXZgwKo5ZlregEFg--.33832S3 X-Coremail-Antispam: 1UD129KBjvJXoW7CFWUCFyfWw48WrW7Wr1ftFb_yoW8JFWUpF WIk3Z5Ars0ywnrCrs2q3ZrZF1xKasxXayxJ3W3Gw1rAF15WryfKr1fC34kCw4IkF18ArWv 9F4jyF1ku3Z8KrDanT9S1TB71UUUUUUqnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDU0xBIdaVrnRJUUU9214x267AKxVWrJVCq3wAFc2x0x2IEx4CE42xK8VAvwI8IcIk0 rVWrJVCq3wAFIxvE14AKwVWUJVWUGwA2ocxC64kIII0Yj41l84x0c7CEw4AK67xGY2AK02 1l84ACjcxK6xIIjxv20xvE14v26w1j6s0DM28EF7xvwVC0I7IYx2IY6xkF7I0E14v26r4U JVWxJr1l84ACjcxK6I8E87Iv67AKxVW0oVCq3wA2z4x0Y4vEx4A2jsIEc7CjxVAFwI0_Gc CE3s1le2I262IYc4CY6c8Ij28IcVAaY2xG8wAqx4xG64xvF2IEw4CE5I8CrVC2j2WlYx0E 2Ix0cI8IcVAFwI0_JrI_JrylYx0Ex4A2jsIE14v26r1j6r4UMcvjeVCFs4IE7xkEbVWUJV W8JwACjcxG0xvEwIxGrwACjI8F5VA0II8E6IAqYI8I648v4I1lFIxGxcIEc7CjxVA2Y2ka 0xkIwI1lc7I2V7IY0VAS07AlzVAYIcxG8wCF04k20xvY0x0EwIxGrwCFx2IqxVCFs4IE7x kEbVWUJVW8JwC20s026c02F40E14v26r1j6r18MI8I3I0E7480Y4vE14v26r106r1rMI8E 67AF67kF1VAFwI0_Wrv_Gr1UMIIYrxkI7VAKI48JMIIF0xvE2Ix0cI8IcVAFwI0_Jr0_JF 4lIxAIcVC0I7IYx2IY6xkF7I0E14v26F4j6r4UJwCI42IY6xAIw20EY4v20xvaj40_Zr0_ Wr1UMIIF0xvEx4A2jsIE14v26r1j6r4UMIIF0xvEx4A2jsIEc7CjxVAFwI0_Gr0_Gr1UYx BIdaVFxhVjvjDU0xZFpf9x0JUCXdbUUUUU= X-CM-SenderInfo: 51xn3trlr6x35dzhxuhorxvhhfrp/ Hi, ?? 2024/01/04 19:28, Jan Kara ะด??: > On Thu 21-12-23 16:56:59, Yu Kuai wrote: >> From: Yu Kuai >> >> On the one hand covert to use folio while reading bdev inode, on the >> other hand prevent to access bd_inode directly. >> >> Signed-off-by: Yu Kuai > ... >> + for (p = folio_address(folio); p < max; p++) >> if (*p != -1UL) { >> - lock_page(page); >> - memset(page_address(page), 0xff, PAGE_SIZE); >> - set_page_dirty(page); >> - unlock_page(page); >> - balance_dirty_pages_ratelimited(mapping); >> + folio_lock(folio); >> + memset(folio_address(folio), 0xff, >> + folio_size(folio)); >> + folio_mark_dirty(folio); >> + folio_unlock(folio); >> + bdev_balance_dirty_pages_ratelimited(bdev); > > Rather then creating this bdev_balance_dirty_pages_ratelimited() just for > MTD perhaps we can have here (and in other functions): > > ... > mapping = folio_mapping(folio); > folio_unlock(folio); > if (mapping) > balance_dirty_pages_ratelimited(mapping); > > What do you think? Because when we are working with the folios it is rather > natural to use their mapping for dirty balancing? I think this is a great idea! And bdev_balance_dirty_pages_ratelimited() can be removed as well. Thanks, Kuai > > Honza >