From patchwork Fri Jan 26 13:29:03 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 13532584 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 D888BC47422 for ; Fri, 26 Jan 2024 13:30:34 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 629FA6B0098; Fri, 26 Jan 2024 08:30:34 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 539876B0099; Fri, 26 Jan 2024 08:30:34 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 2C85F6B009A; Fri, 26 Jan 2024 08:30:34 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 178E96B0098 for ; Fri, 26 Jan 2024 08:30:34 -0500 (EST) Received: from smtpin06.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id E7129A1C56 for ; Fri, 26 Jan 2024 13:30:33 +0000 (UTC) X-FDA: 81721546746.06.C6DC604 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) by imf20.hostedemail.com (Postfix) with ESMTP id BF3B21C000E for ; Fri, 26 Jan 2024 13:30:31 +0000 (UTC) Authentication-Results: imf20.hostedemail.com; dkim=pass header.d=infradead.org header.s=bombadil.20210309 header.b=jE2JcShB; spf=none (imf20.hostedemail.com: domain of BATV+8230b42af99c397292d7+7460+infradead.org+hch@bombadil.srs.infradead.org has no SPF policy when checking 198.137.202.133) smtp.mailfrom=BATV+8230b42af99c397292d7+7460+infradead.org+hch@bombadil.srs.infradead.org; dmarc=none ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1706275831; a=rsa-sha256; cv=none; b=e1fQUPZkWsqs+C/Xdqdtc8tnck/iYu89WgkyJ7+5t9+61VsoZKVcg6URGezy1PWtKqrb0p lvQLX7W6iUfgZnOHEZHBHwvfI6x79P9llTKzfZpf8OuJ4yOpPNdUVgwH4LEroaRP2Gf2M0 uWgK8osn2/34OsBoWwsDC6TW/oif4QU= ARC-Authentication-Results: i=1; imf20.hostedemail.com; dkim=pass header.d=infradead.org header.s=bombadil.20210309 header.b=jE2JcShB; spf=none (imf20.hostedemail.com: domain of BATV+8230b42af99c397292d7+7460+infradead.org+hch@bombadil.srs.infradead.org has no SPF policy when checking 198.137.202.133) smtp.mailfrom=BATV+8230b42af99c397292d7+7460+infradead.org+hch@bombadil.srs.infradead.org; dmarc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1706275831; 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=EdPHxaJrEpvYS47DuOpNsvgoqsMU5pwpvkiGViTUEi4=; b=gtGian7jWJ8+s4vHaelCoFlHIR8WRO1gBO9wdqG7KlFgq1RuvzVFmnnDzXVdi1Mq2XjAqL MpTQIvO7AuOkS2vDQHTWhDACX1GhdQXt5RHateBsjdNqGplHUvECTGtwwt4QY3E/ek94Tb I47IVP9COtbbWgfp+bF+I6PObTsjFhw= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; 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=EdPHxaJrEpvYS47DuOpNsvgoqsMU5pwpvkiGViTUEi4=; b=jE2JcShBkBsKdkG4zAj+XG0TWn bVotbjajo3zPhODcubukD0IKcBJBOCq66GvCGgnP+AGbvTL/LT6v+++oAZJCtDmDiFZURVYUemGRg bZY+G0Mioo6vC9v9/43BlufjMoSD3C18eDlh4WfsuMg1jUvRVgkdgFDeeUNW552gK570hMFU5XLgI +7O1UlXMWW84ZWpP+OE3XC45AJdHnavYBWzW/Rd9NJyuK8v5HEJ10Z3DrPde5EMog8LgmTwTFR9bU aHSYusDAO1/X1X/iOTGNpCTLYWkG655EisiHFy2zrOkmqF1sYtpKpv4P0FipL7fhJQI4iSCbHP1Gc xpIXsuZQ==; Received: from 2a02-8389-2341-5b80-39d3-4735-9a3c-88d8.cable.dynamic.v6.surfer.at ([2a02:8389:2341:5b80:39d3:4735:9a3c:88d8] helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.97.1 #2 (Red Hat Linux)) id 1rTMHt-00000004D0q-0NUM; Fri, 26 Jan 2024 13:30:29 +0000 From: Christoph Hellwig To: Chandan Babu R , "Darrick J. Wong" , Hugh Dickins , Andrew Morton Cc: linux-xfs@vger.kernel.org, linux-mm@kvack.org Subject: [PATCH 21/21] xfs: remove xfile_{get,put}_page Date: Fri, 26 Jan 2024 14:29:03 +0100 Message-Id: <20240126132903.2700077-22-hch@lst.de> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240126132903.2700077-1-hch@lst.de> References: <20240126132903.2700077-1-hch@lst.de> MIME-Version: 1.0 X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html X-Rspamd-Server: rspam08 X-Rspamd-Queue-Id: BF3B21C000E X-Stat-Signature: 4qe4dbrtngztgocfrunpc79rhksj4n6o X-Rspam-User: X-HE-Tag: 1706275831-248681 X-HE-Meta: U2FsdGVkX1/41BqKbNdUzm0INcP6IOwB/S44txwHM94vbrMciG0LjgfRuvAyABKxNg+biVfvk3ymPoi/HvIW0pW/2tVFdQJoeajgDwN3Gddb8nSa/JRoFC+sbgjVRC/EMyq0OKBfu0wrhTv5+b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S+30CQw+wGKzU5KkGf/0NIf7PyFpbLRz9kCWt1CMKlRmggl1Eu0o4Y42GEMPmG4aupRAFaaFRGSjQRUKFCOMsEzG3n0ALsHBDeJ3hsx7kVvBr4ACpATwiSuz30+UiYSBTBY4sDjU+dHZJ8EUKhTvi+YXAUfJ2P4ZYpMDSWK26gUb8l66W0MQKrbyp1U0q3ZFgfEZCdDoCA2vYlb+qZsaI9T7dOBLaCTNkkmQ1Xfq28s3zfcperlozjv2iwzXyc8+GIyZX8+Bj+Gf4+f3ncheTP6PbL+ITJpY97AQC7i8o= 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: List-Subscribe: List-Unsubscribe: From: "Darrick J. Wong" These functions aren't used anymore, so get rid of them. Signed-off-by: Darrick J. Wong Signed-off-by: Christoph Hellwig --- .../xfs/xfs-online-fsck-design.rst | 2 +- fs/xfs/scrub/trace.h | 2 - fs/xfs/scrub/xfile.c | 104 ------------------ fs/xfs/scrub/xfile.h | 20 ---- 4 files changed, 1 insertion(+), 127 deletions(-) diff --git a/Documentation/filesystems/xfs/xfs-online-fsck-design.rst b/Documentation/filesystems/xfs/xfs-online-fsck-design.rst index 324d5ec921e8e5..6d91b68dd23b71 100644 --- a/Documentation/filesystems/xfs/xfs-online-fsck-design.rst +++ b/Documentation/filesystems/xfs/xfs-online-fsck-design.rst @@ -1941,7 +1941,7 @@ mapping it into kernel address space, and dropping the folio lock. These long term users *must* be responsive to memory reclaim by hooking into the shrinker infrastructure to know when to release folios. -The ``xfile_get_page`` and ``xfile_put_page`` functions are provided to +The ``xfile_get_folio`` and ``xfile_put_folio`` functions are provided to retrieve the (locked) folio that backs part of an xfile and to release it. The only code to use these folio lease functions are the xfarray :ref:`sorting` algorithms and the :ref:`in-memory diff --git a/fs/xfs/scrub/trace.h b/fs/xfs/scrub/trace.h index 3a1a827828dcb9..ae6b2385a8cbe5 100644 --- a/fs/xfs/scrub/trace.h +++ b/fs/xfs/scrub/trace.h @@ -906,8 +906,6 @@ DEFINE_EVENT(xfile_class, name, \ DEFINE_XFILE_EVENT(xfile_load); DEFINE_XFILE_EVENT(xfile_store); DEFINE_XFILE_EVENT(xfile_seek_data); -DEFINE_XFILE_EVENT(xfile_get_page); -DEFINE_XFILE_EVENT(xfile_put_page); DEFINE_XFILE_EVENT(xfile_get_folio); DEFINE_XFILE_EVENT(xfile_put_folio); diff --git a/fs/xfs/scrub/xfile.c b/fs/xfs/scrub/xfile.c index 1c1db4ae1ba6ee..341d0b55ddfdfc 100644 --- a/fs/xfs/scrub/xfile.c +++ b/fs/xfs/scrub/xfile.c @@ -262,110 +262,6 @@ xfile_seek_data( return ret; } -/* - * Grab the (locked) page for a memory object. The object cannot span a page - * boundary. Returns 0 (and a locked page) if successful, -ENOTBLK if we - * cannot grab the page, or the usual negative errno. - */ -int -xfile_get_page( - struct xfile *xf, - loff_t pos, - unsigned int len, - struct xfile_page *xfpage) -{ - struct inode *inode = file_inode(xf->file); - struct address_space *mapping = inode->i_mapping; - const struct address_space_operations *aops = mapping->a_ops; - struct page *page = NULL; - void *fsdata = NULL; - loff_t key = round_down(pos, PAGE_SIZE); - unsigned int pflags; - int error; - - if (inode->i_sb->s_maxbytes - pos < len) - return -ENOMEM; - if (len > PAGE_SIZE - offset_in_page(pos)) - return -ENOTBLK; - - trace_xfile_get_page(xf, pos, len); - - pflags = memalloc_nofs_save(); - - /* - * We call write_begin directly here to avoid all the freezer - * protection lock-taking that happens in the normal path. shmem - * doesn't support fs freeze, but lockdep doesn't know that and will - * trip over that. - */ - error = aops->write_begin(NULL, mapping, key, PAGE_SIZE, &page, - &fsdata); - if (error) - goto out_pflags; - - /* We got the page, so make sure we push out EOF. */ - if (i_size_read(inode) < pos + len) - i_size_write(inode, pos + len); - - /* - * If the page isn't up to date, fill it with zeroes before we hand it - * to the caller and make sure the backing store will hold on to them. - */ - if (!PageUptodate(page)) { - memset(page_address(page), 0, PAGE_SIZE); - SetPageUptodate(page); - } - - /* - * Mark each page dirty so that the contents are written to some - * backing store when we drop this buffer, and take an extra reference - * to prevent the xfile page from being swapped or removed from the - * page cache by reclaim if the caller unlocks the page. - */ - set_page_dirty(page); - get_page(page); - - xfpage->page = page; - xfpage->fsdata = fsdata; - xfpage->pos = key; -out_pflags: - memalloc_nofs_restore(pflags); - return error; -} - -/* - * Release the (locked) page for a memory object. Returns 0 or a negative - * errno. - */ -int -xfile_put_page( - struct xfile *xf, - struct xfile_page *xfpage) -{ - struct inode *inode = file_inode(xf->file); - struct address_space *mapping = inode->i_mapping; - const struct address_space_operations *aops = mapping->a_ops; - unsigned int pflags; - int ret; - - trace_xfile_put_page(xf, xfpage->pos, PAGE_SIZE); - - /* Give back the reference that we took in xfile_get_page. */ - put_page(xfpage->page); - - pflags = memalloc_nofs_save(); - ret = aops->write_end(NULL, mapping, xfpage->pos, PAGE_SIZE, PAGE_SIZE, - xfpage->page, xfpage->fsdata); - memalloc_nofs_restore(pflags); - memset(xfpage, 0, sizeof(struct xfile_page)); - - if (ret < 0) - return ret; - if (ret != PAGE_SIZE) - return -EIO; - return 0; -} - /* * Grab the (locked) folio for a memory object. The object cannot span a folio * boundary. Returns the locked folio if successful, NULL if there was no diff --git a/fs/xfs/scrub/xfile.h b/fs/xfs/scrub/xfile.h index afb75e9fbaf265..76d78dba7e3478 100644 --- a/fs/xfs/scrub/xfile.h +++ b/fs/xfs/scrub/xfile.h @@ -6,22 +6,6 @@ #ifndef __XFS_SCRUB_XFILE_H__ #define __XFS_SCRUB_XFILE_H__ -struct xfile_page { - struct page *page; - void *fsdata; - loff_t pos; -}; - -static inline bool xfile_page_cached(const struct xfile_page *xfpage) -{ - return xfpage->page != NULL; -} - -static inline pgoff_t xfile_page_index(const struct xfile_page *xfpage) -{ - return xfpage->page->index; -} - struct xfile { struct file *file; }; @@ -35,10 +19,6 @@ int xfile_store(struct xfile *xf, const void *buf, size_t count, loff_t xfile_seek_data(struct xfile *xf, loff_t pos); -int xfile_get_page(struct xfile *xf, loff_t offset, unsigned int len, - struct xfile_page *xbuf); -int xfile_put_page(struct xfile *xf, struct xfile_page *xbuf); - #define XFILE_MAX_FOLIO_SIZE (PAGE_SIZE << MAX_PAGECACHE_ORDER) #define XFILE_ALLOC (1 << 0) /* allocate folio if not present */