Received: by 2002:a05:6a10:1287:0:0:0:0 with SMTP id d7csp736500pxv; Thu, 15 Jul 2021 14:53:10 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwRgIaQHfeMQwf3j+WAJ3vfcM5YaKzM22+GjfCaHgZhFXSSIup/T4r+McVOsxYP4YxCKZDD X-Received: by 2002:a05:6e02:198f:: with SMTP id g15mr4326485ilf.120.1626385990688; Thu, 15 Jul 2021 14:53:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626385990; cv=none; d=google.com; s=arc-20160816; b=s4xB1egMjp4iv+dPp+4052uR11CxExl2wR1l5WFUeCn2GW1I5UPr85qd03hmjkATSN NUsN7QnqleT7e7jo7MI/J13NA+9natedgGEszfAGw81Gb248dpEBzPL8U+ALdA6kXdt5 EsdSxyK4QPV6+ah6v7Tbe0S9soleMsKH7q/11kMVYLN/AkFLX0pK4weH4rfxROKwJC9J 1yJ3JYXqGasfAvhdq3EpyT9V7SRfn6LlrTLoEx/0DJqKYTTIVdl8a+N0b3mafMRVaRF1 Nps1ZniEuAeGkQAlbNCgm+CxkFjitITAj/PnLIFSfOfBw211Cz+PR956GI0cBQimkBXh Xa6Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=+eucS6VYW0jZxsCM01uJ8/qZp/rbGMuQdcQrvVT8onM=; b=UfU6A2NVmlWrFhczRnSisyIv9a7ljO4T75no3eirtdOTyiXJJE94BompFenMQOXHhO dordvDLKIe7JvgbjDZyTEXgxAt4ZyEJeRDrFiyfTyu8Y7zdNKGvsR9RWgErEfZtmkgtT yxk1hsvfxsyLSu9aD6Q/nIM5jJ5xg9S5k5YU8GxkYU03gjJsPbaAEqvxuJtMxkwi7P4l 9avn9odahEU+W5WmagGN/Jd5eVYjDU8AmZqbCFlATLhgvxVLRcYF2TwnK8My2OShyw4w ZKOKnWEHIA16RfmIOp9sb6mbGJATZshcmPFc/oFV9y1IJE/xAePba+zEup7YUaH0KmD3 SF8w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="K7//o4Kf"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id u10si6425845ilv.84.2021.07.15.14.52.58; Thu, 15 Jul 2021 14:53:10 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="K7//o4Kf"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231473AbhGOVyk (ORCPT + 99 others); Thu, 15 Jul 2021 17:54:40 -0400 Received: from mail.kernel.org ([198.145.29.99]:45014 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229776AbhGOVyj (ORCPT ); Thu, 15 Jul 2021 17:54:39 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id ED588613D4; Thu, 15 Jul 2021 21:51:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1626385906; bh=6Oj1YIskroeIo98doAzAyq0ZaBG4ZNuSkw6bLyFZkuQ=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=K7//o4Kf3ebr4owF1Nuu5WrcpljB7Mk/gtKqc6RYzhIggMkoNhgGM90HMtaeb73It KYwLev45eDH5guJs20tuO61bt1ir27w3N6Hid9Pv8IjHnbqTftfn5s0HvI5c4LKTpr fRjto+/OAJoi0bza+NGyTmqK5nwCuiiQx7xYGkKl8+pTsWWAwNAqAbeaJDtrCVT+II MaEWXeKG9BW2Fs3PtZPXp1J3ATnh7qzML8lbX7zyHj1FA7pjivTewO4aVpZwBN/gGN 3/n82iP9d5eBu0eYPzkJhZTBYW28YcFqdn33DdLk1TLIh30Q4L06GbXcPgYinm8jOV DCkoaQ+9BTiaA== Date: Thu, 15 Jul 2021 14:51:45 -0700 From: "Darrick J. Wong" To: "Matthew Wilcox (Oracle)" Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org, linux-fsdevel@vger.kernel.org Subject: Re: [PATCH v14 103/138] iomap: Convert iomap_read_inline_data to take a folio Message-ID: <20210715215145.GN22357@magnolia> References: <20210715033704.692967-1-willy@infradead.org> <20210715033704.692967-104-willy@infradead.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210715033704.692967-104-willy@infradead.org> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jul 15, 2021 at 04:36:29AM +0100, Matthew Wilcox (Oracle) wrote: > Inline data is restricted to being less than a page in size, so we $deity I hope so. > don't need to handle multi-page folios. > > Signed-off-by: Matthew Wilcox (Oracle) Reviewed-by: Darrick J. Wong --D > --- > fs/iomap/buffered-io.c | 18 +++++++++--------- > 1 file changed, 9 insertions(+), 9 deletions(-) > > diff --git a/fs/iomap/buffered-io.c b/fs/iomap/buffered-io.c > index 5e0aa23d4693..c616ef1feb21 100644 > --- a/fs/iomap/buffered-io.c > +++ b/fs/iomap/buffered-io.c > @@ -194,24 +194,24 @@ struct iomap_readpage_ctx { > struct readahead_control *rac; > }; > > -static void > -iomap_read_inline_data(struct inode *inode, struct page *page, > +static void iomap_read_inline_data(struct inode *inode, struct folio *folio, > struct iomap *iomap) > { > size_t size = i_size_read(inode); > void *addr; > > - if (PageUptodate(page)) > + if (folio_test_uptodate(folio)) > return; > > - BUG_ON(page->index); > + BUG_ON(folio->index); > + BUG_ON(folio_multi(folio)); > BUG_ON(size > PAGE_SIZE - offset_in_page(iomap->inline_data)); > > - addr = kmap_atomic(page); > + addr = kmap_local_folio(folio, 0); > memcpy(addr, iomap->inline_data, size); > memset(addr + size, 0, PAGE_SIZE - size); > - kunmap_atomic(addr); > - SetPageUptodate(page); > + kunmap_local(addr); > + folio_mark_uptodate(folio); > } > > static inline bool iomap_block_needs_zeroing(struct inode *inode, > @@ -236,7 +236,7 @@ iomap_readpage_actor(struct inode *inode, loff_t pos, loff_t length, void *data, > > if (iomap->type == IOMAP_INLINE) { > WARN_ON_ONCE(pos); > - iomap_read_inline_data(inode, &folio->page, iomap); > + iomap_read_inline_data(inode, folio, iomap); > return PAGE_SIZE; > } > > @@ -614,7 +614,7 @@ static int iomap_write_begin(struct inode *inode, loff_t pos, size_t len, > > page = folio_file_page(folio, pos >> PAGE_SHIFT); > if (srcmap->type == IOMAP_INLINE) > - iomap_read_inline_data(inode, page, srcmap); > + iomap_read_inline_data(inode, folio, srcmap); > else if (iomap->flags & IOMAP_F_BUFFER_HEAD) > status = __block_write_begin_int(page, pos, len, NULL, srcmap); > else > -- > 2.30.2 >