Received: by 2002:ab2:6991:0:b0:1f7:f6c3:9cb1 with SMTP id v17csp1058773lqo; Thu, 9 May 2024 03:41:05 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXOup1JYHh9oX24pwkvzZ2rzDREd08f1Y7H6FIFfXkeHsLwmsQ0ML5tD7cPCEzP4d9kN15rCaJHtiXOhxWiUuMD46h6DMJXq4TX8gSLiQ== X-Google-Smtp-Source: AGHT+IHVu9YVen+BjpHjzsLQ9WzPP7ScQ4gNkIofDe19+mASsGkL3ayKHov4C/xHwFJLQ26kWnM6 X-Received: by 2002:a05:6214:1786:b0:6a0:e7d8:4adb with SMTP id 6a1803df08f44-6a15cc805d6mr35851336d6.26.1715251265528; Thu, 09 May 2024 03:41:05 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1715251265; cv=pass; d=google.com; s=arc-20160816; b=1IBiEUf7uad+66i/o3YKuOxF9fs0tIprlPp51ur9w7SQZdl25LHxZrdSH7GMHfPoLO uDNqZgxd0wg2N1uEePuraMegdR/lH3xhetni0MIrDQQvsveGRXElExn09+2aGRRvr7bf kJVYDkQuE65xxYgRrKS6RxjRLrOnAksqlSwvZaxI+auNRaHhCL3txPUR8cL3vOKuwk1Z x0ipd8l9tprxuaQ6vdv7ZELvh0MWpAJMqbaqiNlTPmSFQpR0InxciJcpiBJidIXL0kSl bOkXoI00LauQMPzRisOA9/KUXkTFjtsRu/bR1Pvy0tN1DLhyksgf6vqTx7vJymKxXtvf reTQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature:dkim-signature:dkim-signature :dkim-signature; bh=22XtW7WxCKcNM6SFn+k2/G0UhW7ZtL6Ugs4+UbmPn8s=; fh=BgSvWty9HnKdgPfFKvzJe8vj2spEvZC5Z6XyPDF1Avs=; b=mXlG3MoF+SjA/VKJLz2DA5clPub8pvuMw3C8EsI21pPwJrzw3hKwetRj6lEY2mz+ec 2syLOnsANFzLL2a9G57p3aOv3I6JS4PBBQ3Sus3iA7hLQoMPkBICAPSkLdBjNkJuxoDz 46o8O3KE6ReunI2DKIlMcbLoHhtHAuTi+x9e4SQDknH5AC5liYSLdMgAERWgsG2JaFiZ NISSyh5HccBpa9lyLaQBtctHFZ30czlDC/9tDVdIuWyyATAr03/MUhQ65m9Y8DNZW3PV MQ6vdNY3pDfLl4BiCgW65uAJyehK8+fwhnDM3kdNHdo5mCXpBbg7B6a1rmJj0QfWfUuR B/XQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b=DoSqUxQ9; dkim=neutral (no key) header.i=@suse.cz header.s=susede2_ed25519; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b=kKhgX2dG; dkim=neutral (no key) header.i=@suse.cz header.s=susede2_ed25519 header.b=UkBjvTDO; arc=pass (i=1 spf=pass spfdomain=suse.cz dkim=pass dkdomain=suse.cz dkim=pass dkdomain=suse.cz); spf=pass (google.com: domain of linux-ext4+bounces-2410-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-ext4+bounces-2410-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id 6a1803df08f44-6a15f2eef8esi11490076d6.482.2024.05.09.03.41.05 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 May 2024 03:41:05 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-ext4+bounces-2410-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b=DoSqUxQ9; dkim=neutral (no key) header.i=@suse.cz header.s=susede2_ed25519; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b=kKhgX2dG; dkim=neutral (no key) header.i=@suse.cz header.s=susede2_ed25519 header.b=UkBjvTDO; arc=pass (i=1 spf=pass spfdomain=suse.cz dkim=pass dkdomain=suse.cz dkim=pass dkdomain=suse.cz); spf=pass (google.com: domain of linux-ext4+bounces-2410-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-ext4+bounces-2410-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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 335821C222BA for ; Thu, 9 May 2024 10:41:05 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 5092312F5B1; Thu, 9 May 2024 10:40:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=suse.cz header.i=@suse.cz header.b="DoSqUxQ9"; dkim=permerror (0-bit key) header.d=suse.cz header.i=@suse.cz header.b="QGHb9EuI"; dkim=pass (1024-bit key) header.d=suse.cz header.i=@suse.cz header.b="kKhgX2dG"; dkim=permerror (0-bit key) header.d=suse.cz header.i=@suse.cz header.b="UkBjvTDO" X-Original-To: linux-ext4@vger.kernel.org Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.223.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0C7D5322E; Thu, 9 May 2024 10:40:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=195.135.223.131 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715251256; cv=none; b=DIfehCrpYpVzpV6GuiY0uhFMSU1r8EwXmkbj81SvHrLBbP3qY2NXemyJxzLo/PaI+D5uzH22AIrKinRFes02aepNcVfJ/CYdprhp4ARm9AMTpVGKvgIGvWvFIUL57APMWGyaQg06cnxd2ws2Wd6BzNgXfSYHSkHH0ex9hXB1Sis= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715251256; c=relaxed/simple; bh=G1ypJ1HrkCCEaeAsq2Hx6jfkoV7haBNx9b3Fr/D5xm8=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=KQvayCqvPyEKWBGj7cNveVIMjLwm2QROJzTHAvX2lctgWVmWOHW9iPGghKLHmYKXwq34hFTLdhqmT28VPE3fbhCeLU9vn+EhRaY3XwiGgmGBMPVjcgVSMSV/odLxptLNX8rxmiTwQqfxjs1KyM76O2XeNfwW54ql6Qag/iS21z0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=suse.cz; spf=pass smtp.mailfrom=suse.cz; dkim=pass (1024-bit key) header.d=suse.cz header.i=@suse.cz header.b=DoSqUxQ9; dkim=permerror (0-bit key) header.d=suse.cz header.i=@suse.cz header.b=QGHb9EuI; dkim=pass (1024-bit key) header.d=suse.cz header.i=@suse.cz header.b=kKhgX2dG; dkim=permerror (0-bit key) header.d=suse.cz header.i=@suse.cz header.b=UkBjvTDO; arc=none smtp.client-ip=195.135.223.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=suse.cz Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=suse.cz Received: from imap1.dmz-prg2.suse.org (imap1.dmz-prg2.suse.org [10.150.64.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id EAFE15FD1D; Thu, 9 May 2024 10:40:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1715251253; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=22XtW7WxCKcNM6SFn+k2/G0UhW7ZtL6Ugs4+UbmPn8s=; b=DoSqUxQ9y3VQoA/BqC/HKL02NPabxOQd5bzxBULgX1dHX/bZb1idcXYIumQ3p8fguT6ejJ 4FYbyhV0T1bqyxMK7yD5GjeJ0uwcyfY5fjaUmmHAjpT30ymIa1emUTgG/UcKxX9guJWXeG Zqk9AkIna0IFtFdyN5l74dLSxDSjwj4= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1715251253; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=22XtW7WxCKcNM6SFn+k2/G0UhW7ZtL6Ugs4+UbmPn8s=; b=QGHb9EuIGYOGgFfWhrgSmsInouSeYWd//I1s7rpmxm7WT2n0lpRPGxYLhg+cmljmf1LZvo ML274K5y9RogWJDg== Authentication-Results: smtp-out2.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1715251252; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=22XtW7WxCKcNM6SFn+k2/G0UhW7ZtL6Ugs4+UbmPn8s=; b=kKhgX2dGE8bt8bBPRlqwHxh6OwWdcr1L7y4sKVajOILLtjslM88TrHUimMZeUvDczMY0FZ RqARGoFeNUZ7YE1n3WeZMwc4ymUf8TzReXIqKT+5rwi9doajwKD2yAmstMPmCmNYOs6baX QsUvWAlL+QwRBTCrH1WwWOBTZr+99l4= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1715251252; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=22XtW7WxCKcNM6SFn+k2/G0UhW7ZtL6Ugs4+UbmPn8s=; b=UkBjvTDOn6pw7W7sVTD1zmJXv5PzIyLH69L/9xC7qh2CCDqGiyBR6xJQd5VmO77tbnU4z5 MYfGAj6Boa2CHACg== Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id DF72B13A24; Thu, 9 May 2024 10:40:52 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id c0uHNjSoPGbIQgAAD6G6ig (envelope-from ); Thu, 09 May 2024 10:40:52 +0000 Received: by quack3.suse.cz (Postfix, from userid 1000) id 811DFA0861; Thu, 9 May 2024 12:40:52 +0200 (CEST) Date: Thu, 9 May 2024 12:40:52 +0200 From: Jan Kara To: "Ritesh Harjani (IBM)" Cc: linux-xfs@vger.kernel.org, linux-ext4@vger.kernel.org, linux-fsdevel@vger.kernel.org, Matthew Wilcox , "Darrick J . Wong" , Ojaswin Mujoo , Jan Kara Subject: Re: [PATCHv2 2/2] iomap: Optimize iomap_read_folio Message-ID: <20240509104052.mixeiy7ihxlzzbba@quack3> References: <92ae9f3333c9a7e66214568d08f45664261c899c.1715067055.git.ritesh.list@gmail.com> Precedence: bulk X-Mailing-List: linux-ext4@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <92ae9f3333c9a7e66214568d08f45664261c899c.1715067055.git.ritesh.list@gmail.com> X-Spam-Level: X-Spamd-Result: default: False [-2.30 / 50.00]; BAYES_HAM(-3.00)[100.00%]; SUSPICIOUS_RECIPS(1.50)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; MID_RHS_NOT_FQDN(0.50)[]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain]; RCVD_VIA_SMTP_AUTH(0.00)[]; TAGGED_RCPT(0.00)[]; MISSING_XM_UA(0.00)[]; FREEMAIL_TO(0.00)[gmail.com]; ARC_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; RCPT_COUNT_SEVEN(0.00)[8]; FREEMAIL_ENVRCPT(0.00)[gmail.com]; TO_DN_SOME(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; FROM_HAS_DN(0.00)[]; RCVD_COUNT_THREE(0.00)[3]; TO_MATCH_ENVRCPT_ALL(0.00)[]; FUZZY_BLOCKED(0.00)[rspamd.com]; RCVD_TLS_LAST(0.00)[]; DKIM_SIGNED(0.00)[suse.cz:s=susede2_rsa,suse.cz:s=susede2_ed25519]; DBL_BLOCKED_OPENRESOLVER(0.00)[suse.com:email,suse.cz:email,imap1.dmz-prg2.suse.org:helo,imap1.dmz-prg2.suse.org:rdns] X-Spam-Score: -2.30 X-Spam-Flag: NO On Tue 07-05-24 14:25:43, Ritesh Harjani (IBM) wrote: > iomap_readpage_iter() handles "uptodate blocks" and "not uptodate blocks" > within a folio separately. This makes iomap_read_folio() to call into > ->iomap_begin() to request for extent mapping even though it might already > have an extent which is not fully processed. > This happens when we either have a large folio or with bs < ps. In these > cases we can have sub blocks which can be uptodate (say for e.g. due to > previous writes). With iomap_read_folio_iter(), this is handled more > efficiently by not calling ->iomap_begin() call until all the sub blocks > with the current folio are processed. > > iomap_read_folio_iter() handles multiple sub blocks within a given > folio but it's implementation logic is similar to how > iomap_readahead_iter() handles multiple folios within a single mapped > extent. Both of them iterate over a given range of folio/mapped extent > and call iomap_readpage_iter() for reading. > > Signed-off-by: Ritesh Harjani (IBM) > cc: Ojaswin Mujoo Looks good. Feel free to add: Reviewed-by: Jan Kara Honza > --- > fs/iomap/buffered-io.c | 20 +++++++++++++++++++- > 1 file changed, 19 insertions(+), 1 deletion(-) > > diff --git a/fs/iomap/buffered-io.c b/fs/iomap/buffered-io.c > index 9f79c82d1f73..a9bd74ee7870 100644 > --- a/fs/iomap/buffered-io.c > +++ b/fs/iomap/buffered-io.c > @@ -444,6 +444,24 @@ static loff_t iomap_readpage_iter(const struct iomap_iter *iter, > return pos - orig_pos + plen; > } > > +static loff_t iomap_read_folio_iter(const struct iomap_iter *iter, > + struct iomap_readpage_ctx *ctx) > +{ > + struct folio *folio = ctx->cur_folio; > + size_t offset = offset_in_folio(folio, iter->pos); > + loff_t length = min_t(loff_t, folio_size(folio) - offset, > + iomap_length(iter)); > + loff_t done, ret; > + > + for (done = 0; done < length; done += ret) { > + ret = iomap_readpage_iter(iter, ctx, done); > + if (ret <= 0) > + return ret; > + } > + > + return done; > +} > + > int iomap_read_folio(struct folio *folio, const struct iomap_ops *ops) > { > struct iomap_iter iter = { > @@ -459,7 +477,7 @@ int iomap_read_folio(struct folio *folio, const struct iomap_ops *ops) > trace_iomap_readpage(iter.inode, 1); > > while ((ret = iomap_iter(&iter, ops)) > 0) > - iter.processed = iomap_readpage_iter(&iter, &ctx, 0); > + iter.processed = iomap_read_folio_iter(&iter, &ctx); > > if (ret < 0) > folio_set_error(folio); > -- > 2.44.0 > -- Jan Kara SUSE Labs, CR