Patch "ufs: restore maintaining ->i_blocks" has been added to the 4.11-stable tree
Subsystems (2)
This is a note to let you know that I've just added the patch titled
ufs: restore maintaining ->i_blocks
to the 4.11-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary
The filename of the patch is:
ufs-restore-maintaining-i_blocks.patch
and it can be found in the queue-4.11 subdirectory.
If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.
Quoted 1 line
From
eb315d2ae614493fd1ebb026c75a80573d84f7adMon Sep 17 00:00:00 2001
From: Al Viro <[email protected]>
Date: Thu, 8 Jun 2017 21:15:03 -0400
Subject: ufs: restore maintaining ->i_blocks
From: Al Viro <[email protected]>
commit eb315d2ae614493fd1ebb026c75a80573d84f7ad upstream.
--- fs/stat.c | 1 + fs/ufs/balloc.c | 26 +++++++++++++++++++++++++- 2 files changed, 26 insertions(+), 1 deletion(-)
fs/stat.c +1 -0
@@ -586,6 +586,7 @@ void __inode_add_bytes(struct inode *ino inode->i_bytes -=512 ; } } +EXPORT_SYMBOL (__inode_add_bytes);void inode_add_bytes (struct inode *inode,loff_t bytes) {
fs/ufs/balloc.c +25 -1
@@ -82,7 +82,8 @@ void ufs_free_fragments(struct inode *inufs_error (sb,"ufs_free_fragments" ,"bit already cleared for fragment %u" , i); } - + +inode_sub_bytes (inode, count << uspi->s_fshift);fs32_add (sb, &ucg->cg_cs.cs_nffree, count); uspi->cs_total.cs_nffree += count;fs32_add (sb, &UFS_SB (sb)->fs_cs (cgno).cs_nffree, count);
@@ -184,6 +185,7 @@ do_more:ufs_error (sb,"ufs_free_blocks" ,"freeing free fragment" ); }ubh_setblock (UCPI_UBH (ucpi), ucpi->c_freeoff, 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 );
@@ -494,6 +496,20 @@ u64 ufs_new_fragments(struct inode *inodreturn 0 ; } +static bool try_add_frags (struct inode *inode,unsigned frags) +{ +unsigned size = frags *i_blocksize (inode); +spin_lock (&inode->i_lock); +__inode_add_bytes (inode, size); +if (unlikely ((u32 )inode->i_blocks != inode->i_blocks)) { +__inode_sub_bytes (inode, size); +spin_unlock (&inode->i_lock); +return false; + } +spin_unlock (&inode->i_lock); +return true; +} +static u64 ufs_add_fragments (struct inode *inode,u64 fragment,unsigned oldcount,unsigned newcount) {
@@ -530,6 +546,9 @@ static u64 ufs_add_fragments(struct inodfor (i = oldcount; i < newcount; i++)if (ubh_isclr (UCPI_UBH (ucpi), ucpi->c_freeoff, fragno + i))return 0 ; + +if (!try_add_frags (inode, count)) +return 0 ;/* * Block can be extended */
@@ -647,6 +666,7 @@ cg_found:ubh_setbit (UCPI_UBH (ucpi), ucpi->c_freeoff, goal + i); i = uspi->s_fpb - count; +inode_sub_bytes (inode, i << uspi->s_fshift);fs32_add (sb, &ucg->cg_cs.cs_nffree, i); uspi->cs_total.cs_nffree += i;fs32_add (sb, &UFS_SB (sb)->fs_cs (cgno).cs_nffree, i);
@@ -657,6 +677,8 @@ cg_found: result =ufs_bitmap_search (sb, ucpi, goal, allocsize);if (result ==INVBLOCK )return 0 ; +if (!try_add_frags (inode, count)) +return 0 ;for (i =0 ; i < count; i++)ubh_clrbit (UCPI_UBH (ucpi), ucpi->c_freeoff, result + i);
@@ -716,6 +738,8 @@ norot:return INVBLOCK ; ucpi->c_rotor = result; gotit: +if (!try_add_frags (inode, uspi->s_fpb)) +return 0 ; blkno =ufs_fragstoblks (result);ubh_clrblock (UCPI_UBH (ucpi), ucpi->c_freeoff, blkno);if ((UFS_SB (sb)->s_flags &UFS_CG_MASK ) ==UFS_CG_44BSD )
Patches currently in stable-queue which might be from [email protected] are
queue-4.11/excessive-checks-in-ufs_write_failed-and-ufs_evict_inode.patch queue-4.11/ufs-set-correct-s_maxsize.patch queue-4.11/ufs_getfrag_block-we-only-grab-truncate_mutex-on-block-creation-path.patch queue-4.11/ufs-restore-proper-tail-allocation.patch queue-4.11/ufs_extend_tail-fix-the-braino-in-calling-conventions-of-ufs_new_fragments.patch queue-4.11/ufs-restore-maintaining-i_blocks.patch queue-4.11/fix-ufs_isblockset.patch