diff options
| author | Jan Kara <jack@suse.cz> | 2017-08-08 03:54:36 -0400 |
|---|---|---|
| committer | Jan Kara <jack@suse.cz> | 2017-08-17 16:06:03 -0400 |
| commit | f4a8116a4c8c8f754d0ec1498a2ba4b63d114e6a (patch) | |
| tree | d3065b20975952041d211e6d0f221db6542cde19 | |
| parent | 3ab167d2ba10017a430e427ddd3d690a74f8692e (diff) | |
fs: Provide __inode_get_bytes()
Provide helper __inode_get_bytes() which assumes i_lock is already
acquired. Quota code will need this to be able to use i_lock to protect
consistency of quota accounting information and inode usage.
Signed-off-by: Jan Kara <jack@suse.cz>
| -rw-r--r-- | fs/stat.c | 2 | ||||
| -rw-r--r-- | include/linux/fs.h | 4 |
2 files changed, 5 insertions, 1 deletions
| @@ -710,7 +710,7 @@ loff_t inode_get_bytes(struct inode *inode) | |||
| 710 | loff_t ret; | 710 | loff_t ret; |
| 711 | 711 | ||
| 712 | spin_lock(&inode->i_lock); | 712 | spin_lock(&inode->i_lock); |
| 713 | ret = (((loff_t)inode->i_blocks) << 9) + inode->i_bytes; | 713 | ret = __inode_get_bytes(inode); |
| 714 | spin_unlock(&inode->i_lock); | 714 | spin_unlock(&inode->i_lock); |
| 715 | return ret; | 715 | return ret; |
| 716 | } | 716 | } |
diff --git a/include/linux/fs.h b/include/linux/fs.h index 6e1fd5d21248..d6e9ab7f184f 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h | |||
| @@ -2998,6 +2998,10 @@ void __inode_add_bytes(struct inode *inode, loff_t bytes); | |||
| 2998 | void inode_add_bytes(struct inode *inode, loff_t bytes); | 2998 | void inode_add_bytes(struct inode *inode, loff_t bytes); |
| 2999 | void __inode_sub_bytes(struct inode *inode, loff_t bytes); | 2999 | void __inode_sub_bytes(struct inode *inode, loff_t bytes); |
| 3000 | void inode_sub_bytes(struct inode *inode, loff_t bytes); | 3000 | void inode_sub_bytes(struct inode *inode, loff_t bytes); |
| 3001 | static inline loff_t __inode_get_bytes(struct inode *inode) | ||
| 3002 | { | ||
| 3003 | return (((loff_t)inode->i_blocks) << 9) + inode->i_bytes; | ||
| 3004 | } | ||
| 3001 | loff_t inode_get_bytes(struct inode *inode); | 3005 | loff_t inode_get_bytes(struct inode *inode); |
| 3002 | void inode_set_bytes(struct inode *inode, loff_t bytes); | 3006 | void inode_set_bytes(struct inode *inode, loff_t bytes); |
| 3003 | const char *simple_get_link(struct dentry *, struct inode *, | 3007 | const char *simple_get_link(struct dentry *, struct inode *, |
