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 8728ECDB483 for ; Wed, 18 Oct 2023 16:11:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230391AbjJRQL4 (ORCPT ); Wed, 18 Oct 2023 12:11:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54012 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229946AbjJRQLz (ORCPT ); Wed, 18 Oct 2023 12:11:55 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2E93EFA for ; Wed, 18 Oct 2023 09:11:54 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B6F9CC433C7; Wed, 18 Oct 2023 16:11:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux-foundation.org; s=korg; t=1697645513; bh=yvT58i9zJMKxo/RXOEcJetmYrB8ldaOEDpAfk5pIMBc=; h=Date:To:From:Subject:From; b=kxGpzg7G6ly/w5blBZOy8dDAFKoE4wFhnkMbA+2nNNWWGgulYFBl3YB6u32ZrHATW g2o1m4BkhDvU+6cI0g2wipBY7Ikj002+oU70Yu5s/rMGEEZuSaXQ36aBHQ2Wi1izCJ Ul5AFMfyuHWiHiZlV6Ye2jCPcZ+hV6XoUw4qGgMA= Date: Wed, 18 Oct 2023 09:11:53 -0700 To: mm-commits@vger.kernel.org, p.raghav@samsung.com, konishi.ryusuke@gmail.com, agruenba@redhat.com, willy@infradead.org, akpm@linux-foundation.org From: Andrew Morton Subject: [withdrawn] buffer-return-bool-from-grow_dev_folio.patch removed from -mm tree Message-Id: <20231018161153.B6F9CC433C7@smtp.kernel.org> Precedence: bulk Reply-To: linux-kernel@vger.kernel.org List-ID: X-Mailing-List: mm-commits@vger.kernel.org The quilt patch titled Subject: buffer: return bool from grow_dev_folio() has been removed from the -mm tree. Its filename was buffer-return-bool-from-grow_dev_folio.patch This patch was dropped because it was withdrawn ------------------------------------------------------ From: "Matthew Wilcox (Oracle)" Subject: buffer: return bool from grow_dev_folio() Date: Mon, 16 Oct 2023 21:10:48 +0100 Patch series "Finish the create_empty_buffers() transition", v2. Pankaj recently added folio_create_empty_buffers() as the folio equivalent to create_empty_buffers(). This patch set finishes the conversion by first converting all remaining filesystems to call folio_create_empty_buffers(), then renaming it back to create_empty_buffers(). I took the opportunity to make a few simplifications like making folio_create_empty_buffers() return the head buffer and extracting get_nth_bh() from nilfs2. A few of the patches in this series aren't directly related to create_empty_buffers(), but I saw them while I was working on this and thought they'd be easy enough to add to this series. Compile-tested only, other than ext4. This patch (of 27): Rename grow_dev_page() to grow_dev_folio() and make it return a bool. Document what that bool means; it's more subtle than it first appears. Also rename the 'failed' label to 'unlock' beacuse it's not exactly 'failed'. It just hasn't succeeded. Link: https://lkml.kernel.org/r/20231016201114.1928083-1-willy@infradead.org Link: https://lkml.kernel.org/r/20231016201114.1928083-2-willy@infradead.org Signed-off-by: Matthew Wilcox (Oracle) Cc: Matthew Wilcox Cc: Pankaj Raghav Cc: Andreas Gruenbacher Cc: Ryusuke Konishi Signed-off-by: Andrew Morton --- fs/buffer.c | 39 ++++++++++++++++++++++----------------- 1 file changed, 22 insertions(+), 17 deletions(-) --- a/fs/buffer.c~buffer-return-bool-from-grow_dev_folio +++ a/fs/buffer.c @@ -1024,24 +1024,26 @@ static sector_t folio_init_buffers(struc } /* - * Create the page-cache page that contains the requested block. + * Create the page-cache folio that contains the requested block. * * This is used purely for blockdev mappings. + * + * Returns false if we have a 'permanent' failure. Returns true if + * we succeeded, or the caller should retry. */ -static int -grow_dev_page(struct block_device *bdev, sector_t block, +static bool grow_dev_folio(struct block_device *bdev, sector_t block, pgoff_t index, int size, int sizebits, gfp_t gfp) { struct inode *inode = bdev->bd_inode; struct folio *folio; struct buffer_head *bh; sector_t end_block; - int ret = 0; + bool ret; folio = __filemap_get_folio(inode->i_mapping, index, FGP_LOCK | FGP_ACCESSED | FGP_CREAT, gfp); if (IS_ERR(folio)) - return PTR_ERR(folio); + return false; bh = folio_buffers(folio); if (bh) { @@ -1050,14 +1052,17 @@ grow_dev_page(struct block_device *bdev, (sector_t)index << sizebits, size); goto done; } + + /* Caller should retry if this call fails */ + ret = true; if (!try_to_free_buffers(folio)) - goto failed; + goto unlock; } - ret = -ENOMEM; + ret = false; bh = folio_alloc_buffers(folio, size, gfp | __GFP_ACCOUNT); if (!bh) - goto failed; + goto unlock; /* * Link the folio to the buffers and initialise them. Take the @@ -1070,19 +1075,19 @@ grow_dev_page(struct block_device *bdev, (sector_t)index << sizebits, size); spin_unlock(&inode->i_mapping->private_lock); done: - ret = (block < end_block) ? 1 : -ENXIO; -failed: + ret = block < end_block; +unlock: folio_unlock(folio); folio_put(folio); return ret; } /* - * Create buffers for the specified block device block's page. If - * that page was dirty, the buffers are set dirty also. + * Create buffers for the specified block device block's folio. If + * that folio was dirty, the buffers are set dirty also. */ -static int -grow_buffers(struct block_device *bdev, sector_t block, int size, gfp_t gfp) +static bool grow_buffers(struct block_device *bdev, sector_t block, + int size, gfp_t gfp) { pgoff_t index; int sizebits; @@ -1099,11 +1104,11 @@ grow_buffers(struct block_device *bdev, "device %pg\n", __func__, (unsigned long long)block, bdev); - return -EIO; + return false; } - /* Create a page with the proper size buffers.. */ - return grow_dev_page(bdev, block, index, size, sizebits, gfp); + /* Create a folio with the proper size buffers.. */ + return grow_dev_folio(bdev, block, index, size, sizebits, gfp); } static struct buffer_head * _ Patches currently in -mm which might be from willy@infradead.org are mm-make-lock_folio_maybe_drop_mmap-vma-lock-aware.patch mm-call-wp_page_copy-under-the-vma-lock.patch mm-handle-shared-faults-under-the-vma-lock.patch mm-handle-cow-faults-under-the-vma-lock.patch mm-handle-read-faults-under-the-vma-lock.patch mm-handle-write-faults-to-ro-pages-under-the-vma-lock.patch iomap-hold-state_lock-over-call-to-ifs_set_range_uptodate.patch iomap-protect-read_bytes_pending-with-the-state_lock.patch mm-add-folio_end_read.patch ext4-use-folio_end_read.patch buffer-use-folio_end_read.patch iomap-use-folio_end_read.patch bitops-add-xor_unlock_is_negative_byte.patch alpha-implement-xor_unlock_is_negative_byte.patch m68k-implement-xor_unlock_is_negative_byte.patch mips-implement-xor_unlock_is_negative_byte.patch powerpc-implement-arch_xor_unlock_is_negative_byte-on-32-bit.patch riscv-implement-xor_unlock_is_negative_byte.patch s390-implement-arch_xor_unlock_is_negative_byte.patch mm-delete-checks-for-xor_unlock_is_negative_byte.patch mm-add-folio_xor_flags_has_waiters.patch mm-make-__end_folio_writeback-return-void.patch mm-use-folio_xor_flags_has_waiters-in-folio_end_writeback.patch filemap-remove-use-of-wait-bookmarks.patch sched-remove-wait-bookmarks.patch buffer-make-folio_create_empty_buffers-return-a-buffer_head.patch mpage-convert-map_buffer_to_folio-to-folio_create_empty_buffers.patch ext4-convert-to-folio_create_empty_buffers.patch buffer-add-get_nth_bh.patch gfs2-convert-inode-unstuffing-to-use-a-folio.patch gfs2-convert-gfs2_getbuf-to-folios.patch gfs2-convert-gfs2_getjdatabuf-to-use-a-folio.patch gfs2-convert-gfs2_write_buf_to_page-to-use-a-folio.patch nilfs2-convert-nilfs_mdt_freeze_buffer-to-use-a-folio.patch nilfs2-convert-nilfs_grab_buffer-to-use-a-folio.patch nilfs2-convert-nilfs_copy_page-to-nilfs_copy_folio.patch nilfs2-convert-nilfs_mdt_forget_block-to-use-a-folio.patch nilfs2-convert-nilfs_mdt_get_frozen_buffer-to-use-a-folio.patch nilfs2-remove-nilfs_page_get_nth_block.patch nilfs2-convert-nilfs_lookup_dirty_data_buffers-to-use-folio_create_empty_buffers.patch ntfs-convert-ntfs_read_block-to-use-a-folio.patch ntfs-convert-ntfs_writepage-to-use-a-folio.patch ntfs-convert-ntfs_prepare_pages_for_non_resident_write-to-folios.patch ntfs3-convert-ntfs_zero_range-to-use-a-folio.patch ocfs2-convert-ocfs2_map_page_blocks-to-use-a-folio.patch reiserfs-convert-writepage-to-use-a-folio.patch ufs-add-ufs_get_locked_folio-and-ufs_put_locked_folio.patch ufs-use-ufs_get_locked_folio-in-ufs_alloc_lastblock.patch ufs-convert-ufs_change_blocknr-to-use-folios.patch ufs-remove-ufs_get_locked_page.patch buffer-remove-folio_create_empty_buffers.patch