Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp2173753rdb; Thu, 7 Dec 2023 23:34:24 -0800 (PST) X-Google-Smtp-Source: AGHT+IHIptOqqa8MeamJSyk84hrbOZJpe1vRBG/+mRMO0o4w0O/wRnZttFjN5OiZPjlNEn63tBPw X-Received: by 2002:a05:6358:618e:b0:170:8e07:f367 with SMTP id w14-20020a056358618e00b001708e07f367mr1674894rww.27.1702020863992; Thu, 07 Dec 2023 23:34:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702020863; cv=none; d=google.com; s=arc-20160816; b=Y2QkztzFeofsF4QcVpCH09yWGjwYl9YVDuDjD94bc6K9cFc5kHtUNLwdb6XDIXsqo9 4kMJEbxGZynqZ/FCr1JnhwUx6RGth65hyxHbbvFETlm2Uvy0FyzIWaEKEofMiQxxGMQ9 9i+frj9Ptw29VluRtGMYRH5n/9N6lEPudwMAC9K0uAdd03SPRtgvFGTfk/9GlWDfBjo+ AbEHffdC5YqPJqR4hwtfkQ62Z1c0alX3v8e/+IdSiNi3zHnbVPqjV1XQXJ/NHW7SnGWt Mq0hJVosi5r2zrczJmAo6OhqDsPoOzuiNI06WoxQF7fgcilV48i66UO0W39J2VDp/r6M d0wA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:content-language:in-reply-to:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:user-agent:date :message-id:from:references:cc:to:subject; bh=We+OCkYQDljkQS64aFu0rUPxUA5Z7jX75dxg5vAQVeY=; fh=PmIUhFJGe4bgKOpONW0Kzs2ezb+QsDXyv+4jVPXSm+o=; b=0Hq0xfUxN49WxOTdoOB3DuIe3YtFlOwsl3Vx4MPUW5AsTbRKGDXsa6rFj6ulzbEtMU CAqy4hIMhzcecqhbNalwEbhcfyePor0KLs4Bp20+VWKePVzFrQORrJ35l8ZfIVWtiUtI F33t58fYc6vkjgc7ol05Ln9gaOihSfcdfEAIOjx+VXbvee3B5lNsxiokDlMPq6R/iZy4 DsyzTcE7C6Kx6fPP3vRKBEJfIu7N9od6JxuCISDLMRmU9s0x4FsnNeTklVlgZsSMZs+a NjqcJb6cf7XH4DMaV1SRGpkmKZVTn5ArCVAbKZGOmBSSd2Dc5VY6jzYNzoGeCL0Xy944 GSHw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-ext4+bounces-346-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-ext4+bounces-346-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id p22-20020a056a000b5600b006ce96e33e9esi1092338pfo.317.2023.12.07.23.34.23 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Dec 2023 23:34:23 -0800 (PST) Received-SPF: pass (google.com: domain of linux-ext4+bounces-346-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-ext4+bounces-346-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-ext4+bounces-346-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 sy.mirrors.kernel.org (Postfix) with ESMTPS id 0C81CB20EF5 for ; Fri, 8 Dec 2023 07:34:19 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 65E0D10790; Fri, 8 Dec 2023 07:34:07 +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 A1DCD1722; Thu, 7 Dec 2023 23:34:02 -0800 (PST) Received: from mail.maildlp.com (unknown [172.19.163.235]) by dggsgout11.his.huawei.com (SkyGuard) with ESMTP id 4SmjYv0DVqz4f3lD7; Fri, 8 Dec 2023 15:33:55 +0800 (CST) Received: from mail02.huawei.com (unknown [10.116.40.112]) by mail.maildlp.com (Postfix) with ESMTP id C775E1A09F4; Fri, 8 Dec 2023 15:33:59 +0800 (CST) Received: from [10.174.176.34] (unknown [10.174.176.34]) by APP1 (Coremail) with SMTP id cCh0CgDHyhDlxnJlkc9ADA--.40165S3; Fri, 08 Dec 2023 15:33:59 +0800 (CST) Subject: Re: [PATCH 13/14] iomap: map multiple blocks at a time To: Christoph Hellwig Cc: "Darrick J. Wong" , Chandan Babu R , Ritesh Harjani , Jens Axboe , Andreas Gruenbacher , Damien Le Moal , Naohiro Aota , Johannes Thumshirn , linux-xfs@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-block@vger.kernel.org, gfs2@lists.linux.dev, Christian Brauner , linux-ext4@vger.kernel.org, Theodore Ts'o References: <20231207072710.176093-1-hch@lst.de> <20231207072710.176093-14-hch@lst.de> <4e4a86a0-5681-210f-0c94-263126967082@huaweicloud.com> <20231207150311.GA18830@lst.de> From: Zhang Yi Message-ID: Date: Fri, 8 Dec 2023 15:33:57 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.12.0 Precedence: bulk X-Mailing-List: linux-ext4@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 In-Reply-To: <20231207150311.GA18830@lst.de> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-CM-TRANSID:cCh0CgDHyhDlxnJlkc9ADA--.40165S3 X-Coremail-Antispam: 1UD129KBjvJXoW7urW8tFW7JF1Dt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12/7 23:03, Christoph Hellwig wrote: > On Thu, Dec 07, 2023 at 09:39:44PM +0800, Zhang Yi wrote: >>> + do { >>> + unsigned map_len; >>> + >>> + error = wpc->ops->map_blocks(wpc, inode, pos); >>> + if (error) >>> + break; >>> + trace_iomap_writepage_map(inode, &wpc->iomap); >>> + >>> + map_len = min_t(u64, dirty_len, >>> + wpc->iomap.offset + wpc->iomap.length - pos); >>> + WARN_ON_ONCE(!folio->private && map_len < dirty_len); >> >> While I was debugging this series on ext4, I would suggest try to add map_len >> or dirty_len into this trace point could be more convenient. > > That does seem useful, but it means we need to have an entirely new > even class. Can I offload this to you for inclusion in your ext4 > series? :) > Sure, I'm glad to do it. >>> + case IOMAP_HOLE: >>> + break; >> >> BTW, I want to ask an unrelated question of this patch series. Do you >> agree with me to add a IOMAP_DELAYED case and re-dirty folio here? The >> background is that on ext4, jbd2 thread call ext4_normal_submit_inode_data_buffers() >> submit data blocks in data=ordered mode, but it can only submit mapped >> blocks, now we skip unmapped blocks and re-dirty folios in >> ext4_do_writepages()->mpage_prepare_extent_to_map()->..->ext4_bio_write_folio(). >> So we have to inherit this logic when convert to iomap, I suppose ext4's >> ->map_blocks() return IOMAP_DELALLOC for this case, and iomap do something >> like: >> >> + case IOMAP_DELALLOC: >> + iomap_set_range_dirty(folio, offset_in_folio(folio, pos), >> + map_len); >> + folio_redirty_for_writepage(wbc, folio); >> + break; > > I guess we could add it, but it feels pretty quirky to me, so it would at > least need a very big comment. > > But I think Ted mentioned a while ago that dropping the classic > data=ordered mode for ext4 might be a good idea eventually no that ext4 > can update the inode size at I/O completion time (Ted, correct me if > I'm wrong). If that's the case it might make sense to just drop the > ordered mode instead of adding these quirks to iomap. > Yeah, make sense, we could remove these quirks after ext4 drop data=ordered mode. For now, let me implement it according to this temporary method. Thanks, Yi.