Skip to content

Commit 72843ca

Browse files
Christoph Hellwigcmaiolino
authored andcommitted
xfs: don't take m_sb_lock in xfs_fs_statfs
The only non-constant value read under m_sb_lock in xfs_fs_statfs is sb_dblocks, and it could become stale right after dropping the lock anyway. Remove the thus pointless lock section. Signed-off-by: Christoph Hellwig <[email protected]> Reviewed-by: Darrick J. Wong <[email protected]> Signed-off-by: Carlos Maiolino <[email protected]>
1 parent f4752da commit 72843ca

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

fs/xfs/xfs_super.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -850,11 +850,13 @@ xfs_fs_statfs(
850850
ifree = percpu_counter_sum(&mp->m_ifree);
851851
fdblocks = percpu_counter_sum(&mp->m_fdblocks);
852852

853-
spin_lock(&mp->m_sb_lock);
854853
statp->f_bsize = sbp->sb_blocksize;
855854
lsize = sbp->sb_logstart ? sbp->sb_logblocks : 0;
855+
/*
856+
* sb_dblocks can change during growfs, but nothing cares about reporting
857+
* the old or new value during growfs.
858+
*/
856859
statp->f_blocks = sbp->sb_dblocks - lsize;
857-
spin_unlock(&mp->m_sb_lock);
858860

859861
/* make sure statp->f_bfree does not underflow */
860862
statp->f_bfree = max_t(int64_t, 0,

0 commit comments

Comments
 (0)