Re: [RFC v2 14/14] xfs: enable block size larger than page size support

From: Pankaj Raghav (Samsung)
Date: Wed Feb 14 2024 - 11:40:44 EST


> > @@ -323,7 +326,8 @@ xfs_reinit_inode(
> > inode->i_rdev = dev;
> > inode->i_uid = uid;
> > inode->i_gid = gid;
> > - mapping_set_large_folios(inode->i_mapping);
> > + min_order = max(min_order, ilog2(mp->m_sb.sb_blocksize) - PAGE_SHIFT);
> > + mapping_set_folio_orders(inode->i_mapping, min_order, MAX_PAGECACHE_ORDER);
>
> Twice now I've seen this, which makes me think "refactor this into a
> single function."
>
> But then, this is really just:
>
> mapping_set_folio_orders(inode->i_mapping,
> max(0, inode->i_sb->s_blocksize_bits - PAGE_SHIFT),
> MAX_PAGECACHE_ORDER);
>
> Can we make that a generic inode_set_pagecache_orders helper?

Chinner suggested an alternative to stuff the min_order value in
mp->m_ino_geo. Then it will just be a call to:

mapping_set_folio_orders(VFS_I(ip)->i_mapping,
M_IGEO(mp)->min_folio_order, MAX_PAGECACHE_ORDER);
>
> > return error;
> > }
> >
> > diff --git a/fs/xfs/xfs_super.c b/fs/xfs/xfs_super.c
> > index 5a2512d20bd0..6a3f0f6727eb 100644
> > --- a/fs/xfs/xfs_super.c
> > +++ b/fs/xfs/xfs_super.c
> > @@ -1625,13 +1625,11 @@ 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) {
> > + if (!IS_ENABLED(CONFIG_XFS_LBS) && mp->m_sb.sb_blocksize > PAGE_SIZE) {
> > xfs_warn(mp,
> > "File system with blocksize %d bytes. "
> > - "Only pagesize (%ld) or less will currently work.",
> > + "Only pagesize (%ld) or less will currently work. "
> > + "Enable Experimental CONFIG_XFS_LBS for this support",
> > mp->m_sb.sb_blocksize, PAGE_SIZE);
>
> Please log a warning about the EXPERIMENTAL bs>ps feature being used
> on this mount for the CONFIG_XFS_LBS=y case.
>
Yes! I will do it as a part of the next revision.