Commit f4a8116a authored by Jan Kara's avatar Jan Kara

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: default avatarJan Kara <jack@suse.cz>
parent 3ab167d2
...@@ -710,7 +710,7 @@ loff_t inode_get_bytes(struct inode *inode) ...@@ -710,7 +710,7 @@ loff_t inode_get_bytes(struct inode *inode)
loff_t ret; loff_t ret;
spin_lock(&inode->i_lock); spin_lock(&inode->i_lock);
ret = (((loff_t)inode->i_blocks) << 9) + inode->i_bytes; ret = __inode_get_bytes(inode);
spin_unlock(&inode->i_lock); spin_unlock(&inode->i_lock);
return ret; return ret;
} }
......
...@@ -2998,6 +2998,10 @@ void __inode_add_bytes(struct inode *inode, loff_t bytes); ...@@ -2998,6 +2998,10 @@ void __inode_add_bytes(struct inode *inode, loff_t bytes);
void inode_add_bytes(struct inode *inode, loff_t bytes); void inode_add_bytes(struct inode *inode, loff_t bytes);
void __inode_sub_bytes(struct inode *inode, loff_t bytes); void __inode_sub_bytes(struct inode *inode, loff_t bytes);
void inode_sub_bytes(struct inode *inode, loff_t bytes); void inode_sub_bytes(struct inode *inode, loff_t bytes);
static inline loff_t __inode_get_bytes(struct inode *inode)
{
return (((loff_t)inode->i_blocks) << 9) + inode->i_bytes;
}
loff_t inode_get_bytes(struct inode *inode); loff_t inode_get_bytes(struct inode *inode);
void inode_set_bytes(struct inode *inode, loff_t bytes); void inode_set_bytes(struct inode *inode, loff_t bytes);
const char *simple_get_link(struct dentry *, struct inode *, const char *simple_get_link(struct dentry *, struct inode *,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment