ufs: Pass a folio to ufs_new_fragments()

All callers now have a folio, pass it to ufs_new_fragments() instead
of converting back to a page.

Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
This commit is contained in:
Matthew Wilcox (Oracle) 2024-10-05 19:02:07 +01:00 committed by Al Viro
parent 24a87a0adb
commit 14bcb7bb68
3 changed files with 13 additions and 13 deletions

View File

@ -332,7 +332,7 @@ static void ufs_clear_frags(struct inode *inode, sector_t beg, unsigned int n,
u64 ufs_new_fragments(struct inode *inode, void *p, u64 fragment, u64 ufs_new_fragments(struct inode *inode, void *p, u64 fragment,
u64 goal, unsigned count, int *err, u64 goal, unsigned count, int *err,
struct page *locked_page) struct folio *locked_folio)
{ {
struct super_block * sb; struct super_block * sb;
struct ufs_sb_private_info * uspi; struct ufs_sb_private_info * uspi;
@ -412,7 +412,7 @@ u64 ufs_new_fragments(struct inode *inode, void *p, u64 fragment,
result = ufs_alloc_fragments (inode, cgno, goal, count, err); result = ufs_alloc_fragments (inode, cgno, goal, count, err);
if (result) { if (result) {
ufs_clear_frags(inode, result + oldcount, ufs_clear_frags(inode, result + oldcount,
newcount - oldcount, locked_page != NULL); newcount - oldcount, locked_folio != NULL);
*err = 0; *err = 0;
write_seqlock(&UFS_I(inode)->meta_lock); write_seqlock(&UFS_I(inode)->meta_lock);
ufs_cpu_to_data_ptr(sb, p, result); ufs_cpu_to_data_ptr(sb, p, result);
@ -436,7 +436,7 @@ u64 ufs_new_fragments(struct inode *inode, void *p, u64 fragment,
fragment + count); fragment + count);
read_sequnlock_excl(&UFS_I(inode)->meta_lock); read_sequnlock_excl(&UFS_I(inode)->meta_lock);
ufs_clear_frags(inode, result + oldcount, newcount - oldcount, ufs_clear_frags(inode, result + oldcount, newcount - oldcount,
locked_page != NULL); locked_folio != NULL);
mutex_unlock(&UFS_SB(sb)->s_lock); mutex_unlock(&UFS_SB(sb)->s_lock);
UFSD("EXIT, result %llu\n", (unsigned long long)result); UFSD("EXIT, result %llu\n", (unsigned long long)result);
return result; return result;
@ -457,11 +457,11 @@ u64 ufs_new_fragments(struct inode *inode, void *p, u64 fragment,
result = ufs_alloc_fragments (inode, cgno, goal, request, err); result = ufs_alloc_fragments (inode, cgno, goal, request, err);
if (result) { if (result) {
ufs_clear_frags(inode, result + oldcount, newcount - oldcount, ufs_clear_frags(inode, result + oldcount, newcount - oldcount,
locked_page != NULL); locked_folio != NULL);
mutex_unlock(&UFS_SB(sb)->s_lock); mutex_unlock(&UFS_SB(sb)->s_lock);
ufs_change_blocknr(inode, fragment - oldcount, oldcount, ufs_change_blocknr(inode, fragment - oldcount, oldcount,
uspi->s_sbbase + tmp, uspi->s_sbbase + tmp,
uspi->s_sbbase + result, locked_page); uspi->s_sbbase + result, &locked_folio->page);
*err = 0; *err = 0;
write_seqlock(&UFS_I(inode)->meta_lock); write_seqlock(&UFS_I(inode)->meta_lock);
ufs_cpu_to_data_ptr(sb, p, result); ufs_cpu_to_data_ptr(sb, p, result);

View File

@ -239,7 +239,7 @@ ufs_extend_tail(struct inode *inode, u64 writes_to,
p = ufs_get_direct_data_ptr(uspi, ufsi, block); p = ufs_get_direct_data_ptr(uspi, ufsi, block);
tmp = ufs_new_fragments(inode, p, lastfrag, ufs_data_ptr_to_cpu(sb, p), tmp = ufs_new_fragments(inode, p, lastfrag, ufs_data_ptr_to_cpu(sb, p),
new_size - (lastfrag & uspi->s_fpbmask), err, new_size - (lastfrag & uspi->s_fpbmask), err,
&locked_folio->page); locked_folio);
return tmp != 0; return tmp != 0;
} }
@ -250,7 +250,7 @@ ufs_extend_tail(struct inode *inode, u64 writes_to,
* @new_fragment: number of new allocated fragment(s) * @new_fragment: number of new allocated fragment(s)
* @err: we set it if something wrong * @err: we set it if something wrong
* @new: we set it if we allocate new block * @new: we set it if we allocate new block
* @locked_page: for ufs_new_fragments() * @locked_folio: for ufs_new_fragments()
*/ */
static u64 ufs_inode_getfrag(struct inode *inode, unsigned index, static u64 ufs_inode_getfrag(struct inode *inode, unsigned index,
sector_t new_fragment, int *err, sector_t new_fragment, int *err,
@ -282,7 +282,7 @@ static u64 ufs_inode_getfrag(struct inode *inode, unsigned index,
goal += uspi->s_fpb; goal += uspi->s_fpb;
} }
tmp = ufs_new_fragments(inode, p, ufs_blknum(new_fragment), tmp = ufs_new_fragments(inode, p, ufs_blknum(new_fragment),
goal, nfrags, err, &locked_folio->page); goal, nfrags, err, locked_folio);
if (!tmp) { if (!tmp) {
*err = -ENOSPC; *err = -ENOSPC;
@ -347,7 +347,7 @@ static u64 ufs_inode_getblock(struct inode *inode, u64 ind_block,
else else
goal = bh->b_blocknr + uspi->s_fpb; goal = bh->b_blocknr + uspi->s_fpb;
tmp = ufs_new_fragments(inode, p, ufs_blknum(new_fragment), goal, tmp = ufs_new_fragments(inode, p, ufs_blknum(new_fragment), goal,
uspi->s_fpb, err, &locked_folio->page); uspi->s_fpb, err, locked_folio);
if (!tmp) if (!tmp)
goto out; goto out;

View File

@ -88,10 +88,10 @@ struct ufs_inode_info {
#endif #endif
/* balloc.c */ /* balloc.c */
extern void ufs_free_fragments (struct inode *, u64, unsigned); void ufs_free_fragments (struct inode *, u64 fragment, unsigned count);
extern void ufs_free_blocks (struct inode *, u64, unsigned); void ufs_free_blocks (struct inode *, u64 fragment, unsigned count);
extern u64 ufs_new_fragments(struct inode *, void *, u64, u64, u64 ufs_new_fragments(struct inode *, void *, u64 fragment, u64 goal,
unsigned, int *, struct page *); unsigned count, int *err, struct folio *);
/* cylinder.c */ /* cylinder.c */
extern struct ufs_cg_private_info * ufs_load_cylinder (struct super_block *, unsigned); extern struct ufs_cg_private_info * ufs_load_cylinder (struct super_block *, unsigned);