From patchwork Thu May 30 20:20:53 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 13680806 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) (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 12ACD158DCF for ; Thu, 30 May 2024 20:21:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=90.155.50.34 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717100480; cv=none; b=Z7YgM+4kUYgELrG7SudF25vtoltwph0CkvJz9x+EeYLvuawE1rUz+0F4mUcxSBeiJtMeHO4h440+9b+y64CEMVFKOHvOQujSpeFBOE2OxEo/Z34uAjqPpZDYfJGZX/CCDU73fnrnCVprRuK0a4be47g6IkHwV7kQ7XeHWcrIRqI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717100480; c=relaxed/simple; bh=NrpArSDjTXz0rUIvyWB9REeBUpI01g6IboTJmNiDC6M=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=o2MmSjB6sCQaOkKL+5+Lg6Q6Pwln9YytlHrkPa/QGSRPEnQNbTtTX0L+Pi/CZAhAY+3HAKfsl7jbGjVrM5HF+VwftoBrsIoQcXSJTB3DR8Oj5RU8aU/dhgrHs32dVlASMLShhIsVjViuiJsOqecdaWdZprfuUv2jCCLCI+KkLKg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org; spf=none smtp.mailfrom=infradead.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b=jFDsnfoT; arc=none smtp.client-ip=90.155.50.34 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=infradead.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="jFDsnfoT" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description; bh=xDEyHT7YZIluP2Z1qAqXZa0cLa7iWu0LWV7S69T1mb8=; b=jFDsnfoTRBttKQHcXXhG3r5avv VhgaXe/9ySpRWpwskNFRJhavXC58RAxAKMsYm5iRfwNS/AbGG/1mI0dLHzW63R52hsRUUWlpZGFtx /5eRLRl3m+FNt2HViffXlbNU/NN6R4fJAm99M7LOHF4THqDmV3j+9nPwDXEynVgj+F1sKRbut37/5 JQ4BSA1HUbOexd11mRmhwlt06j4oXUO8yFU9eFBnz57Fu3jM3x5Aok06ewFzfWuv+Yzhiir5V1EI3 eX0LcNxLRpwu7wNoa57cSVUNap2bAQs25BCrtB1bSc66WM60kXX9jYrMZkl+0xA8vllK7pxm375Jx IVRZ8uEQ==; Received: from willy by casper.infradead.org with local (Exim 4.97.1 #2 (Red Hat Linux)) id 1sCmGz-0000000B8Ko-0Ija; Thu, 30 May 2024 20:21:17 +0000 From: "Matthew Wilcox (Oracle)" To: Christian Brauner Cc: "Matthew Wilcox (Oracle)" , linux-fsdevel@vger.kernel.org, Luis de Bethencourt , Salah Triki Subject: [PATCH 01/16] befs: Convert befs_symlink_read_folio() to use folio_end_read() Date: Thu, 30 May 2024 21:20:53 +0100 Message-ID: <20240530202110.2653630-2-willy@infradead.org> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240530202110.2653630-1-willy@infradead.org> References: <20240530202110.2653630-1-willy@infradead.org> Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 This is slightly more efficient than separate calls to folio_mark_uptodate() and folio_unlock(), and it's easier to read. Get rid of the call to folio_set_error() as nobody will check this flag. Cc: Luis de Bethencourt Cc: Salah Triki Signed-off-by: Matthew Wilcox (Oracle) --- fs/befs/linuxvfs.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/fs/befs/linuxvfs.c b/fs/befs/linuxvfs.c index d76f406d3b2e..f92f108840f5 100644 --- a/fs/befs/linuxvfs.c +++ b/fs/befs/linuxvfs.c @@ -475,6 +475,7 @@ static int befs_symlink_read_folio(struct file *unused, struct folio *folio) befs_data_stream *data = &befs_ino->i_data.ds; befs_off_t len = data->size; char *link = folio_address(folio); + int err = -EIO; if (len == 0 || len > PAGE_SIZE) { befs_error(sb, "Long symlink with illegal length"); @@ -487,13 +488,10 @@ static int befs_symlink_read_folio(struct file *unused, struct folio *folio) goto fail; } link[len - 1] = '\0'; - folio_mark_uptodate(folio); - folio_unlock(folio); - return 0; + err = 0; fail: - folio_set_error(folio); - folio_unlock(folio); - return -EIO; + folio_end_read(folio, err == 0); + return err; } /* From patchwork Thu May 30 20:20:54 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 13680811 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) (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 2B5B7158DD7 for ; Thu, 30 May 2024 20:21:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=90.155.50.34 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717100481; cv=none; b=DVhCtJ7CucEDx2FdVQd4V74NpjBSo9wYo6CUlqypK0NdoBSsah9EbLIvQ1i7NynDEYqeOOtJ2t2VI/8eKl7sGWjLjsyb4k3h7BI+AA6xEK/SFmQOzh6yo7u2APIe/50dLNbkPFx/oIm9eE6dzfURSuTIrr2EiH5ma4hMQ7odpuw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717100481; c=relaxed/simple; bh=9Wl7Or5G3IkXqEPcsD85gLYq/lgOOE3G7+fWToxy6xA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=GsmiZ7EaZQgC3llAeQ/HDVCURBVb7sGuXuqg+QANmMzQbAzlwca1VrB08T2prdFY8KJpIbc0LwNxGRk00jMiSCOc7ySfDZ1PD4XkP89vzMqy6N/GF1INx/nkNK22sdvPnTBBYHC10qxIJrMXUWqrckAIW8wJgvWQ4NgxgjFvfms= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org; spf=none smtp.mailfrom=infradead.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b=r1PiQqPg; arc=none smtp.client-ip=90.155.50.34 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=infradead.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="r1PiQqPg" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description; bh=lfQiTKH6qz2CerAT9IefP0Uh9+x805gtJN1XTCu7aP0=; b=r1PiQqPg62PY95U+/K34oIx2FO Ix6/vX7nDEgPH4eSKE7HpGyja2S34ZtMNS1RoYEAyBWQjGj8v4Jz+B1RFIuW01S6FWyHRKgbk9aM0 Fqq8Nouub+yZzxecV80ftXTvDAlUpaH5wzeVRvQTeDvclw7MQ2TktztCZjTYtbFksiHua5UGsjpSv CgMRrmmEogta6zsrHi+3z8p8HtUT8vgtfEgDLHNz7tRzp9zzN+eZ8vWNfNd0FXvoVE1e0qaEXAJVG wK76z6EinY+c7xoAidiy+Vz9EweSdpW9q/7mUD6B1yrXkjgvp/OSjaYZkUuCASJz4vH29h6HC0DJ6 Ao860Aww==; Received: from willy by casper.infradead.org with local (Exim 4.97.1 #2 (Red Hat Linux)) id 1sCmGz-0000000B8Kr-0exd; Thu, 30 May 2024 20:21:17 +0000 From: "Matthew Wilcox (Oracle)" To: Christian Brauner Cc: "Matthew Wilcox (Oracle)" , linux-fsdevel@vger.kernel.org, Jan Harkes , coda@cs.cmu.edu Subject: [PATCH 02/16] coda: Convert coda_symlink_filler() to use folio_end_read() Date: Thu, 30 May 2024 21:20:54 +0100 Message-ID: <20240530202110.2653630-3-willy@infradead.org> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240530202110.2653630-1-willy@infradead.org> References: <20240530202110.2653630-1-willy@infradead.org> Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 This is slightly more efficient than separate calls to folio_mark_uptodate() and folio_unlock(), and it's easier to read. Get rid of the call to folio_set_error() as nobody will check this flag. Cc: Jan Harkes Cc: coda@cs.cmu.edu Signed-off-by: Matthew Wilcox (Oracle) --- fs/coda/symlink.c | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/fs/coda/symlink.c b/fs/coda/symlink.c index ccdbec388091..40f84d014524 100644 --- a/fs/coda/symlink.c +++ b/fs/coda/symlink.c @@ -31,15 +31,7 @@ static int coda_symlink_filler(struct file *file, struct folio *folio) cii = ITOC(inode); error = venus_readlink(inode->i_sb, &cii->c_fid, p, &len); - if (error) - goto fail; - folio_mark_uptodate(folio); - folio_unlock(folio); - return 0; - -fail: - folio_set_error(folio); - folio_unlock(folio); + folio_end_read(folio, error == 0); return error; } From patchwork Thu May 30 20:20:55 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 13680819 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) (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 CF626158DD3 for ; Thu, 30 May 2024 20:21:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=90.155.50.34 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717100483; cv=none; b=rUW0Ns7+UucF4KK9nv1BS/Dda3qplA4Il0LWH6oTkgqLGc8DTr62kLeCCtHPc0MDzuimUXP/+OwRxcc/wuq3kkoSvvfNLn4jGr0Rxir41ES+t2ZN3TNfyBmM1n4LaRAoA/cctRbwsHuwpX3dHpAG1djJjc/7vbRnJ8F/z8FQxPY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717100483; c=relaxed/simple; bh=koMDs2Vu8z5aibwmSojSI8g4wOfb3cYLT2vweHqNtHM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=BFHzrf1bkQZ9vu2SfNc/aTSZjw/1L6PKzGqe6GcrAblAgSQIfrni+Fkbdyg0TAknV5lsbra/g7VpXxuJRjpSMFuZV6+nZpRBkBFjTLQ0z+WEWDta2QGVWnNtqji4CH0g4ccf1FbVl48Oot4Wry5V9PLp/aBt2frJkJv2TWhpu5E= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org; spf=none smtp.mailfrom=infradead.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b=FwYVs1m/; arc=none smtp.client-ip=90.155.50.34 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=infradead.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="FwYVs1m/" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description; bh=UFQQOkEiNJUxviR/YN/zSOcTjWprC5zQJykTTnepqQQ=; b=FwYVs1m/SkZLlsGMkm0TjK8u9R kSWmqe/Jf19viUcKgWZS5zOjbDLzWGvEdmsIUzftGsGnpFLvZqRIINH51K+58oTF/+jbYA1wfRayL LkeX5L5SV8REoN6k9Unvqj4cBiq+Ob25ZPytl/yxG9+4Bb+EoWzKV+16LikUAACEJt/FA8HmPm7hh b7jjebXiw6Xvmk9SUfMPOBlyVDkCsUU6b2sDlxygfL65hEaV4tpwQz0zhh1pjwnrFG+1FBZyUyU8w 1pRscA9Qsberqpm88xNZMR4VDP/cgdEZBdHgogUKT5IPxuasJFE2G1kGXjLE3+rlahA1Der5qBI7G +ngN0eOA==; Received: from willy by casper.infradead.org with local (Exim 4.97.1 #2 (Red Hat Linux)) id 1sCmGz-0000000B8Kw-17Xn; Thu, 30 May 2024 20:21:17 +0000 From: "Matthew Wilcox (Oracle)" To: Christian Brauner Cc: "Matthew Wilcox (Oracle)" , linux-fsdevel@vger.kernel.org Subject: [PATCH 03/16] cramfs: Convert cramfs_read_folio to use a folio Date: Thu, 30 May 2024 21:20:55 +0100 Message-ID: <20240530202110.2653630-4-willy@infradead.org> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240530202110.2653630-1-willy@infradead.org> References: <20240530202110.2653630-1-willy@infradead.org> Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Remove the conversion back into a page and use the folio APIs throughout. Remove the setting of PG_error instead of converting it; it is unused by core code or by the rest of cramfs, so it serves no purpose here. Use folio_end_read() to save an atomic operation and unify the two exit paths. Signed-off-by: Matthew Wilcox (Oracle) --- fs/cramfs/inode.c | 25 ++++++++++--------------- 1 file changed, 10 insertions(+), 15 deletions(-) diff --git a/fs/cramfs/inode.c b/fs/cramfs/inode.c index d818ed1bb07e..b84d1747a020 100644 --- a/fs/cramfs/inode.c +++ b/fs/cramfs/inode.c @@ -811,19 +811,19 @@ static struct dentry *cramfs_lookup(struct inode *dir, struct dentry *dentry, un static int cramfs_read_folio(struct file *file, struct folio *folio) { - struct page *page = &folio->page; - struct inode *inode = page->mapping->host; + struct inode *inode = folio->mapping->host; u32 maxblock; int bytes_filled; void *pgdata; + bool success = false; maxblock = (inode->i_size + PAGE_SIZE - 1) >> PAGE_SHIFT; bytes_filled = 0; - pgdata = kmap_local_page(page); + pgdata = kmap_local_folio(folio, 0); - if (page->index < maxblock) { + if (folio->index < maxblock) { struct super_block *sb = inode->i_sb; - u32 blkptr_offset = OFFSET(inode) + page->index * 4; + u32 blkptr_offset = OFFSET(inode) + folio->index * 4; u32 block_ptr, block_start, block_len; bool uncompressed, direct; @@ -844,7 +844,7 @@ static int cramfs_read_folio(struct file *file, struct folio *folio) if (uncompressed) { block_len = PAGE_SIZE; /* if last block: cap to file length */ - if (page->index == maxblock - 1) + if (folio->index == maxblock - 1) block_len = offset_in_page(inode->i_size); } else { @@ -861,7 +861,7 @@ static int cramfs_read_folio(struct file *file, struct folio *folio) * from the previous block's pointer. */ block_start = OFFSET(inode) + maxblock * 4; - if (page->index) + if (folio->index) block_start = *(u32 *) cramfs_read(sb, blkptr_offset - 4, 4); /* Beware... previous ptr might be a direct ptr */ @@ -906,17 +906,12 @@ static int cramfs_read_folio(struct file *file, struct folio *folio) } memset(pgdata + bytes_filled, 0, PAGE_SIZE - bytes_filled); - flush_dcache_page(page); - kunmap_local(pgdata); - SetPageUptodate(page); - unlock_page(page); - return 0; + flush_dcache_folio(folio); + success = true; err: kunmap_local(pgdata); - ClearPageUptodate(page); - SetPageError(page); - unlock_page(page); + folio_end_read(folio, success); return 0; } From patchwork Thu May 30 20:20:56 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 13680812 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) (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 12B3B158DD0 for ; Thu, 30 May 2024 20:21:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=90.155.50.34 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717100481; cv=none; b=YPV0l/dwSRUTuLZV8GbzX2YoSr6PKlDoO8q/KM8Fa12IndaKYP/9opf38w2J2ltc0vP/6RZ0jXVHIoUeB3oDviSyYF1EuMxAhvD3P1uECE+DwtOhayfs+t2TDqAj4dWTpVRxayQ6hoZFDO9yLRmeN3/xDMCGEXCMkzHgyQVH7z8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717100481; c=relaxed/simple; bh=fdhuwyaoJ75kTK1+bY6IR85Uyujo7j76p0HlophZceU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=RJCX5a6cTA3sO/8WuUWTcCbfxW3whXJN9lGjeuM6sVOxH832wZccgsEVqfVhsKqDnkc582ubwclOqPf5fLIcFO+BMdzP27YqWPn/+/s3OFWi8K9YdCa/X/A6/i9/zXDiJNTqZZu5O4lJQqZdrBcKDnxlYbb8H6XWUQKpJ/4Mu/M= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org; spf=none smtp.mailfrom=infradead.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b=HBqdrquj; arc=none smtp.client-ip=90.155.50.34 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=infradead.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="HBqdrquj" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description; bh=Buzi7Zpoc/Gce0oEezUri/+iIc5iKy1SsFmuJMOCVRk=; b=HBqdrqujd5+jZGNgL/Psf2q7RI ghSBY9HxyPfwEuxTop7yk3mrjnrGD1UVCMk4QiLEWGGkuBLe8M1qMfiH24y2h4kZhM6FO/LBmAoBQ 5pGXPTxRVr7kEK7STEzMAZAafgHBRsD9PpQ2tW40kKvAt1y115mAm2dAXPk6eyghm86DutTGodNQC E78IeBI0HKuAhJZg3bKFtOOrRcUg9jM5LfgXsnno7/YSVTygE7nXYnMNRLRyAbQOxn0Hf+gdnnpxj Uosp7dTw0ZIRXgCBWncTwC3yf1CUx6dpYymb/g8umG6odBvgf43CrtQkaC/XSmz/6nqGk5tdpYOVO +Q+Eh6jw==; Received: from willy by casper.infradead.org with local (Exim 4.97.1 #2 (Red Hat Linux)) id 1sCmGz-0000000B8Kz-1X5z; Thu, 30 May 2024 20:21:17 +0000 From: "Matthew Wilcox (Oracle)" To: Christian Brauner Cc: "Matthew Wilcox (Oracle)" , linux-fsdevel@vger.kernel.org Subject: [PATCH 04/16] efs: Convert efs_symlink_read_folio to use a folio Date: Thu, 30 May 2024 21:20:56 +0100 Message-ID: <20240530202110.2653630-5-willy@infradead.org> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240530202110.2653630-1-willy@infradead.org> References: <20240530202110.2653630-1-willy@infradead.org> Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Remove the conversion back into a page and use the folio APIs throughout. Remove the setting of PG_error instead of converting it; it is unused by core code or by the rest of EFS, so it serves no purpose here. Signed-off-by: Matthew Wilcox (Oracle) --- fs/efs/symlink.c | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/fs/efs/symlink.c b/fs/efs/symlink.c index 3b03a573cb1a..7749feded722 100644 --- a/fs/efs/symlink.c +++ b/fs/efs/symlink.c @@ -14,10 +14,9 @@ static int efs_symlink_read_folio(struct file *file, struct folio *folio) { - struct page *page = &folio->page; - char *link = page_address(page); - struct buffer_head * bh; - struct inode * inode = page->mapping->host; + char *link = folio_address(folio); + struct buffer_head *bh; + struct inode *inode = folio->mapping->host; efs_block_t size = inode->i_size; int err; @@ -40,12 +39,9 @@ static int efs_symlink_read_folio(struct file *file, struct folio *folio) brelse(bh); } link[size] = '\0'; - SetPageUptodate(page); - unlock_page(page); - return 0; + err = 0; fail: - SetPageError(page); - unlock_page(page); + folio_end_read(folio, err == 0); return err; } From patchwork Thu May 30 20:20:57 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 13680807 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) (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 12A48158DCA for ; Thu, 30 May 2024 20:21:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=90.155.50.34 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717100480; cv=none; b=IEltYGjv3Ik6mWYYz03lhTfmHK9yMtHHpcuAzAshHf4T4A2TQoo6e8N0QUsa6Exbgl6Xqg3W1pPzv1zdhGlTPzrsJujqpSaT1AFegOY3aPhUagAJ5wb2+givylk+GaFPX0mRvCiz/kCtK+4+atCvN0kHFt92c/fpYVcLbIXfgII= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717100480; c=relaxed/simple; bh=5AZF/XdUh2ZSz4kF7jlJ0I1X1m0SeQT5vRBzGbeBJfs=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=minkr3s61X8buNJyf4PubaPxPbbHUpbMpTAsbZKNkesCv4UKq9FY576ozrFvPXqFsOWfjJxN3mPHl8YrkzBqlH89W+nConKbb730tL1mgLuThgBYFmADOQ7q/weJ0fuSZomLehGq9g4Ie1iiGt6xcFogOyGC1aw4qC+QJvz3re8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org; spf=none smtp.mailfrom=infradead.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b=d0Ybv+bJ; arc=none smtp.client-ip=90.155.50.34 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=infradead.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="d0Ybv+bJ" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description; bh=hqgerw82zFjkqDdW7SOrIPD4tAnKJQwyU8dSTQUOaHg=; b=d0Ybv+bJJyyk7ppiF2hz8aTDbZ u9vosBgsnG3z8UshQeB9mrmb3sz9Ipwk/WK0es+VqgZ9MEyoo5NAd1bGL5geMEuXsw6nXLdrb3Ov4 wao2xDDXOrw3lczqR96AGwiUYr0638+HVwRPBd++KxBlz/uDUxcLKA5y3/wV3OPfg9pwdZmsLDIFe xbX2ClFnn2x5GGDEAy7ajBYPhl+r7gWHjaMT803HvBKimJTII1y7hWDK3cjupmxnkEEOG/in6BV+3 y4/VBYzGputgj7z3Wy2vfmGC7a4DzQ3Copx2ti9EJMZutUyo1c6DsqJPyPNxiFh5W9Tz1ZbRJ02L0 zpvUYPsQ==; Received: from willy by casper.infradead.org with local (Exim 4.97.1 #2 (Red Hat Linux)) id 1sCmGz-0000000B8L6-2746; Thu, 30 May 2024 20:21:17 +0000 From: "Matthew Wilcox (Oracle)" To: Christian Brauner Cc: "Matthew Wilcox (Oracle)" , linux-fsdevel@vger.kernel.org Subject: [PATCH 05/16] hpfs: Convert hpfs_symlink_read_folio to use a folio Date: Thu, 30 May 2024 21:20:57 +0100 Message-ID: <20240530202110.2653630-6-willy@infradead.org> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240530202110.2653630-1-willy@infradead.org> References: <20240530202110.2653630-1-willy@infradead.org> Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Remove the conversion back into a page and use the folio APIs throughout. Remove the setting of PG_error instead of converting it; it is unused by core code or by the rest of HPFS, so it serves no purpose here. Signed-off-by: Matthew Wilcox (Oracle) --- fs/hpfs/namei.c | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/fs/hpfs/namei.c b/fs/hpfs/namei.c index 9184b4584b01..d0edf9ed33b6 100644 --- a/fs/hpfs/namei.c +++ b/fs/hpfs/namei.c @@ -472,9 +472,8 @@ static int hpfs_rmdir(struct inode *dir, struct dentry *dentry) static int hpfs_symlink_read_folio(struct file *file, struct folio *folio) { - struct page *page = &folio->page; - char *link = page_address(page); - struct inode *i = page->mapping->host; + char *link = folio_address(folio); + struct inode *i = folio->mapping->host; struct fnode *fnode; struct buffer_head *bh; int err; @@ -485,17 +484,9 @@ static int hpfs_symlink_read_folio(struct file *file, struct folio *folio) goto fail; err = hpfs_read_ea(i->i_sb, fnode, "SYMLINK", link, PAGE_SIZE); brelse(bh); - if (err) - goto fail; - hpfs_unlock(i->i_sb); - SetPageUptodate(page); - unlock_page(page); - return 0; - fail: hpfs_unlock(i->i_sb); - SetPageError(page); - unlock_page(page); + folio_end_read(folio, err == 0); return err; } From patchwork Thu May 30 20:20:58 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 13680808 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) (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 54936158DD1 for ; Thu, 30 May 2024 20:21:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=90.155.50.34 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717100480; cv=none; b=SoKFqJJAmOLcqySf4Va7uYfjbkDnynBv1JMtQkLN++3pQq5y0ayoQzCTCYYnzknXGkJhqZoKVAaxBgXOxxPmvr+NRAEECf9ODHDqtyCRu037K1BsWVi4F9vLYAG8gK2Qp7siqLUYUfOpf4Gb05g+fdSJaiQ7eu74fD+l502jcTI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717100480; c=relaxed/simple; bh=UuzRZvckg8fKW4nE8aYj0OSSgwOofSnrBXzIRmA5N5c=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=pdaXetGfVRYGpEO4ZIW2UT3s1aBMfXBud4jes56t1lWrR8asNP47nJ3J6JyJ3GtlWVvEPzasoFZn+Gj419YkXBeWfmJuv1xBpMmEG524F37sAIb5bgV87Wgudife5r9AhCSIgkMI6tmgENszU6N8Lsq+OUnQCksj/ZUhKnaqTfY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org; spf=none smtp.mailfrom=infradead.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b=Xf8YmQWq; arc=none smtp.client-ip=90.155.50.34 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=infradead.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="Xf8YmQWq" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description; bh=/YAyokozXBr3aRWhechl8r4QZQyL+SgETq3seuBRhZI=; b=Xf8YmQWq2b4v3uxcDxQ9ClWKC/ MEa2WXLTOQk7qG/f+F/UpRwRMeRedwrp6cDE6rykwETL1bD+a7BxhYx0R5wsIrR3bYO1eY7kzbxbi mBSHyEqWv12gZyrZVazXhqxEYRUESPi7DiKpJ4M/XyeyTJOMdLWzvgqhuaNaiE+GIhxtLWGlUdLmT 3u/1M08/XMBsEh7EMyYFTV2FWJycu4wZGktYs5Tu3YQs1+0PObHvPcN6/zosdVMlLKFIxc8Y1RqsX lDTJA6MXsPYhADXUBU6yzKldAr/dA1lwOuXVqi8/xYv/9rG216TP62ARRWHci863g8NDCdjC/jIdS qNqw+yVg==; Received: from willy by casper.infradead.org with local (Exim 4.97.1 #2 (Red Hat Linux)) id 1sCmGz-0000000B8LC-2jaw; Thu, 30 May 2024 20:21:17 +0000 From: "Matthew Wilcox (Oracle)" To: Christian Brauner Cc: "Matthew Wilcox (Oracle)" , linux-fsdevel@vger.kernel.org Subject: [PATCH 06/16] isofs: Convert rock_ridge_symlink_read_folio to use a folio Date: Thu, 30 May 2024 21:20:58 +0100 Message-ID: <20240530202110.2653630-7-willy@infradead.org> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240530202110.2653630-1-willy@infradead.org> References: <20240530202110.2653630-1-willy@infradead.org> Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Remove the conversion back into a page and use the folio APIs throughout. Remove the setting of PG_error instead of converting it; it is unused by core code or by the rest of isofs, so it serves no purpose here. Use folio_end_read() to save an atomic operation and unify the two exit paths. Signed-off-by: Matthew Wilcox (Oracle) --- fs/isofs/rock.c | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/fs/isofs/rock.c b/fs/isofs/rock.c index d6c17ad69dee..dbf911126e61 100644 --- a/fs/isofs/rock.c +++ b/fs/isofs/rock.c @@ -688,11 +688,10 @@ int parse_rock_ridge_inode(struct iso_directory_record *de, struct inode *inode, */ static int rock_ridge_symlink_read_folio(struct file *file, struct folio *folio) { - struct page *page = &folio->page; - struct inode *inode = page->mapping->host; + struct inode *inode = folio->mapping->host; struct iso_inode_info *ei = ISOFS_I(inode); struct isofs_sb_info *sbi = ISOFS_SB(inode->i_sb); - char *link = page_address(page); + char *link = folio_address(folio); unsigned long bufsize = ISOFS_BUFFER_SIZE(inode); struct buffer_head *bh; char *rpnt = link; @@ -779,9 +778,10 @@ static int rock_ridge_symlink_read_folio(struct file *file, struct folio *folio) goto fail; brelse(bh); *rpnt = '\0'; - SetPageUptodate(page); - unlock_page(page); - return 0; + ret = 0; +end: + folio_end_read(folio, ret == 0); + return ret; /* error exit from macro */ out: @@ -795,9 +795,8 @@ static int rock_ridge_symlink_read_folio(struct file *file, struct folio *folio) fail: brelse(bh); error: - SetPageError(page); - unlock_page(page); - return -EIO; + ret = -EIO; + goto end; } const struct address_space_operations isofs_symlink_aops = { From patchwork Thu May 30 20:20:59 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 13680813 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) (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 2B575158DD6 for ; Thu, 30 May 2024 20:21:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=90.155.50.34 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717100481; cv=none; b=j6Y0NJLA1LzjxsQsrxLQ9tGx0+fDtmnF5wJfIqdFU9Bo9KTBaZHeCHQbGQoHhsiwZwNULS9peTlpzJE/IPbWZ4MrYPQcdmTqY7hXT84ulSOl63yUIaz7sZAKAZIYNwRCUKcOcBXT8B9nKK94wdaA8SXURCVN8NU9QGYx0AjKyrs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717100481; c=relaxed/simple; bh=BKV41FpzXQN+Fwf0Q86zXKTmVIYTkt83bZpcdl3/PRg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=ls74WQB1NFCPaL1/KJKOsSasPcEXN7RdEDLGJ0K5hsVd/Y8BaWP9/ztQ85UXoAhP3LGYBndBursXRCYHYxk3BFWddum2VdAR2/vD6r2V84I2r0zr5M1NGweExP/o+s4CZMfWLwBg3eWe88mJK7RALyin5bA63cKH26mBoNK1os8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org; spf=none smtp.mailfrom=infradead.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b=Hp4lnncA; arc=none smtp.client-ip=90.155.50.34 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=infradead.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="Hp4lnncA" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description; bh=9DNYu25PsP7kPSgGts/yb+luWRPbPj48AdRNc25boMg=; b=Hp4lnncAb+Y7qAWyMQC8y9C3cL 1NE/tUm4Y+Bo0u5NH1N7c/K1DmobVe+Xgy/2Pw+5tNH/vf0JVZy0rJDldTrmytERkfOR1brelldAV t47mdAehl7tkopV60hxaOakAJILKD5HLz2LniSl1Oap+ePGfnVll1h/T8FdvPyBDJBPzbj2fS2OOs skaFYUvb2LMTzTFheYdUlwRyyLKDA/JBkBxzu6/igLRf5TI41ELdqED1RMhgiXVRrAY3lYj5eRxjQ 2/wRD+VjLyaGbwKPy5S72ZGpy00eIx7PL5XGrcRMC/kliJlSbk0P7aZpt+oR6+mjrWYh3Ots1Trmr 44w3qShg==; Received: from willy by casper.infradead.org with local (Exim 4.97.1 #2 (Red Hat Linux)) id 1sCmGz-0000000B8LI-3CbL; Thu, 30 May 2024 20:21:17 +0000 From: "Matthew Wilcox (Oracle)" To: Christian Brauner Cc: "Matthew Wilcox (Oracle)" , linux-fsdevel@vger.kernel.org, Richard Weinberger , Anton Ivanov , Johannes Berg , linux-um@lists.infradead.org Subject: [PATCH 07/16] hostfs: Convert hostfs_read_folio() to use a folio Date: Thu, 30 May 2024 21:20:59 +0100 Message-ID: <20240530202110.2653630-8-willy@infradead.org> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240530202110.2653630-1-willy@infradead.org> References: <20240530202110.2653630-1-willy@infradead.org> Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Remove the use of page APIs, including setting/clearing the error flag which is never checked on hostfs folios. This does not include support for large folios as kmap_local_folio() maps only one page at a time. Cc: Richard Weinberger Cc: Anton Ivanov Cc: Johannes Berg Cc: linux-um@lists.infradead.org Signed-off-by: Matthew Wilcox (Oracle) --- fs/hostfs/hostfs_kern.c | 23 ++++++----------------- 1 file changed, 6 insertions(+), 17 deletions(-) diff --git a/fs/hostfs/hostfs_kern.c b/fs/hostfs/hostfs_kern.c index a73d27c4dd58..e7c72f2634f6 100644 --- a/fs/hostfs/hostfs_kern.c +++ b/fs/hostfs/hostfs_kern.c @@ -432,31 +432,20 @@ static int hostfs_writepage(struct page *page, struct writeback_control *wbc) static int hostfs_read_folio(struct file *file, struct folio *folio) { - struct page *page = &folio->page; char *buffer; - loff_t start = page_offset(page); + loff_t start = folio_pos(folio); int bytes_read, ret = 0; - buffer = kmap_local_page(page); + buffer = kmap_local_folio(folio, 0); bytes_read = read_file(FILE_HOSTFS_I(file)->fd, &start, buffer, PAGE_SIZE); - if (bytes_read < 0) { - ClearPageUptodate(page); - SetPageError(page); + if (bytes_read < 0) ret = bytes_read; - goto out; - } - - memset(buffer + bytes_read, 0, PAGE_SIZE - bytes_read); - - ClearPageError(page); - SetPageUptodate(page); - - out: - flush_dcache_page(page); + else + buffer = folio_zero_tail(folio, bytes_read, buffer); kunmap_local(buffer); - unlock_page(page); + folio_end_read(folio, ret == 0); return ret; } From patchwork Thu May 30 20:21:00 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 13680816 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) (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 1E25815AAD6 for ; Thu, 30 May 2024 20:21:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=90.155.50.34 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717100482; cv=none; b=k2w1Dri+1AL6uXOCdakLfTM+AahpaZHcR5HrzP7p8GsnFj5ydiLBP/mbkMcNWOWqo1QEywZ157axziOnf4al76r/nPgh4KdYAcgRnQLcZtUPsTmoLSGfj8oX0VNrRP5vhab5WZ8pgsyX05puWxkbdUL0OZu9BVJKLh9uEEqrKwA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717100482; c=relaxed/simple; bh=0C1DPwDSzDhH/Zs3tMSuA2iTTHLlwV8LiA8J1dQIGtw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=lcmIPi4/OHDD7tI/a4RuL36rMTjOmnixD0XDLlg1tKzcjNyVmJGiXjkZurcdoQLz1cRMgjsX0WFJCQAlq3TquoQmXn0iK+ULvrqaopOC7dUwI7iO9G66OvhspXQZYQ6Kqcwpg/ulOP7p7OPOArWz8Mp6gukIgIYy5Gu/xYYj7/E= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org; spf=none smtp.mailfrom=infradead.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b=UN8piu+/; arc=none smtp.client-ip=90.155.50.34 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=infradead.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="UN8piu+/" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description; bh=T+7yTmvE0A2HSsaMeB1qy9Qcuwtb7tBxn6fPz6awa4M=; b=UN8piu+/FqOzNlvaftQJTOjAvS OYPsSV97020hqpf3mwq0Oyodq6bXikJXpOVtJQHmCmmLw+h4H1wmw6NtsyaxN+jT9C+L6/26M2TaU 6gd1Sos5Fv9mR0l+At2WlnUT4DebreF6OkFAZYw3/qACIcM28DT/P3ngh9tK6iSJAPh+SykBV82P+ V9CyZ0yULw/6iB2BdJf3pqBZVBColATVxNJRGYmQXGYD+Jp2ASR5hObkr1m5Z2c8t9+CV1ZjtYRrI UKFk/HQBF9+3I6JpABUf9CLGQGBgKeM2nkHFNvUgFSzbgHiB8JR7oxmPBZoEx/TRCT7HNRIsWga3T 3U6WKghQ==; Received: from willy by casper.infradead.org with local (Exim 4.97.1 #2 (Red Hat Linux)) id 1sCmGz-0000000B8LO-3hDZ; Thu, 30 May 2024 20:21:17 +0000 From: "Matthew Wilcox (Oracle)" To: Christian Brauner Cc: "Matthew Wilcox (Oracle)" , linux-fsdevel@vger.kernel.org, David Woodhouse , linux-mtd@lists.infradead.org, Zhihao Cheng , Richard Weinberger Subject: [PATCH 08/16] jffs2: Remove calls to set/clear the folio error flag Date: Thu, 30 May 2024 21:21:00 +0100 Message-ID: <20240530202110.2653630-9-willy@infradead.org> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240530202110.2653630-1-willy@infradead.org> References: <20240530202110.2653630-1-willy@infradead.org> Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Nobody checks the error flag on jffs2 folios, so stop setting and clearing it. We can also remove the call to clear the uptodate flag; it will already be clear. Convert one of these into a call to mapping_set_error() which will actually be checked by other parts of the kernel. Cc: David Woodhouse Cc: linux-mtd@lists.infradead.org Signed-off-by: Matthew Wilcox (Oracle) Tested-by: Zhihao Cheng Reviewed-by: Zhihao Cheng Acked-by: Richard Weinberger --- fs/jffs2/file.c | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/fs/jffs2/file.c b/fs/jffs2/file.c index 62ea76da7fdf..e12cb145147e 100644 --- a/fs/jffs2/file.c +++ b/fs/jffs2/file.c @@ -95,13 +95,8 @@ static int jffs2_do_readpage_nolock (struct inode *inode, struct page *pg) ret = jffs2_read_inode_range(c, f, pg_buf, pg->index << PAGE_SHIFT, PAGE_SIZE); - if (ret) { - ClearPageUptodate(pg); - SetPageError(pg); - } else { + if (!ret) SetPageUptodate(pg); - ClearPageError(pg); - } flush_dcache_page(pg); kunmap(pg); @@ -304,10 +299,8 @@ static int jffs2_write_end(struct file *filp, struct address_space *mapping, kunmap(pg); - if (ret) { - /* There was an error writing. */ - SetPageError(pg); - } + if (ret) + mapping_set_error(mapping, ret); /* Adjust writtenlen for the padding we did, so we don't confuse our caller */ writtenlen -= min(writtenlen, (start - aligned_start)); @@ -330,7 +323,6 @@ static int jffs2_write_end(struct file *filp, struct address_space *mapping, it gets reread */ jffs2_dbg(1, "%s(): Not all bytes written. Marking page !uptodate\n", __func__); - SetPageError(pg); ClearPageUptodate(pg); } From patchwork Thu May 30 20:21:01 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 13680818 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) (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 9025615B574; Thu, 30 May 2024 20:21:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=90.155.50.34 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717100483; cv=none; b=oTfPpne0GHmYKx1s4kyr0TlfdkTPiIhOp6vZU+ec9h2/Zv8QKukpivlnHGy+U3T+LCsoDKTsIssl+z27EydzynAa3wEND+O34I5jolBVRNY9f4zt0qqrOT3eeq5yvLJsRlVzrb14SgiiDCvmH0ecpat8NrLDgNasXzhJXGxk2oA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717100483; c=relaxed/simple; bh=awnQuNFNAj1xMVjEOM16pvrQcZGtiTlqQft8kIwYekQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=IeQetMoIPJqoVnz9Grnr8/o8dl/UcHF216iAsn7tluAMmQK3iEknA7mkgo3xXH1+y5pyyLtSz+MrENUUxhCQ2ifWes2hRdNdZY8fixgOMe267y2dqHQebS7KVe31OA8clhzgfiFJ3UXvlD1zWtxSoImhgH1tBzuK+sDjz3JJEDk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org; spf=none smtp.mailfrom=infradead.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b=MPwcYHY+; arc=none smtp.client-ip=90.155.50.34 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=infradead.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="MPwcYHY+" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description; bh=2tXTCaKONv/xd3aviOhqWrMWUBzDVFqCaPB0En8yrzE=; b=MPwcYHY+fLGlCRbSr0pUM8lp+a US7P8gjZ6+P3lgaxS4U1naFRFepz3ISNdsdBrgkQvRZHT+mqQ4Xav4+2Xslk6e5+Op28k53A8AbDO AB1D8T9J+ZTyD7VHnIsnpzxut56v96kijSYCfe2ZgHceeQBaT8d1KqMqMFasGD2EdqLoHQe2XHVFd vZWRs5VhlmmyIoOSnriQQOT7SqYLfRYZuLv9HaAYks4yuz4jGaQgXi225rnKfTII+wSJ9tvXbnWZL okWNE+onNO4U9n4jSeI26I2hYTOY1/enGrucnFctzrFi+74pmHyLI2BzCaDA4jj7t8Ffvvopap2ne zYHW7N8Q==; Received: from willy by casper.infradead.org with local (Exim 4.97.1 #2 (Red Hat Linux)) id 1sCmGz-0000000B8LQ-49Y8; Thu, 30 May 2024 20:21:18 +0000 From: "Matthew Wilcox (Oracle)" To: Christian Brauner Cc: "Matthew Wilcox (Oracle)" , linux-fsdevel@vger.kernel.org, Trond Myklebust , Anna Schumaker , linux-nfs@vger.kernel.org Subject: [PATCH 09/16] nfs: Remove calls to folio_set_error Date: Thu, 30 May 2024 21:21:01 +0100 Message-ID: <20240530202110.2653630-10-willy@infradead.org> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240530202110.2653630-1-willy@infradead.org> References: <20240530202110.2653630-1-willy@infradead.org> Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Common code doesn't test the error flag, so we don't need to set it in nfs. We can use folio_end_read() to combine the setting (or not) of the uptodate flag and clearing the lock flag. Cc: Trond Myklebust Cc: Anna Schumaker Cc: linux-nfs@vger.kernel.org Signed-off-by: Matthew Wilcox (Oracle) --- fs/nfs/read.c | 2 -- fs/nfs/symlink.c | 12 ++---------- fs/nfs/write.c | 1 - 3 files changed, 2 insertions(+), 13 deletions(-) diff --git a/fs/nfs/read.c b/fs/nfs/read.c index a142287d86f6..cca80b5f54e0 100644 --- a/fs/nfs/read.c +++ b/fs/nfs/read.c @@ -122,8 +122,6 @@ static void nfs_readpage_release(struct nfs_page *req, int error) { struct folio *folio = nfs_page_to_folio(req); - if (nfs_error_is_fatal_on_server(error) && error != -ETIMEDOUT) - folio_set_error(folio); if (nfs_page_group_sync_on_bit(req, PG_UNLOCKPAGE)) if (nfs_netfs_folio_unlock(folio)) folio_unlock(folio); diff --git a/fs/nfs/symlink.c b/fs/nfs/symlink.c index 0e27a2e4e68b..1c62a5a9f51d 100644 --- a/fs/nfs/symlink.c +++ b/fs/nfs/symlink.c @@ -32,16 +32,8 @@ static int nfs_symlink_filler(struct file *file, struct folio *folio) int error; error = NFS_PROTO(inode)->readlink(inode, &folio->page, 0, PAGE_SIZE); - if (error < 0) - goto error; - folio_mark_uptodate(folio); - folio_unlock(folio); - return 0; - -error: - folio_set_error(folio); - folio_unlock(folio); - return -EIO; + folio_end_read(folio, error == 0); + return error; } static const char *nfs_get_link(struct dentry *dentry, diff --git a/fs/nfs/write.c b/fs/nfs/write.c index 3573cdc4b28f..85cddb2a6135 100644 --- a/fs/nfs/write.c +++ b/fs/nfs/write.c @@ -311,7 +311,6 @@ static void nfs_mapping_set_error(struct folio *folio, int error) { struct address_space *mapping = folio_file_mapping(folio); - folio_set_error(folio); filemap_set_wb_err(mapping, error); if (mapping->host) errseq_set(&mapping->host->i_sb->s_wb_err, From patchwork Thu May 30 20:21:02 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 13680815 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) (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 8A9821591E0 for ; Thu, 30 May 2024 20:21:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=90.155.50.34 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717100482; cv=none; b=vCMqAM1V9lQXLV+NGxnj/310E7nWWzpn/olgriC7fmKJw/StsVqkHTkTBvavwuJfgZq89C3NZJqo+f4bvI4flTCPTT3B365WxCwe2SuRJ2BKOWerRIdM/0zaHrEqzDtJggZXL1PZRg5d9jKokMedxckq4g5/GEM4uxF3wuX71Es= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717100482; c=relaxed/simple; bh=UJy8f6ZWcblFAMa4JzSNZFfvhlrtyqo8Nv2/n6Ropzs=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=n4Boq5A8o+tUczZRHldCz5lSFzAyaw3qTP7n0Z9xe9KTR4FdkxzJ8aH5wjnVqurHAAh7ST17Tj1cMv5/1d2v9u7WHKqiNeXy94us+6mCTOCzhO6pWLiGOMOeb/q4M23cf62x0zBbGAowKyAGkcoke9D2sBdwt9UrvfsdYCV3DOU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org; spf=none smtp.mailfrom=infradead.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b=GsIwjYph; arc=none smtp.client-ip=90.155.50.34 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=infradead.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="GsIwjYph" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description; bh=OVnmJh0dZ5waDkf7W6hgDh//gJkJckKQxE8pidyMhso=; b=GsIwjYph7o3c358/dFxb1kZ0Il xDQ3JqrX5TAlcazptV9oiBSQG9yfmm7PujuK8YFa82S8f6XSd8FZrCllccnlyYjPWPVh9KvgOZ4RC vOo4TZpN1bsdrqQO6f7+VhvzF7K+zIvrzuWL9+q7+QTHFGSVcRlVPnga6UG4zF/83AQ3s0TeFxIwc FMA65eZMENysFGutTxfAn/XW9ip0uKTpnCGputskMQEbBiEDSjsJqvhvZB2ZQmT5jHCWil9x3z9dB 9kT0Ce+e4QjhTS0OTh/mjCq1ppVc/HqaJBxW2pbCRxh7ZiQ8+gff4lH64RiOn5772/MFWWagHIgcQ LqrI/VxA==; Received: from willy by casper.infradead.org with local (Exim 4.97.1 #2 (Red Hat Linux)) id 1sCmH0-0000000B8LS-0nmG; Thu, 30 May 2024 20:21:18 +0000 From: "Matthew Wilcox (Oracle)" To: Christian Brauner Cc: "Matthew Wilcox (Oracle)" , linux-fsdevel@vger.kernel.org, Martin Brandenburg , devel@lists.orangefs.org, Mike Marshall Subject: [PATCH 10/16] orangefs: Remove calls to set/clear the error flag Date: Thu, 30 May 2024 21:21:02 +0100 Message-ID: <20240530202110.2653630-11-willy@infradead.org> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240530202110.2653630-1-willy@infradead.org> References: <20240530202110.2653630-1-willy@infradead.org> Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Nobody checks the error flag on orangefs folios, so stop setting and clearing it. We can also use folio_end_read() to simplify orangefs_read_folio(). Cc: Martin Brandenburg Cc: devel@lists.orangefs.org Signed-off-by: Matthew Wilcox (Oracle) Tested-by: Mike Marshall --- fs/orangefs/inode.c | 13 +++---------- fs/orangefs/orangefs-bufmap.c | 4 +--- 2 files changed, 4 insertions(+), 13 deletions(-) diff --git a/fs/orangefs/inode.c b/fs/orangefs/inode.c index 085912268442..fdb9b65db1de 100644 --- a/fs/orangefs/inode.c +++ b/fs/orangefs/inode.c @@ -56,7 +56,6 @@ static int orangefs_writepage_locked(struct page *page, ret = wait_for_direct_io(ORANGEFS_IO_WRITE, inode, &off, &iter, wlen, len, wr, NULL, NULL); if (ret < 0) { - SetPageError(page); mapping_set_error(page->mapping, ret); } else { ret = 0; @@ -119,7 +118,6 @@ static int orangefs_writepages_work(struct orangefs_writepages *ow, 0, &wr, NULL, NULL); if (ret < 0) { for (i = 0; i < ow->npages; i++) { - SetPageError(ow->pages[i]); mapping_set_error(ow->pages[i]->mapping, ret); if (PagePrivate(ow->pages[i])) { wrp = (struct orangefs_write_range *) @@ -303,15 +301,10 @@ static int orangefs_read_folio(struct file *file, struct folio *folio) iov_iter_zero(~0U, &iter); /* takes care of potential aliasing */ flush_dcache_folio(folio); - if (ret < 0) { - folio_set_error(folio); - } else { - folio_mark_uptodate(folio); + if (ret > 0) ret = 0; - } - /* unlock the folio after the ->read_folio() routine completes */ - folio_unlock(folio); - return ret; + folio_end_read(folio, ret == 0); + return ret; } static int orangefs_write_begin(struct file *file, diff --git a/fs/orangefs/orangefs-bufmap.c b/fs/orangefs/orangefs-bufmap.c index b501dc07f922..edcca4beb765 100644 --- a/fs/orangefs/orangefs-bufmap.c +++ b/fs/orangefs/orangefs-bufmap.c @@ -274,10 +274,8 @@ orangefs_bufmap_map(struct orangefs_bufmap *bufmap, gossip_err("orangefs error: asked for %d pages, only got %d.\n", bufmap->page_count, ret); - for (i = 0; i < ret; i++) { - SetPageError(bufmap->page_array[i]); + for (i = 0; i < ret; i++) unpin_user_page(bufmap->page_array[i]); - } return -ENOMEM; } From patchwork Thu May 30 20:21:03 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 13680809 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) (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 CFB38158DD5; Thu, 30 May 2024 20:21:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=90.155.50.34 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717100481; cv=none; b=MKZ5ryX3qk72jv825te1/otHrb5pYpY6PSuOAmeJLz2CtFXNhNin5bFVdaSXHL0DvRSmdjLC1qzCRDMRmsPQZB75lKaH0rn5Dy2hkWA75zQ4/gUIrFuU3Fls//SOKty8dzhIFOj6MAsTpekL9LSV4PYfNb0RmZf5fWlkpRoY5Os= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717100481; c=relaxed/simple; bh=MNGQdCHzW25/+wHhXwXH/NMqYp82RBGV7NnH0nnxDOs=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=p84n0VVpj84AWshTWq/s+hBrcNTEZZoI2gIKPAbILZmBISoql8UABnz98pzBi8Fp5YsRmegxIrj5ZdFAM2rAjn9JbI/EigjUp4UqE8nsmedCOFWCvrbS21QLseOVGVq4EtrBex2NLscIf6DClscZk9RMb5R0yvY0lvGX1+9iRRI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org; spf=none smtp.mailfrom=infradead.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b=XYv2onoa; arc=none smtp.client-ip=90.155.50.34 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=infradead.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="XYv2onoa" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description; bh=sKwEaDMykkWblPGLhfvrNLPmAWo/K3PNSs0OffOfMK8=; b=XYv2onoaar6xJLef6854BH5CWr kqBYB0uQUlqkI6Q9nnOVj4zVLHrP96PcvJCzdPDEn8D57SkzesW1n1JlN94PN6CNGwr6+3Pw3NNwh 03nJjKiFlwxZf/SGM/jelbXhImYTKSsFYOUfUhPmxtLPgq07rZwlArlua0FaZHQK5KEHpEBI1ZsJ0 xkzr000/ZKjj5IxEwxac67kTwTVOopvX/AOxrssbLR9nY12EVYax02HKrdka23D9qSp4UiRGwZ8Af EqMiLT1R7iGzVIIPRMKQO0HlCWlIp/MRiwdYC5WaKckBiY/xZGOlb7Bjp8ZYq7kK3LKxlBAb1A0Ja HYYL+lpQ==; Received: from willy by casper.infradead.org with local (Exim 4.97.1 #2 (Red Hat Linux)) id 1sCmH0-0000000B8LU-1Jr7; Thu, 30 May 2024 20:21:18 +0000 From: "Matthew Wilcox (Oracle)" To: Christian Brauner Cc: "Matthew Wilcox (Oracle)" , linux-fsdevel@vger.kernel.org, reiserfs-devel@vger.kernel.org Subject: [PATCH 11/16] reiserfs: Remove call to folio_set_error() Date: Thu, 30 May 2024 21:21:03 +0100 Message-ID: <20240530202110.2653630-12-willy@infradead.org> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240530202110.2653630-1-willy@infradead.org> References: <20240530202110.2653630-1-willy@infradead.org> Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 The error flag is never tested for reiserfs folios, so stop setting it. Cc: reiserfs-devel@vger.kernel.org Signed-off-by: Matthew Wilcox (Oracle) --- fs/reiserfs/inode.c | 1 - 1 file changed, 1 deletion(-) diff --git a/fs/reiserfs/inode.c b/fs/reiserfs/inode.c index c1daedc50f4c..9b43a81a6488 100644 --- a/fs/reiserfs/inode.c +++ b/fs/reiserfs/inode.c @@ -2699,7 +2699,6 @@ static int reiserfs_write_folio(struct folio *folio, } bh = bh->b_this_page; } while (bh != head); - folio_set_error(folio); BUG_ON(folio_test_writeback(folio)); folio_start_writeback(folio); folio_unlock(folio); From patchwork Thu May 30 20:21:04 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 13680810 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) (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 2B645158DD8 for ; Thu, 30 May 2024 20:21:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=90.155.50.34 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717100481; cv=none; b=klml3pKRgNj4JYgoNa8zZ6iW7AXqLRprHaX+qAdqhugTl0VBILK8RmEzRr6b3YkL6FtsujsjcdqRVUVBBCBDFdBHD9eZuA0bm4MeTSUHmrN8BaIaURJjRBHOmMJ89BKOmvZ1P/qhyfIbH6BJqm8StDCz0XrcHsagpncX++EziuE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717100481; c=relaxed/simple; bh=HXK9SrkeoGYeQqaRCbDyaBLW2cECSXCKLkdh+hbfB5M=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=BXUjkZDhiqvjDLfI8yi0ofuBv4bPxEfFc6hqDqDV4yhNJNgfdKKHNb4smPO5ipFH810rH1KQ9AxsbwtvYkRHVM7CIL3ZXln6pcgD8UTK/cjhCL0bDf44rZXEMcKtPnr5G7D85uex6PPvd+fpq+E3MbvKdcKaw9kmvPVKfVV0Lfc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org; spf=none smtp.mailfrom=infradead.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b=iWllsKEW; arc=none smtp.client-ip=90.155.50.34 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=infradead.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="iWllsKEW" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description; bh=c7vikNugCgi0jVhZmW+/vu+Luq6OpZDlsK0DHYxWiTc=; b=iWllsKEW/Za59bCRtpFF6Ms2Mf M7a1WaxTVZXbkTzVn1OX4WhHEmVMbtLsyrWSuD7N4NEGBlHIC969OwLmislF2ll+Y6zQdMX2oHlAH pG5KlDLN8NImAAGCBWNhuD3Hogesf4LNjRcIQLuSCYhiD1PLs+NsOasIw1bZpNgxkvGSm2RRl6IKH Ft18ocAHGMCv2VbHyUYzOMr294xkNuLMsTPya0emFiNBZIfclH3BxW76U782pbhJm5uh6WTBsPoe1 QKeyl8j4LgmdGF0RHJu8XLLb+XGCLDD/zmy1kfZHkwBFCce6PDzKiviDv7//z2vT5q5mOEQKd949u 6YvmrqWQ==; Received: from willy by casper.infradead.org with local (Exim 4.97.1 #2 (Red Hat Linux)) id 1sCmH0-0000000B8LW-1qBb; Thu, 30 May 2024 20:21:18 +0000 From: "Matthew Wilcox (Oracle)" To: Christian Brauner Cc: "Matthew Wilcox (Oracle)" , linux-fsdevel@vger.kernel.org Subject: [PATCH 12/16] romfs: Convert romfs_read_folio() to use a folio Date: Thu, 30 May 2024 21:21:04 +0100 Message-ID: <20240530202110.2653630-13-willy@infradead.org> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240530202110.2653630-1-willy@infradead.org> References: <20240530202110.2653630-1-willy@infradead.org> Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Remove the conversion back to struct page and use the folio APIs instead of the page APIs. It's probably more trouble than it's worth to support large folios in romfs, so there are still PAGE_SIZE assumptions in this function. Signed-off-by: Matthew Wilcox (Oracle) --- fs/romfs/super.c | 22 ++++++---------------- 1 file changed, 6 insertions(+), 16 deletions(-) diff --git a/fs/romfs/super.c b/fs/romfs/super.c index 2cbb92462074..68758b6fed94 100644 --- a/fs/romfs/super.c +++ b/fs/romfs/super.c @@ -101,19 +101,15 @@ static struct inode *romfs_iget(struct super_block *sb, unsigned long pos); */ static int romfs_read_folio(struct file *file, struct folio *folio) { - struct page *page = &folio->page; - struct inode *inode = page->mapping->host; + struct inode *inode = folio->mapping->host; loff_t offset, size; unsigned long fillsize, pos; void *buf; int ret; - buf = kmap(page); - if (!buf) - return -ENOMEM; + buf = kmap_local_folio(folio, 0); - /* 32 bit warning -- but not for us :) */ - offset = page_offset(page); + offset = folio_pos(folio); size = i_size_read(inode); fillsize = 0; ret = 0; @@ -125,20 +121,14 @@ static int romfs_read_folio(struct file *file, struct folio *folio) ret = romfs_dev_read(inode->i_sb, pos, buf, fillsize); if (ret < 0) { - SetPageError(page); fillsize = 0; ret = -EIO; } } - if (fillsize < PAGE_SIZE) - memset(buf + fillsize, 0, PAGE_SIZE - fillsize); - if (ret == 0) - SetPageUptodate(page); - - flush_dcache_page(page); - kunmap(page); - unlock_page(page); + buf = folio_zero_tail(folio, fillsize, buf); + kunmap_local(buf); + folio_end_read(folio, ret == 0); return ret; } From patchwork Thu May 30 20:21:05 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 13680814 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) (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 8400B158DDF for ; Thu, 30 May 2024 20:21:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=90.155.50.34 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717100482; cv=none; b=CgsIG2WcNLyf6KEIbevNqFj7RN6QpclvC0ZjIHIMofEMXXPe30ziXv7e4K5C4QFUjM4FvN5I3uUeG2RFnPLuRI2OgJuFvw/ReVFwAe5J+6KG87AeChth7c64SYeVUFf0zGgU7j0owq8D+wq3cQrOTrRbOBpCX8co34cnSbF5Nlk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717100482; c=relaxed/simple; bh=WdKGX7UsrMBGTyHTctOYjOqge8sOsjhllPvtQJOQZPM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=mNIA8gtOK1vZaWJsM0LaMlRZXlZQVa+BxIewqGG5pS6Rz+OaLyzHAmwMxFY15Km610+pnkwXmMe04AJtTrPwT32yOjjsxMocGFo1ibmLm/o3wPq+HKLMXsWT8TPQ8L/voZepTVcHt+OiHuRLQ28qIcLzsGwQg5SJ2M/LQO4kntI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org; spf=none smtp.mailfrom=infradead.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b=G5Q6Fj/X; arc=none smtp.client-ip=90.155.50.34 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=infradead.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="G5Q6Fj/X" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description; bh=a7yHNOZFt+0LQm68oxpHbAaQyBDUjkgZ9Hyez6IHxQc=; b=G5Q6Fj/Xu/L5wU8cnT9yooE1il WGQJ73jVWUjiHn5TJhMJEJs5pmFUu1VU2X5Md/3PbQW+JfFcDofEUieOy/wY6dKQ8hO/dz8kpQ2lF O3DVsTErmtqTaGNikzoNJkiU4eSNjfDb+/BCn7Gaj/hLqppRXif2ntctPdjGpYhmzdLAS5PwjIjIi oHO3Ho51/UNpx9uP0SEU2iF1yRlC+NW3Mhr+cvGuacjDPtsBl7w3zN6k5PrUtwFppbBS9xC/kwFjg byVf1hBKwsCuLqh8+tU8+LMLoVAAxIXzjgBQ8VsYUYEjkb6CkbWrmNIUbJfI92YdKEzZTFUyj2Ieq iyieFIPQ==; Received: from willy by casper.infradead.org with local (Exim 4.97.1 #2 (Red Hat Linux)) id 1sCmH0-0000000B8Lc-2cdF; Thu, 30 May 2024 20:21:18 +0000 From: "Matthew Wilcox (Oracle)" To: Christian Brauner Cc: "Matthew Wilcox (Oracle)" , linux-fsdevel@vger.kernel.org, Evgeniy Dushistov Subject: [PATCH 13/16] ufs: Remove call to set the folio error flag Date: Thu, 30 May 2024 21:21:05 +0100 Message-ID: <20240530202110.2653630-14-willy@infradead.org> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240530202110.2653630-1-willy@infradead.org> References: <20240530202110.2653630-1-willy@infradead.org> Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Nobody checks the error flag on ufs folios, so stop setting it. Cc: Evgeniy Dushistov Signed-off-by: Matthew Wilcox (Oracle) --- fs/ufs/dir.c | 1 - 1 file changed, 1 deletion(-) diff --git a/fs/ufs/dir.c b/fs/ufs/dir.c index 27c85d92d1dc..61f25d3cf3f7 100644 --- a/fs/ufs/dir.c +++ b/fs/ufs/dir.c @@ -188,7 +188,6 @@ static bool ufs_check_page(struct page *page) "offset=%lu", dir->i_ino, (page->index< X-Patchwork-Id: 13680820 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) (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 8A91E158DCD for ; Thu, 30 May 2024 20:21:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=90.155.50.34 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717100483; cv=none; b=eewN9QQCIRNUHourvLxHC7Fnt9qP8Cs2OAKnAEoeSv+S6kSGX3CTH1oB3p6rJIg07HF2LI2GoYQ6AKWD4XliRNKlt3koECGJIzqPNDfI3Oq90riUr4PauYu/+85Smgv6PBduUTmEcc7u39386CkWgc3ReJhRgCTJthZaVLToNR4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717100483; c=relaxed/simple; bh=CgkORveIcAvhNacBC7kPYVAqzTYlPPqni/6Vscfx2dg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=DtGQRWvkNx/O2fd6ZSEN+ll+X8jvXqswe9bnL7sJIWuEfnWuiV1xC1s7EuBtEDnpuBGD5LTPJDU/+U9Yq4Yhhj8ZXMKUOgpBYzwz+KCTVTfVwHSZ1USUN8fVAmSPG07Sj8SdCIMkw9xdAxCU/rm60TSK/KEG/JTOQ0SxoZJF1FM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org; spf=none smtp.mailfrom=infradead.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b=G6+lGuEb; arc=none smtp.client-ip=90.155.50.34 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=infradead.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="G6+lGuEb" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description; bh=6Zwj6o5e9GCXPyUfI1AfjNmWw9pmdltYh5Ep8mr94ps=; b=G6+lGuEbY6O31LkxmLLui14ZfG a3wJKQYx79zctoj+Ft5IDtZMJc9NnsZ+MRDkgxPU8Zh4farwAuW9aOg3vGho9NVDoqVT1JjebUUeH rMA4qgHoqdkY0E3H9fpydQZWLNDucEds6V+UODjfoScCfs+9uUDzgugwMRQO+Iqkv6w8zsV4dq6zn OhneTjRjawuUVK2eGx76FWOAT8qrPnbNyP5O5Cvqz/1ImSpr/5kYuJRzKzoCI4R4LRPIZHAee+SNf sy9BYb09X9D7tvybKyhq603idw8PhLK+ZEQjz9naUrDfCMuSyVxbvFTYCY4cLGceWnnp8w9BDa0+o SSjWjNAg==; Received: from willy by casper.infradead.org with local (Exim 4.97.1 #2 (Red Hat Linux)) id 1sCmH0-0000000B8Lk-3I4D; Thu, 30 May 2024 20:21:18 +0000 From: "Matthew Wilcox (Oracle)" To: Christian Brauner Cc: "Matthew Wilcox (Oracle)" , linux-fsdevel@vger.kernel.org, Hans de Goede Subject: [PATCH 14/16] vboxsf: Convert vboxsf_read_folio() to use a folio Date: Thu, 30 May 2024 21:21:06 +0100 Message-ID: <20240530202110.2653630-15-willy@infradead.org> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240530202110.2653630-1-willy@infradead.org> References: <20240530202110.2653630-1-willy@infradead.org> Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Remove conversion to a page and use folio APIs throughout. This includes a removal of setting the error flag as nobody checks the error flag on vboxsf folios. This does not include large folio support as we would have to map each page individually. Signed-off-by: Matthew Wilcox (Oracle) Tested-by: Hans de Goede Reviewed-by: Hans de Goede --- fs/vboxsf/file.c | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) diff --git a/fs/vboxsf/file.c b/fs/vboxsf/file.c index 118dedef8ebe..fdb4da24d662 100644 --- a/fs/vboxsf/file.c +++ b/fs/vboxsf/file.c @@ -228,26 +228,19 @@ const struct inode_operations vboxsf_reg_iops = { static int vboxsf_read_folio(struct file *file, struct folio *folio) { - struct page *page = &folio->page; struct vboxsf_handle *sf_handle = file->private_data; - loff_t off = page_offset(page); + loff_t off = folio_pos(folio); u32 nread = PAGE_SIZE; u8 *buf; int err; - buf = kmap(page); + buf = kmap_local_folio(folio, 0); err = vboxsf_read(sf_handle->root, sf_handle->handle, off, &nread, buf); - if (err == 0) { - memset(&buf[nread], 0, PAGE_SIZE - nread); - flush_dcache_page(page); - SetPageUptodate(page); - } else { - SetPageError(page); - } + buf = folio_zero_tail(folio, nread, buf + nread); - kunmap(page); - unlock_page(page); + kunmap_local(buf); + folio_end_read(folio, err == 0); return err; } @@ -295,7 +288,6 @@ static int vboxsf_writepage(struct page *page, struct writeback_control *wbc) kref_put(&sf_handle->refcount, vboxsf_handle_release); if (err == 0) { - ClearPageError(page); /* mtime changed */ sf_i->force_restat = 1; } else { From patchwork Thu May 30 20:21:07 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 13680817 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) (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 62071158A0D; Thu, 30 May 2024 20:21:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=90.155.50.34 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717100482; cv=none; b=HbL6kQ/Z0cKA/ZY6Zo0ZfhIS5XBk7Dc5+Dth5tAPGL52LHzA4o6dNJGvoLpszjGtPbxxXJBEvlB5PxxKQTJngFrfuGNqW52aci5YTPWrja5QZI7kXziamgRoMoY3uEIA1BScqApaN+BjmUev/3YKtgIGuSDqMa/sCCh4KQ23dG0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717100482; c=relaxed/simple; bh=w6GvfP62T9SLPSb2tfSEk9b9tce2HSypWFfEjPIZObQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Yju2CnLav6GNJumMT+sUt6QtFeAqO9vd9us7zMr0MKB8e8w+7e0COLaO2mVhnF8l1TS0qmPBkjgdQEXvOq9t/sgQ8SUP4yyy2n4uW9/eCQpMgxk2JH9BvjMvbu1ZwvofW7vmc17WXzWmvi1/X4KKipk9DFdklYG31/IN+oUz4pE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org; spf=none smtp.mailfrom=infradead.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b=N5jCjK0r; arc=none smtp.client-ip=90.155.50.34 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=infradead.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="N5jCjK0r" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description; bh=+YDFhLGOb+ruafHTm4Z7krNJ+BxgfPnzFmdjq0f4XNk=; b=N5jCjK0rPDkGvVQsPNgqdn6J4L FrlE9Q9DRg4J69uky1DS4B+LfjntCMwFE0/shvvmSMDstfWEX8zSg+anbDPCq+A/p3osKu+E0q9RO rXD/kduRd9LbSkAYuHpFBVU9tJA9xnUO34NcicQctEtLJnm1wtzLHOpss8axxdgx9H8jlRC7dfZQU htV0d4jZFsY2LgQzGIuIP4Fx4eaMhgZx4sp+aKzYpypD4637P3eW4cnYqfJgHaF2cOL2SE2rzSNHr mIh1OGi7U9sQsK+H9/KOEtzYhZjqfAuvBMYsfEJDmRzNTbv28Vs6iTzJHlVGLgOS6blMyFAJOJ32g aCTW1LBg==; Received: from willy by casper.infradead.org with local (Exim 4.97.1 #2 (Red Hat Linux)) id 1sCmH0-0000000B8Lv-3edE; Thu, 30 May 2024 20:21:18 +0000 From: "Matthew Wilcox (Oracle)" To: Christian Brauner Cc: "Matthew Wilcox (Oracle)" , linux-fsdevel@vger.kernel.org, linux-xfs@vger.kernel.org, "Darrick J . Wong" Subject: [PATCH 15/16] iomap: Remove calls to set and clear folio error flag Date: Thu, 30 May 2024 21:21:07 +0100 Message-ID: <20240530202110.2653630-16-willy@infradead.org> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240530202110.2653630-1-willy@infradead.org> References: <20240530202110.2653630-1-willy@infradead.org> Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 The folio error flag is not checked anywhere, so we can remove the calls to set and clear it. Cc: Christian Brauner Cc: linux-xfs@vger.kernel.org Signed-off-by: Matthew Wilcox (Oracle) Reviewed-by: Darrick J. Wong --- fs/iomap/buffered-io.c | 8 -------- 1 file changed, 8 deletions(-) diff --git a/fs/iomap/buffered-io.c b/fs/iomap/buffered-io.c index c5802a459334..49938419fcc7 100644 --- a/fs/iomap/buffered-io.c +++ b/fs/iomap/buffered-io.c @@ -306,8 +306,6 @@ static void iomap_finish_folio_read(struct folio *folio, size_t off, spin_unlock_irqrestore(&ifs->state_lock, flags); } - if (error) - folio_set_error(folio); if (finished) folio_end_read(folio, uptodate); } @@ -460,9 +458,6 @@ int iomap_read_folio(struct folio *folio, const struct iomap_ops *ops) while ((ret = iomap_iter(&iter, ops)) > 0) iter.processed = iomap_readpage_iter(&iter, &ctx, 0); - if (ret < 0) - folio_set_error(folio); - if (ctx.bio) { submit_bio(ctx.bio); WARN_ON_ONCE(!ctx.cur_folio_in_bio); @@ -697,7 +692,6 @@ static int __iomap_write_begin(const struct iomap_iter *iter, loff_t pos, if (folio_test_uptodate(folio)) return 0; - folio_clear_error(folio); do { iomap_adjust_read_range(iter->inode, folio, &block_start, @@ -1543,8 +1537,6 @@ iomap_finish_ioend(struct iomap_ioend *ioend, int error) /* walk all folios in bio, ending page IO on them */ bio_for_each_folio_all(fi, bio) { - if (error) - folio_set_error(fi.folio); iomap_finish_folio_write(inode, fi.folio, fi.length); folio_count++; } From patchwork Thu May 30 20:21:08 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 13680821 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) (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 A8E2E176ACA for ; Thu, 30 May 2024 20:21:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=90.155.50.34 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717100485; cv=none; b=k+sadiyjehrwWLKWKnnTwL2S1HqCUoOm1PbcDImbpQMyrWZ+Bk8/vNt3w6ZEOv6fmNYsNOcaEwn6KeREtVatJ8Wicg7fCLJy//09oKDH7TW1jwssc4onPxFxkacjNI55HH1KRB7Y/I11oNj2A97nAQQaolp9y3zMcGw4s1OvCsk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717100485; c=relaxed/simple; bh=rI9d1HVrZWFdNh+tkuaswx/LDTv123ObI5TZxLQNISY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=H3JCfv/jSAP8FnV0rdZK7w2fwTV9d/Vp4dRtKgZ4ZVYc5vrFCTT/u52PGjQGidqSFGkd0QDcQR4wKgV/dzcOWlbqmKmrbIgTMA4+qmuw1Rq90e1hksyXsyTmKEEeviJkeJRorokxq1z6HrO4jXIVgpp3oFxXyCpzqzISOyNIzFQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org; spf=none smtp.mailfrom=infradead.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b=d6GDWEHm; arc=none smtp.client-ip=90.155.50.34 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=infradead.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="d6GDWEHm" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description; bh=IiUZzllF8/N0Vx665SJISBH9NzvoaiBdnUIxv8cYqnI=; b=d6GDWEHmD12A7bsCJh+cBgfJH4 x4T8PgQRT6PWGi/qhBN5qlUXeJeEUsJd6kFUGF3mG/L+Mcuu97dWAMGrcu8a3DbdNkxr5Fd275B4v K7FShkct7O2haz+lAfAhGZf9H3Vr6IMlNWU6SSo5nbKLeEsLjQXAxFn0EdyGGIWfMYL8ALVgGqwxG AICqauldTdt9mpoftucQCNe5JLl7oo1LC4mmEsaI7Cc8ERO6B0JKa8jXuIDaGc0sNl4hIOAY+2ZhW WPqHsvPCvXQ8TbCL0HVJqTQ4ZbOnQdQIGCrP9wD5cAOFevKH8ScKJzK8nbgLdCkEM04YXc3Xyqvrp RrfkEVow==; Received: from willy by casper.infradead.org with local (Exim 4.97.1 #2 (Red Hat Linux)) id 1sCmH0-0000000B8Lx-426n; Thu, 30 May 2024 20:21:19 +0000 From: "Matthew Wilcox (Oracle)" To: Christian Brauner Cc: "Matthew Wilcox (Oracle)" , linux-fsdevel@vger.kernel.org Subject: [PATCH 16/16] buffer: Remove calls to set and clear the folio error flag Date: Thu, 30 May 2024 21:21:08 +0100 Message-ID: <20240530202110.2653630-17-willy@infradead.org> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240530202110.2653630-1-willy@infradead.org> References: <20240530202110.2653630-1-willy@infradead.org> Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 The folio error flag is not tested anywhere, so we can stop setting and clearing it. Signed-off-by: Matthew Wilcox (Oracle) --- fs/buffer.c | 7 +------ fs/mpage.c | 13 +++---------- 2 files changed, 4 insertions(+), 16 deletions(-) diff --git a/fs/buffer.c b/fs/buffer.c index 8c19e705b9c3..dbe8f411ce52 100644 --- a/fs/buffer.c +++ b/fs/buffer.c @@ -258,7 +258,6 @@ static void end_buffer_async_read(struct buffer_head *bh, int uptodate) } else { clear_buffer_uptodate(bh); buffer_io_error(bh, ", async page read"); - folio_set_error(folio); } /* @@ -391,7 +390,6 @@ static void end_buffer_async_write(struct buffer_head *bh, int uptodate) buffer_io_error(bh, ", lost async page write"); mark_buffer_write_io_error(bh); clear_buffer_uptodate(bh); - folio_set_error(folio); } first = folio_buffers(folio); @@ -1960,7 +1958,6 @@ int __block_write_full_folio(struct inode *inode, struct folio *folio, clear_buffer_dirty(bh); } } while ((bh = bh->b_this_page) != head); - folio_set_error(folio); BUG_ON(folio_test_writeback(folio)); mapping_set_error(folio->mapping, err); folio_start_writeback(folio); @@ -2405,10 +2402,8 @@ int block_read_full_folio(struct folio *folio, get_block_t *get_block) if (iblock < lblock) { WARN_ON(bh->b_size != blocksize); err = get_block(inode, iblock, bh, 0); - if (err) { - folio_set_error(folio); + if (err) page_error = true; - } } if (!buffer_mapped(bh)) { folio_zero_range(folio, i * blocksize, diff --git a/fs/mpage.c b/fs/mpage.c index fa8b99a199fa..b5b5ddf9d513 100644 --- a/fs/mpage.c +++ b/fs/mpage.c @@ -48,13 +48,8 @@ static void mpage_read_end_io(struct bio *bio) struct folio_iter fi; int err = blk_status_to_errno(bio->bi_status); - bio_for_each_folio_all(fi, bio) { - if (err) - folio_set_error(fi.folio); - else - folio_mark_uptodate(fi.folio); - folio_unlock(fi.folio); - } + bio_for_each_folio_all(fi, bio) + folio_end_read(fi.folio, err == 0); bio_put(bio); } @@ -65,10 +60,8 @@ static void mpage_write_end_io(struct bio *bio) int err = blk_status_to_errno(bio->bi_status); bio_for_each_folio_all(fi, bio) { - if (err) { - folio_set_error(fi.folio); + if (err) mapping_set_error(fi.folio->mapping, err); - } folio_end_writeback(fi.folio); }