aboutsummaryrefslogtreecommitdiffstats
path: root/fs/stat.c
diff options
context:
space:
mode:
authorJan Kara <jack@suse.cz>2013-08-17 09:32:32 -0400
committerTheodore Ts'o <tytso@mit.edu>2013-08-17 09:32:32 -0400
commit1c8924eb106c1ac755d5d35ce9b3ff42e89e2511 (patch)
tree8e47b0d4121cffc818dfd28399fbfebd09e817a2 /fs/stat.c
parent19883bd9658d0dc269fc228b1b39db3615f7c7b0 (diff)
quota: provide interface for readding allocated space into reserved space
ext4 needs to convert allocated (metadata) blocks back into blocks reserved for delayed allocation. Add functions into quota code for supporting such operation. Signed-off-by: Jan Kara <jack@suse.cz> Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Diffstat (limited to 'fs/stat.c')
-rw-r--r--fs/stat.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/fs/stat.c b/fs/stat.c
index 04ce1ac20d20..d0ea7ef75e26 100644
--- a/fs/stat.c
+++ b/fs/stat.c
@@ -447,9 +447,8 @@ void inode_add_bytes(struct inode *inode, loff_t bytes)
447 447
448EXPORT_SYMBOL(inode_add_bytes); 448EXPORT_SYMBOL(inode_add_bytes);
449 449
450void inode_sub_bytes(struct inode *inode, loff_t bytes) 450void __inode_sub_bytes(struct inode *inode, loff_t bytes)
451{ 451{
452 spin_lock(&inode->i_lock);
453 inode->i_blocks -= bytes >> 9; 452 inode->i_blocks -= bytes >> 9;
454 bytes &= 511; 453 bytes &= 511;
455 if (inode->i_bytes < bytes) { 454 if (inode->i_bytes < bytes) {
@@ -457,6 +456,14 @@ void inode_sub_bytes(struct inode *inode, loff_t bytes)
457 inode->i_bytes += 512; 456 inode->i_bytes += 512;
458 } 457 }
459 inode->i_bytes -= bytes; 458 inode->i_bytes -= bytes;
459}
460
461EXPORT_SYMBOL(__inode_sub_bytes);
462
463void inode_sub_bytes(struct inode *inode, loff_t bytes)
464{
465 spin_lock(&inode->i_lock);
466 __inode_sub_bytes(inode, bytes);
460 spin_unlock(&inode->i_lock); 467 spin_unlock(&inode->i_lock);
461} 468}
462 469