From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A1543C5479D for ; Mon, 9 Jan 2023 05:19:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236341AbjAIFTD (ORCPT ); Mon, 9 Jan 2023 00:19:03 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53586 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234227AbjAIFSS (ORCPT ); Mon, 9 Jan 2023 00:18:18 -0500 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 51C8AD127; Sun, 8 Jan 2023 21:18:15 -0800 (PST) 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=k+ZZta1I7fiddKSuD0VDKROProxG+mv989F2OQevFVE=; b=DoU3MBHwJXeUVlXpjR6BahDygE rEByLa9Kflz15xo39pKdfYcKiETrJxGAkDDIbdIRjAGz/2E2RS4zEGILLyeqi9+0oACdLFofz2Eyi s6f9m61E66DO+xVmMf8K2EY5OIGT2ttz5Q/c+eaMDstvvR5SvYWv5iL99XYnfo0i+EZw8gogjFn6/ 3CyvkQspNvX+c3ppbQ0JYxfo6J8koDQa9sFSx6I/T6fXMY28OQdYc1E8eM/bKizrOzUkkjPnOplht +UMBnwvIz/lKlPh5NwijUi27DC/U4yD7F7LdoRBlZnWa00pQ/DnconPqvKN98qR+aN5WcURO4Hv27 J0LlnnNg==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1pEkYD-0020xB-Nx; Mon, 09 Jan 2023 05:18:25 +0000 From: "Matthew Wilcox (Oracle)" Cc: "Matthew Wilcox (Oracle)" , Jeff Layton , linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, Christoph Hellwig Subject: [PATCH 07/11] filemap: Convert filemap_fdatawait_range() to errseq Date: Mon, 9 Jan 2023 05:18:19 +0000 Message-Id: <20230109051823.480289-8-willy@infradead.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20230109051823.480289-1-willy@infradead.org> References: <20230109051823.480289-1-willy@infradead.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit To: unlisted-recipients:; (no To-header on input) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This removes the unwelcome behaviour of clearing the errors in the address space, which is the same behaviour as filemap_fdatawait_range_keep_errors(), so unify the two functions. We can also get rid of filemap_fdatawait_keep_errors() as it is now the same as filemap_fdatawait() Signed-off-by: Matthew Wilcox (Oracle) --- include/linux/pagemap.h | 7 +++--- mm/filemap.c | 51 +---------------------------------------- 2 files changed, 5 insertions(+), 53 deletions(-) diff --git a/include/linux/pagemap.h b/include/linux/pagemap.h index 29e1f9e76eb6..985fd47739f4 100644 --- a/include/linux/pagemap.h +++ b/include/linux/pagemap.h @@ -33,16 +33,17 @@ int invalidate_inode_pages2_range(struct address_space *mapping, int write_inode_now(struct inode *, int sync); int filemap_fdatawrite(struct address_space *); int filemap_flush(struct address_space *); -int filemap_fdatawait_keep_errors(struct address_space *mapping); int filemap_fdatawait_range(struct address_space *, loff_t lstart, loff_t lend); -int filemap_fdatawait_range_keep_errors(struct address_space *mapping, - loff_t start_byte, loff_t end_byte); static inline int filemap_fdatawait(struct address_space *mapping) { return filemap_fdatawait_range(mapping, 0, LLONG_MAX); } +#define filemap_fdatawait_range_keep_errors(mapping, start, end) \ + filemap_fdatawait_range(mapping, start, end) +#define filemap_fdatawait_keep_errors(mapping) filemap_fdatawait(mapping) + bool filemap_range_has_page(struct address_space *, loff_t lstart, loff_t lend); int filemap_write_and_wait_range(struct address_space *mapping, loff_t lstart, loff_t lend); diff --git a/mm/filemap.c b/mm/filemap.c index c72b2e1140d7..887520db115a 100644 --- a/mm/filemap.c +++ b/mm/filemap.c @@ -526,43 +526,17 @@ static void __filemap_fdatawait_range(struct address_space *mapping, * in the given range and wait for all of them. Check error status of * the address space and return it. * - * Since the error status of the address space is cleared by this function, - * callers are responsible for checking the return value and handling and/or - * reporting the error. - * * Return: error status of the address space. */ int filemap_fdatawait_range(struct address_space *mapping, loff_t start_byte, loff_t end_byte) -{ - __filemap_fdatawait_range(mapping, start_byte, end_byte); - return filemap_check_errors(mapping); -} -EXPORT_SYMBOL(filemap_fdatawait_range); - -/** - * filemap_fdatawait_range_keep_errors - wait for writeback to complete - * @mapping: address space structure to wait for - * @start_byte: offset in bytes where the range starts - * @end_byte: offset in bytes where the range ends (inclusive) - * - * Walk the list of under-writeback pages of the given address space in the - * given range and wait for all of them. Unlike filemap_fdatawait_range(), - * this function does not clear error status of the address space. - * - * Use this function if callers don't handle errors themselves. Expected - * call sites are system-wide / filesystem-wide data flushers: e.g. sync(2), - * fsfreeze(8) - */ -int filemap_fdatawait_range_keep_errors(struct address_space *mapping, - loff_t start_byte, loff_t end_byte) { errseq_t since = filemap_sample_wb_err(mapping); __filemap_fdatawait_range(mapping, start_byte, end_byte); return filemap_check_wb_err(mapping, since); } -EXPORT_SYMBOL(filemap_fdatawait_range_keep_errors); +EXPORT_SYMBOL(filemap_fdatawait_range); /** * file_fdatawait_range - wait for writeback to complete @@ -589,29 +563,6 @@ int file_fdatawait_range(struct file *file, loff_t start_byte, loff_t end_byte) } EXPORT_SYMBOL(file_fdatawait_range); -/** - * filemap_fdatawait_keep_errors - wait for writeback without clearing errors - * @mapping: address space structure to wait for - * - * Walk the list of under-writeback pages of the given address space - * and wait for all of them. Unlike filemap_fdatawait(), this function - * does not clear error status of the address space. - * - * Use this function if callers don't handle errors themselves. Expected - * call sites are system-wide / filesystem-wide data flushers: e.g. sync(2), - * fsfreeze(8) - * - * Return: error status of the address space. - */ -int filemap_fdatawait_keep_errors(struct address_space *mapping) -{ - errseq_t since = filemap_sample_wb_err(mapping); - - __filemap_fdatawait_range(mapping, 0, LLONG_MAX); - return filemap_check_wb_err(mapping, since); -} -EXPORT_SYMBOL(filemap_fdatawait_keep_errors); - /* Returns true if writeback might be needed or already in progress. */ static bool mapping_needs_writeback(struct address_space *mapping) { -- 2.35.1 From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 83BEAC5479D for ; Mon, 9 Jan 2023 05:18:24 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 086F68E0005; Mon, 9 Jan 2023 00:18:23 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id F3C0E8E0002; Mon, 9 Jan 2023 00:18:22 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id B6C8B8E0007; Mon, 9 Jan 2023 00:18:22 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id 8F3DA8E0002 for ; Mon, 9 Jan 2023 00:18:22 -0500 (EST) Received: from smtpin03.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 5D32716025F for ; Mon, 9 Jan 2023 05:18:22 +0000 (UTC) X-FDA: 80334104844.03.7781372 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf22.hostedemail.com (Postfix) with ESMTP id 9B396C0007 for ; Mon, 9 Jan 2023 05:18:20 +0000 (UTC) Authentication-Results: imf22.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=DoU3MBHw; spf=none (imf22.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org; dmarc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1673241501; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=k+ZZta1I7fiddKSuD0VDKROProxG+mv989F2OQevFVE=; b=QfKxjAWYgF7flD8pT10sYTYtevYGCrajLU/SQALJ9l+Yyyuv71D1YnM5o4GzghIzQd3gYm kS0tbruzfl22O7DjgRKAlPpKSXZpelliBdUMLJP3IN0S5TMO5Rt2WqNThndkXG/KA5kKaE xp5jtZIk5Yq3/LZhqbAE+gXN15z4Kmc= ARC-Authentication-Results: i=1; imf22.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=DoU3MBHw; spf=none (imf22.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org; dmarc=none ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1673241501; a=rsa-sha256; cv=none; b=1/PRPM5k4z69Q0aY8vXe3xSUpn799GB3STa5knM2K0ci129mnCgNb0QeNH/XGuwk0vAXFq tGq+4mm+tv0yXj79UlVz9mA2bmEF178A+v7PhaBCB+CoGaUxUg6c8J+I//msiYlSJcJcTa yp/dtFk5VuQbCLROd3AGyEqueXcpnFU= 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=k+ZZta1I7fiddKSuD0VDKROProxG+mv989F2OQevFVE=; b=DoU3MBHwJXeUVlXpjR6BahDygE rEByLa9Kflz15xo39pKdfYcKiETrJxGAkDDIbdIRjAGz/2E2RS4zEGILLyeqi9+0oACdLFofz2Eyi s6f9m61E66DO+xVmMf8K2EY5OIGT2ttz5Q/c+eaMDstvvR5SvYWv5iL99XYnfo0i+EZw8gogjFn6/ 3CyvkQspNvX+c3ppbQ0JYxfo6J8koDQa9sFSx6I/T6fXMY28OQdYc1E8eM/bKizrOzUkkjPnOplht +UMBnwvIz/lKlPh5NwijUi27DC/U4yD7F7LdoRBlZnWa00pQ/DnconPqvKN98qR+aN5WcURO4Hv27 J0LlnnNg==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1pEkYD-0020xB-Nx; Mon, 09 Jan 2023 05:18:25 +0000 From: "Matthew Wilcox (Oracle)" To: Cc: "Matthew Wilcox (Oracle)" , Jeff Layton , linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, Christoph Hellwig Subject: [PATCH 07/11] filemap: Convert filemap_fdatawait_range() to errseq Date: Mon, 9 Jan 2023 05:18:19 +0000 Message-Id: <20230109051823.480289-8-willy@infradead.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20230109051823.480289-1-willy@infradead.org> References: <20230109051823.480289-1-willy@infradead.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 9B396C0007 X-Stat-Signature: w3d94tynki5f3x5rzyzhsx19mif8guxy X-Rspam-User: X-Rspamd-Server: rspam08 X-HE-Tag: 1673241500-497069 X-HE-Meta: U2FsdGVkX18TQK7inR+W/QWt2Zh/S0BxyGkuXSuHjXBNrWGWWaOR+gxnNnrwtAut4Myz5EpYhptiLTGOmKP7LQVGbUbnGUzKMb53da1n8mb9cChtzf+XNuKVB3w/6FXfOZaSw7slLT7FEonVeShJ4sM41A2vQf+GGoYm8CmN6U7oXH6y/Qz0HZGNENqF5gYsZshOHpRYihmf9C/4zxFtKgHE9Cqnx2mXblKZWjq6hRAYCnnC3E3OXP4xna4yOKy2+Pbatt5SmMfuLFSotuXemnwoCWWCQgpxx9ycw0PRB0bjjU5ImZ/nAS5hC2IgGsj4kxYstXeL0QhWy++pwDFeZIUmHjdHeEvRMKOb5WE0qkBRirgZX98+splUGEWnIkOWigcnh+PiqzUe3brlxdqu8l+nEL8r/VnwV+omOeZMNUgzVPgM/uuyBG9fZwQrB+x65iUx5+YKWqlBBNUff1AKECHpOg8N1NLpmcPuxuIPXqACqUtSLyQnkPMdTzf0cJmorv04oGSnB/XHXcahLdW3zEqzdN/BO2cujfvGA/mAY01q7l3GkyvycGX7PsLJhMNkU5k0PUp44VoItF96HjsqNQrEHT9+LIL//u2kyYPvJPsv8nczNTKF179zwj5bnuVsLr8GU9ZX80TlSPEd+Y2co5Lk/0wyRMrW3lD6JPtWByeLBd2r4eH3egQeL+/VpNlro4dStX3fv0HJSJK21j0rrUp8l8zdxbFZw7eYOOC4IUR+akKBV1hV59uSS2TF/6ffwITjGKtgApby/RAXKwi4PAQMcydGs801Nd03hkSPuS3tRgAX0skH+ZNrDYjSTJAiMFveGiuWSEv4dSjQW5z03RW/3vNA0CcA+8cjquIy0B7XHwkfKfZ2bjsR/JrFIJAsMPA+VMB0cFIYTYgXEyH5apWjkjBn0CFdFiiuobPrjUwPWo5auiSNxw== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: This removes the unwelcome behaviour of clearing the errors in the address space, which is the same behaviour as filemap_fdatawait_range_keep_errors(), so unify the two functions. We can also get rid of filemap_fdatawait_keep_errors() as it is now the same as filemap_fdatawait() Signed-off-by: Matthew Wilcox (Oracle) --- include/linux/pagemap.h | 7 +++--- mm/filemap.c | 51 +---------------------------------------- 2 files changed, 5 insertions(+), 53 deletions(-) diff --git a/include/linux/pagemap.h b/include/linux/pagemap.h index 29e1f9e76eb6..985fd47739f4 100644 --- a/include/linux/pagemap.h +++ b/include/linux/pagemap.h @@ -33,16 +33,17 @@ int invalidate_inode_pages2_range(struct address_space *mapping, int write_inode_now(struct inode *, int sync); int filemap_fdatawrite(struct address_space *); int filemap_flush(struct address_space *); -int filemap_fdatawait_keep_errors(struct address_space *mapping); int filemap_fdatawait_range(struct address_space *, loff_t lstart, loff_t lend); -int filemap_fdatawait_range_keep_errors(struct address_space *mapping, - loff_t start_byte, loff_t end_byte); static inline int filemap_fdatawait(struct address_space *mapping) { return filemap_fdatawait_range(mapping, 0, LLONG_MAX); } +#define filemap_fdatawait_range_keep_errors(mapping, start, end) \ + filemap_fdatawait_range(mapping, start, end) +#define filemap_fdatawait_keep_errors(mapping) filemap_fdatawait(mapping) + bool filemap_range_has_page(struct address_space *, loff_t lstart, loff_t lend); int filemap_write_and_wait_range(struct address_space *mapping, loff_t lstart, loff_t lend); diff --git a/mm/filemap.c b/mm/filemap.c index c72b2e1140d7..887520db115a 100644 --- a/mm/filemap.c +++ b/mm/filemap.c @@ -526,43 +526,17 @@ static void __filemap_fdatawait_range(struct address_space *mapping, * in the given range and wait for all of them. Check error status of * the address space and return it. * - * Since the error status of the address space is cleared by this function, - * callers are responsible for checking the return value and handling and/or - * reporting the error. - * * Return: error status of the address space. */ int filemap_fdatawait_range(struct address_space *mapping, loff_t start_byte, loff_t end_byte) -{ - __filemap_fdatawait_range(mapping, start_byte, end_byte); - return filemap_check_errors(mapping); -} -EXPORT_SYMBOL(filemap_fdatawait_range); - -/** - * filemap_fdatawait_range_keep_errors - wait for writeback to complete - * @mapping: address space structure to wait for - * @start_byte: offset in bytes where the range starts - * @end_byte: offset in bytes where the range ends (inclusive) - * - * Walk the list of under-writeback pages of the given address space in the - * given range and wait for all of them. Unlike filemap_fdatawait_range(), - * this function does not clear error status of the address space. - * - * Use this function if callers don't handle errors themselves. Expected - * call sites are system-wide / filesystem-wide data flushers: e.g. sync(2), - * fsfreeze(8) - */ -int filemap_fdatawait_range_keep_errors(struct address_space *mapping, - loff_t start_byte, loff_t end_byte) { errseq_t since = filemap_sample_wb_err(mapping); __filemap_fdatawait_range(mapping, start_byte, end_byte); return filemap_check_wb_err(mapping, since); } -EXPORT_SYMBOL(filemap_fdatawait_range_keep_errors); +EXPORT_SYMBOL(filemap_fdatawait_range); /** * file_fdatawait_range - wait for writeback to complete @@ -589,29 +563,6 @@ int file_fdatawait_range(struct file *file, loff_t start_byte, loff_t end_byte) } EXPORT_SYMBOL(file_fdatawait_range); -/** - * filemap_fdatawait_keep_errors - wait for writeback without clearing errors - * @mapping: address space structure to wait for - * - * Walk the list of under-writeback pages of the given address space - * and wait for all of them. Unlike filemap_fdatawait(), this function - * does not clear error status of the address space. - * - * Use this function if callers don't handle errors themselves. Expected - * call sites are system-wide / filesystem-wide data flushers: e.g. sync(2), - * fsfreeze(8) - * - * Return: error status of the address space. - */ -int filemap_fdatawait_keep_errors(struct address_space *mapping) -{ - errseq_t since = filemap_sample_wb_err(mapping); - - __filemap_fdatawait_range(mapping, 0, LLONG_MAX); - return filemap_check_wb_err(mapping, since); -} -EXPORT_SYMBOL(filemap_fdatawait_keep_errors); - /* Returns true if writeback might be needed or already in progress. */ static bool mapping_needs_writeback(struct address_space *mapping) { -- 2.35.1