diff options
-rw-r--r-- | fs/stat.c | 10 | ||||
-rw-r--r-- | include/linux/fs.h | 1 |
2 files changed, 9 insertions, 2 deletions
@@ -401,9 +401,9 @@ SYSCALL_DEFINE4(fstatat64, int, dfd, char __user *, filename, | |||
401 | } | 401 | } |
402 | #endif /* __ARCH_WANT_STAT64 */ | 402 | #endif /* __ARCH_WANT_STAT64 */ |
403 | 403 | ||
404 | void inode_add_bytes(struct inode *inode, loff_t bytes) | 404 | /* Caller is here responsible for sufficient locking (ie. inode->i_lock) */ |
405 | void __inode_add_bytes(struct inode *inode, loff_t bytes) | ||
405 | { | 406 | { |
406 | spin_lock(&inode->i_lock); | ||
407 | inode->i_blocks += bytes >> 9; | 407 | inode->i_blocks += bytes >> 9; |
408 | bytes &= 511; | 408 | bytes &= 511; |
409 | inode->i_bytes += bytes; | 409 | inode->i_bytes += bytes; |
@@ -411,6 +411,12 @@ void inode_add_bytes(struct inode *inode, loff_t bytes) | |||
411 | inode->i_blocks++; | 411 | inode->i_blocks++; |
412 | inode->i_bytes -= 512; | 412 | inode->i_bytes -= 512; |
413 | } | 413 | } |
414 | } | ||
415 | |||
416 | void inode_add_bytes(struct inode *inode, loff_t bytes) | ||
417 | { | ||
418 | spin_lock(&inode->i_lock); | ||
419 | __inode_add_bytes(inode, bytes); | ||
414 | spin_unlock(&inode->i_lock); | 420 | spin_unlock(&inode->i_lock); |
415 | } | 421 | } |
416 | 422 | ||
diff --git a/include/linux/fs.h b/include/linux/fs.h index 7e3012e0ac06..9147ca88f253 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h | |||
@@ -2297,6 +2297,7 @@ extern const struct inode_operations page_symlink_inode_operations; | |||
2297 | extern int generic_readlink(struct dentry *, char __user *, int); | 2297 | extern int generic_readlink(struct dentry *, char __user *, int); |
2298 | extern void generic_fillattr(struct inode *, struct kstat *); | 2298 | extern void generic_fillattr(struct inode *, struct kstat *); |
2299 | extern int vfs_getattr(struct vfsmount *, struct dentry *, struct kstat *); | 2299 | extern int vfs_getattr(struct vfsmount *, struct dentry *, struct kstat *); |
2300 | void __inode_add_bytes(struct inode *inode, loff_t bytes); | ||
2300 | void inode_add_bytes(struct inode *inode, loff_t bytes); | 2301 | void inode_add_bytes(struct inode *inode, loff_t bytes); |
2301 | void inode_sub_bytes(struct inode *inode, loff_t bytes); | 2302 | void inode_sub_bytes(struct inode *inode, loff_t bytes); |
2302 | loff_t inode_get_bytes(struct inode *inode); | 2303 | loff_t inode_get_bytes(struct inode *inode); |