diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2023-01-27 19:36:21 -0500 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2024-10-18 17:35:31 -0400 |
commit | 8bec0618a42959b9fecac115c5dbf942675f9776 (patch) | |
tree | 08b050291d616a8563fcf4e0ea7507d0720cc36b | |
parent | 65136e46a03f70ee9e5515c401fd89b2de86b66c (diff) | |
download | linux-stable-8bec0618a42959b9fecac115c5dbf942675f9776.tar.gz linux-stable-8bec0618a42959b9fecac115c5dbf942675f9776.tar.bz2 linux-stable-8bec0618a42959b9fecac115c5dbf942675f9776.zip |
ufs: untangle ubh_...block...(), part 2
pass cylinder group descriptor instead of its buffer head (ubh,
always UCPI_UBH(ucpi)) and its ->c_freeoff.
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
-rw-r--r-- | fs/ufs/balloc.c | 10 | ||||
-rw-r--r-- | fs/ufs/util.h | 16 |
2 files changed, 16 insertions, 10 deletions
diff --git a/fs/ufs/balloc.c b/fs/ufs/balloc.c index e412ddcfda03..d76c04fbd4fa 100644 --- a/fs/ufs/balloc.c +++ b/fs/ufs/balloc.c @@ -95,7 +95,7 @@ void ufs_free_fragments(struct inode *inode, u64 fragment, unsigned count) * Trying to reassemble free fragments into block */ blkno = ufs_fragstoblks (bbase); - if (ubh_isblockset(uspi, UCPI_UBH(ucpi), ucpi->c_freeoff, blkno)) { + if (ubh_isblockset(uspi, ucpi, blkno)) { fs32_sub(sb, &ucg->cg_cs.cs_nffree, uspi->s_fpb); uspi->cs_total.cs_nffree -= uspi->s_fpb; fs32_sub(sb, &UFS_SB(sb)->fs_cs(cgno).cs_nffree, uspi->s_fpb); @@ -182,10 +182,10 @@ do_more: for (i = bit; i < end_bit; i += uspi->s_fpb) { blkno = ufs_fragstoblks(i); - if (ubh_isblockset(uspi, UCPI_UBH(ucpi), ucpi->c_freeoff, blkno)) { + if (ubh_isblockset(uspi, ucpi, blkno)) { ufs_error(sb, "ufs_free_blocks", "freeing free fragment"); } - ubh_setblock(uspi, UCPI_UBH(ucpi), ucpi->c_freeoff, blkno); + ubh_setblock(uspi, ucpi, blkno); inode_sub_bytes(inode, uspi->s_fpb << uspi->s_fshift); if ((UFS_SB(sb)->s_flags & UFS_CG_MASK) == UFS_CG_44BSD) ufs_clusteracct (sb, ucpi, blkno, 1); @@ -716,7 +716,7 @@ static u64 ufs_alloccg_block(struct inode *inode, /* * If the requested block is available, use it. */ - if (ubh_isblockset(uspi, UCPI_UBH(ucpi), ucpi->c_freeoff, ufs_fragstoblks(goal))) { + if (ubh_isblockset(uspi, ucpi, ufs_fragstoblks(goal))) { result = goal; goto gotit; } @@ -730,7 +730,7 @@ gotit: if (!try_add_frags(inode, uspi->s_fpb)) return 0; blkno = ufs_fragstoblks(result); - ubh_clrblock(uspi, UCPI_UBH(ucpi), ucpi->c_freeoff, blkno); + ubh_clrblock(uspi, ucpi, blkno); if ((UFS_SB(sb)->s_flags & UFS_CG_MASK) == UFS_CG_44BSD) ufs_clusteracct (sb, ucpi, blkno, -1); diff --git a/fs/ufs/util.h b/fs/ufs/util.h index 729bc55398f2..c7196a81fb0d 100644 --- a/fs/ufs/util.h +++ b/fs/ufs/util.h @@ -455,9 +455,11 @@ static inline unsigned _ubh_find_last_zero_bit_( return (base << uspi->s_bpfshift) + pos - begin; } -static inline int ubh_isblockset(struct ufs_sb_private_info * uspi, - struct ufs_buffer_head * ubh, unsigned begin, unsigned block) +static inline int ubh_isblockset(struct ufs_sb_private_info *uspi, + struct ufs_cg_private_info *ucpi, unsigned block) { + struct ufs_buffer_head *ubh = UCPI_UBH(ucpi); + unsigned begin = ucpi->c_freeoff; u8 mask; switch (uspi->s_fpb) { case 8: @@ -475,9 +477,11 @@ static inline int ubh_isblockset(struct ufs_sb_private_info * uspi, return 0; } -static inline void ubh_clrblock(struct ufs_sb_private_info * uspi, - struct ufs_buffer_head * ubh, unsigned begin, unsigned block) +static inline void ubh_clrblock(struct ufs_sb_private_info *uspi, + struct ufs_cg_private_info *ucpi, unsigned block) { + struct ufs_buffer_head *ubh = UCPI_UBH(ucpi); + unsigned begin = ucpi->c_freeoff; switch (uspi->s_fpb) { case 8: *ubh_get_addr (ubh, begin + block) = 0x00; @@ -495,8 +499,10 @@ static inline void ubh_clrblock(struct ufs_sb_private_info * uspi, } static inline void ubh_setblock(struct ufs_sb_private_info * uspi, - struct ufs_buffer_head * ubh, unsigned begin, unsigned block) + struct ufs_cg_private_info *ucpi, unsigned block) { + struct ufs_buffer_head *ubh = UCPI_UBH(ucpi); + unsigned begin = ucpi->c_freeoff; switch (uspi->s_fpb) { case 8: *ubh_get_addr(ubh, begin + block) = 0xff; |