From: Daniel Gomez <da.gomez@samsung.com>
To: <brauner@kernel.org>
Cc: "Pankaj Raghav (Samsung)" <kernel@pankajraghav.com>,
<akpm@linux-foundation.org>, <chandan.babu@oracle.com>,
<linux-fsdevel@vger.kernel.org>, <djwong@kernel.org>,
<hare@suse.de>, <gost.dev@samsung.com>,
<linux-xfs@vger.kernel.org>, <hch@lst.de>, <david@fromorbit.com>,
Zi Yan <ziy@nvidia.com>, <yang@os.amperecomputing.com>,
<linux-kernel@vger.kernel.org>, <linux-mm@kvack.org>,
<willy@infradead.org>, <john.g.garry@oracle.com>,
<cl@os.amperecomputing.com>, <p.raghav@samsung.com>,
<mcgrof@kernel.org>, <ryan.roberts@arm.com>,
Dave Chinner <dchinner@redhat.com>
Subject: Re: [PATCH v13 10/10] xfs: enable block size larger than page size support^[
Date: Tue, 3 Sep 2024 14:29:50 +0200 [thread overview]
Message-ID: <20240903122950.eugl53tler4n52ao@AALNPWDAGOMEZ1.aal.scsc.local> (raw)
In-Reply-To: <20240822135018.1931258-11-kernel@pankajraghav.com>
On Thu, Aug 22, 2024 at 03:50:18PM +0200, Pankaj Raghav (Samsung) wrote:
> From: Pankaj Raghav <p.raghav@samsung.com>
>
> Page cache now has the ability to have a minimum order when allocating
> a folio which is a prerequisite to add support for block size > page
> size.
>
> Signed-off-by: Pankaj Raghav <p.raghav@samsung.com>
> Signed-off-by: Luis Chamberlain <mcgrof@kernel.org>
> Reviewed-by: Darrick J. Wong <djwong@kernel.org>
> Reviewed-by: Dave Chinner <dchinner@redhat.com>
> ---
> fs/xfs/libxfs/xfs_ialloc.c | 5 +++++
> fs/xfs/libxfs/xfs_shared.h | 3 +++
> fs/xfs/xfs_icache.c | 6 ++++--
> fs/xfs/xfs_mount.c | 1 -
> fs/xfs/xfs_super.c | 28 ++++++++++++++++++++--------
> include/linux/pagemap.h | 13 +++++++++++++
> 6 files changed, 45 insertions(+), 11 deletions(-)
>
> diff --git a/fs/xfs/libxfs/xfs_ialloc.c b/fs/xfs/libxfs/xfs_ialloc.c
> index 0af5b7a33d055..1921b689888b8 100644
> --- a/fs/xfs/libxfs/xfs_ialloc.c
> +++ b/fs/xfs/libxfs/xfs_ialloc.c
> @@ -3033,6 +3033,11 @@ xfs_ialloc_setup_geometry(
> igeo->ialloc_align = mp->m_dalign;
> else
> igeo->ialloc_align = 0;
> +
> + if (mp->m_sb.sb_blocksize > PAGE_SIZE)
> + igeo->min_folio_order = mp->m_sb.sb_blocklog - PAGE_SHIFT;
> + else
> + igeo->min_folio_order = 0;
> }
>
> /* Compute the location of the root directory inode that is laid out by mkfs. */
> diff --git a/fs/xfs/libxfs/xfs_shared.h b/fs/xfs/libxfs/xfs_shared.h
> index 2f7413afbf46c..33b84a3a83ff6 100644
> --- a/fs/xfs/libxfs/xfs_shared.h
> +++ b/fs/xfs/libxfs/xfs_shared.h
> @@ -224,6 +224,9 @@ struct xfs_ino_geometry {
> /* precomputed value for di_flags2 */
> uint64_t new_diflags2;
>
> + /* minimum folio order of a page cache allocation */
> + unsigned int min_folio_order;
> +
> };
>
> #endif /* __XFS_SHARED_H__ */
> diff --git a/fs/xfs/xfs_icache.c b/fs/xfs/xfs_icache.c
> index cf629302d48e7..0fcf235e50235 100644
> --- a/fs/xfs/xfs_icache.c
> +++ b/fs/xfs/xfs_icache.c
> @@ -88,7 +88,8 @@ xfs_inode_alloc(
>
> /* VFS doesn't initialise i_mode! */
> VFS_I(ip)->i_mode = 0;
> - mapping_set_large_folios(VFS_I(ip)->i_mapping);
> + mapping_set_folio_min_order(VFS_I(ip)->i_mapping,
> + M_IGEO(mp)->min_folio_order);
>
> XFS_STATS_INC(mp, vn_active);
> ASSERT(atomic_read(&ip->i_pincount) == 0);
> @@ -325,7 +326,8 @@ xfs_reinit_inode(
> inode->i_uid = uid;
> inode->i_gid = gid;
> inode->i_state = state;
> - mapping_set_large_folios(inode->i_mapping);
> + mapping_set_folio_min_order(inode->i_mapping,
> + M_IGEO(mp)->min_folio_order);
> return error;
> }
>
> diff --git a/fs/xfs/xfs_mount.c b/fs/xfs/xfs_mount.c
> index 3949f720b5354..c6933440f8066 100644
> --- a/fs/xfs/xfs_mount.c
> +++ b/fs/xfs/xfs_mount.c
> @@ -134,7 +134,6 @@ xfs_sb_validate_fsb_count(
> {
> uint64_t max_bytes;
>
> - ASSERT(PAGE_SHIFT >= sbp->sb_blocklog);
> ASSERT(sbp->sb_blocklog >= BBSHIFT);
>
> if (check_shl_overflow(nblocks, sbp->sb_blocklog, &max_bytes))
> diff --git a/fs/xfs/xfs_super.c b/fs/xfs/xfs_super.c
> index 210481b03fdb4..8cd76a01b543f 100644
> --- a/fs/xfs/xfs_super.c
> +++ b/fs/xfs/xfs_super.c
> @@ -1638,16 +1638,28 @@ xfs_fs_fill_super(
> goto out_free_sb;
> }
>
> - /*
> - * Until this is fixed only page-sized or smaller data blocks work.
> - */
> if (mp->m_sb.sb_blocksize > PAGE_SIZE) {
> - xfs_warn(mp,
> - "File system with blocksize %d bytes. "
> - "Only pagesize (%ld) or less will currently work.",
> + size_t max_folio_size = mapping_max_folio_size_supported();
> +
> + if (!xfs_has_crc(mp)) {
> + xfs_warn(mp,
> +"V4 Filesystem with blocksize %d bytes. Only pagesize (%ld) or less is supported.",
> mp->m_sb.sb_blocksize, PAGE_SIZE);
> - error = -ENOSYS;
> - goto out_free_sb;
> + error = -ENOSYS;
> + goto out_free_sb;
> + }
> +
> + if (mp->m_sb.sb_blocksize > max_folio_size) {
> + xfs_warn(mp,
> +"block size (%u bytes) not supported; Only block size (%ld) or less is supported",
This small fix [1] is missing in linux-next and vfs trees. Can it be picked?
[1] https://lore.kernel.org/all/Zs_vIaw8ESLN2TwY@casper.infradead.org/
> + mp->m_sb.sb_blocksize, max_folio_size);
> + error = -ENOSYS;
> + goto out_free_sb;
> + }
> +
> + xfs_warn(mp,
> +"EXPERIMENTAL: V5 Filesystem with Large Block Size (%d bytes) enabled.",
> + mp->m_sb.sb_blocksize);
> }
>
> /* Ensure this filesystem fits in the page cache limits */
> diff --git a/include/linux/pagemap.h b/include/linux/pagemap.h
> index 4cc170949e9c0..55b254d951da7 100644
> --- a/include/linux/pagemap.h
> +++ b/include/linux/pagemap.h
> @@ -374,6 +374,19 @@ static inline void mapping_set_gfp_mask(struct address_space *m, gfp_t mask)
> #define MAX_XAS_ORDER (XA_CHUNK_SHIFT * 2 - 1)
> #define MAX_PAGECACHE_ORDER min(MAX_XAS_ORDER, PREFERRED_MAX_PAGECACHE_ORDER)
>
> +/*
> + * mapping_max_folio_size_supported() - Check the max folio size supported
> + *
> + * The filesystem should call this function at mount time if there is a
> + * requirement on the folio mapping size in the page cache.
> + */
> +static inline size_t mapping_max_folio_size_supported(void)
> +{
> + if (IS_ENABLED(CONFIG_TRANSPARENT_HUGEPAGE))
> + return 1U << (PAGE_SHIFT + MAX_PAGECACHE_ORDER);
> + return PAGE_SIZE;
> +}
> +
> /*
> * mapping_set_folio_order_range() - Set the orders supported by a file.
> * @mapping: The address space of the file.
> --
> 2.44.1
>
next prev parent reply other threads:[~2024-09-03 12:30 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-22 13:50 [PATCH v13 00/10] enable bs > ps in XFS Pankaj Raghav (Samsung)
2024-08-22 13:50 ` [PATCH v13 01/10] fs: Allow fine-grained control of folio sizes Pankaj Raghav (Samsung)
2024-08-23 13:09 ` Daniel Gomez
2024-08-22 13:50 ` [PATCH v13 02/10] filemap: allocate mapping_min_order folios in the page cache Pankaj Raghav (Samsung)
2024-08-22 13:50 ` [PATCH v13 03/10] readahead: allocate folios with mapping_min_order in readahead Pankaj Raghav (Samsung)
2024-08-22 13:50 ` [PATCH v13 04/10] mm: split a folio in minimum folio order chunks Pankaj Raghav (Samsung)
2024-08-29 10:51 ` Sven Schnelle
2024-08-29 18:46 ` Luis Chamberlain
2024-08-29 19:55 ` Matthew Wilcox
2024-08-29 22:12 ` Zi Yan
2024-08-29 23:41 ` Luis Chamberlain
2024-08-30 5:57 ` Sven Schnelle
2024-08-30 11:58 ` Daniel Gomez
2024-08-30 14:59 ` Pankaj Raghav
2024-08-30 17:12 ` Luis Chamberlain
2024-08-31 22:38 ` Zi Yan
2024-08-30 22:42 ` Matthew Wilcox
2024-08-31 22:35 ` Zi Yan
2024-08-29 22:11 ` Matthew Wilcox
2024-09-06 6:52 ` Lai, Yi
2024-09-06 8:01 ` Pankaj Raghav (Samsung)
2024-09-09 9:06 ` Lai, Yi
2024-08-22 13:50 ` [PATCH v13 05/10] filemap: cap PTE range to be created to allowed zero fill in folio_map_range() Pankaj Raghav (Samsung)
2024-08-22 13:50 ` [PATCH v13 06/10] iomap: fix iomap_dio_zero() for fs bs > system page size Pankaj Raghav (Samsung)
2024-08-22 13:50 ` [PATCH v13 07/10] xfs: use kvmalloc for xattr buffers Pankaj Raghav (Samsung)
2024-08-22 13:50 ` [PATCH v13 08/10] xfs: expose block size in stat Pankaj Raghav (Samsung)
2024-08-22 13:50 ` [PATCH v13 09/10] xfs: make the calculation generic in xfs_sb_validate_fsb_count() Pankaj Raghav (Samsung)
2024-08-22 13:50 ` [PATCH v13 10/10] xfs: enable block size larger than page size support Pankaj Raghav (Samsung)
2024-09-03 12:29 ` Daniel Gomez [this message]
2024-08-22 21:23 ` [PATCH v13 00/10] enable bs > ps in XFS Luis Chamberlain
2024-08-23 12:36 ` Christian Brauner
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240903122950.eugl53tler4n52ao@AALNPWDAGOMEZ1.aal.scsc.local \
--to=da.gomez@samsung.com \
--cc=akpm@linux-foundation.org \
--cc=brauner@kernel.org \
--cc=chandan.babu@oracle.com \
--cc=cl@os.amperecomputing.com \
--cc=david@fromorbit.com \
--cc=dchinner@redhat.com \
--cc=djwong@kernel.org \
--cc=gost.dev@samsung.com \
--cc=hare@suse.de \
--cc=hch@lst.de \
--cc=john.g.garry@oracle.com \
--cc=kernel@pankajraghav.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=linux-xfs@vger.kernel.org \
--cc=mcgrof@kernel.org \
--cc=p.raghav@samsung.com \
--cc=ryan.roberts@arm.com \
--cc=willy@infradead.org \
--cc=yang@os.amperecomputing.com \
--cc=ziy@nvidia.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox