VFS: fs library helpers: d_inode() annotations
library helpers called by filesystem drivers on their own inodes Signed-off-by: David Howells <dhowells@redhat.com> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
This commit is contained in:
parent
75c3cfa855
commit
dea655c28a
26
fs/libfs.c
26
fs/libfs.c
|
@ -22,13 +22,13 @@
|
|||
|
||||
static inline int simple_positive(struct dentry *dentry)
|
||||
{
|
||||
return dentry->d_inode && !d_unhashed(dentry);
|
||||
return d_really_is_positive(dentry) && !d_unhashed(dentry);
|
||||
}
|
||||
|
||||
int simple_getattr(struct vfsmount *mnt, struct dentry *dentry,
|
||||
struct kstat *stat)
|
||||
{
|
||||
struct inode *inode = dentry->d_inode;
|
||||
struct inode *inode = d_inode(dentry);
|
||||
generic_fillattr(inode, stat);
|
||||
stat->blocks = inode->i_mapping->nrpages << (PAGE_CACHE_SHIFT - 9);
|
||||
return 0;
|
||||
|
@ -94,7 +94,7 @@ EXPORT_SYMBOL(dcache_dir_close);
|
|||
loff_t dcache_dir_lseek(struct file *file, loff_t offset, int whence)
|
||||
{
|
||||
struct dentry *dentry = file->f_path.dentry;
|
||||
mutex_lock(&dentry->d_inode->i_mutex);
|
||||
mutex_lock(&d_inode(dentry)->i_mutex);
|
||||
switch (whence) {
|
||||
case 1:
|
||||
offset += file->f_pos;
|
||||
|
@ -102,7 +102,7 @@ loff_t dcache_dir_lseek(struct file *file, loff_t offset, int whence)
|
|||
if (offset >= 0)
|
||||
break;
|
||||
default:
|
||||
mutex_unlock(&dentry->d_inode->i_mutex);
|
||||
mutex_unlock(&d_inode(dentry)->i_mutex);
|
||||
return -EINVAL;
|
||||
}
|
||||
if (offset != file->f_pos) {
|
||||
|
@ -129,7 +129,7 @@ loff_t dcache_dir_lseek(struct file *file, loff_t offset, int whence)
|
|||
spin_unlock(&dentry->d_lock);
|
||||
}
|
||||
}
|
||||
mutex_unlock(&dentry->d_inode->i_mutex);
|
||||
mutex_unlock(&d_inode(dentry)->i_mutex);
|
||||
return offset;
|
||||
}
|
||||
EXPORT_SYMBOL(dcache_dir_lseek);
|
||||
|
@ -169,7 +169,7 @@ int dcache_readdir(struct file *file, struct dir_context *ctx)
|
|||
spin_unlock(&next->d_lock);
|
||||
spin_unlock(&dentry->d_lock);
|
||||
if (!dir_emit(ctx, next->d_name.name, next->d_name.len,
|
||||
next->d_inode->i_ino, dt_type(next->d_inode)))
|
||||
d_inode(next)->i_ino, dt_type(d_inode(next))))
|
||||
return 0;
|
||||
spin_lock(&dentry->d_lock);
|
||||
spin_lock_nested(&next->d_lock, DENTRY_D_LOCK_NESTED);
|
||||
|
@ -270,7 +270,7 @@ EXPORT_SYMBOL(simple_open);
|
|||
|
||||
int simple_link(struct dentry *old_dentry, struct inode *dir, struct dentry *dentry)
|
||||
{
|
||||
struct inode *inode = old_dentry->d_inode;
|
||||
struct inode *inode = d_inode(old_dentry);
|
||||
|
||||
inode->i_ctime = dir->i_ctime = dir->i_mtime = CURRENT_TIME;
|
||||
inc_nlink(inode);
|
||||
|
@ -304,7 +304,7 @@ EXPORT_SYMBOL(simple_empty);
|
|||
|
||||
int simple_unlink(struct inode *dir, struct dentry *dentry)
|
||||
{
|
||||
struct inode *inode = dentry->d_inode;
|
||||
struct inode *inode = d_inode(dentry);
|
||||
|
||||
inode->i_ctime = dir->i_ctime = dir->i_mtime = CURRENT_TIME;
|
||||
drop_nlink(inode);
|
||||
|
@ -318,7 +318,7 @@ int simple_rmdir(struct inode *dir, struct dentry *dentry)
|
|||
if (!simple_empty(dentry))
|
||||
return -ENOTEMPTY;
|
||||
|
||||
drop_nlink(dentry->d_inode);
|
||||
drop_nlink(d_inode(dentry));
|
||||
simple_unlink(dir, dentry);
|
||||
drop_nlink(dir);
|
||||
return 0;
|
||||
|
@ -328,16 +328,16 @@ EXPORT_SYMBOL(simple_rmdir);
|
|||
int simple_rename(struct inode *old_dir, struct dentry *old_dentry,
|
||||
struct inode *new_dir, struct dentry *new_dentry)
|
||||
{
|
||||
struct inode *inode = old_dentry->d_inode;
|
||||
struct inode *inode = d_inode(old_dentry);
|
||||
int they_are_dirs = d_is_dir(old_dentry);
|
||||
|
||||
if (!simple_empty(new_dentry))
|
||||
return -ENOTEMPTY;
|
||||
|
||||
if (new_dentry->d_inode) {
|
||||
if (d_really_is_positive(new_dentry)) {
|
||||
simple_unlink(new_dir, new_dentry);
|
||||
if (they_are_dirs) {
|
||||
drop_nlink(new_dentry->d_inode);
|
||||
drop_nlink(d_inode(new_dentry));
|
||||
drop_nlink(old_dir);
|
||||
}
|
||||
} else if (they_are_dirs) {
|
||||
|
@ -368,7 +368,7 @@ EXPORT_SYMBOL(simple_rename);
|
|||
*/
|
||||
int simple_setattr(struct dentry *dentry, struct iattr *iattr)
|
||||
{
|
||||
struct inode *inode = dentry->d_inode;
|
||||
struct inode *inode = d_inode(dentry);
|
||||
int error;
|
||||
|
||||
error = inode_change_ok(inode, iattr);
|
||||
|
|
|
@ -2299,7 +2299,7 @@ int dquot_quota_on(struct super_block *sb, int type, int format_id,
|
|||
if (path->dentry->d_sb != sb)
|
||||
error = -EXDEV;
|
||||
else
|
||||
error = vfs_load_quota_inode(path->dentry->d_inode, type,
|
||||
error = vfs_load_quota_inode(d_inode(path->dentry), type,
|
||||
format_id, DQUOT_USAGE_ENABLED |
|
||||
DQUOT_LIMITS_ENABLED);
|
||||
return error;
|
||||
|
@ -2363,20 +2363,20 @@ int dquot_quota_on_mount(struct super_block *sb, char *qf_name,
|
|||
struct dentry *dentry;
|
||||
int error;
|
||||
|
||||
mutex_lock(&sb->s_root->d_inode->i_mutex);
|
||||
mutex_lock(&d_inode(sb->s_root)->i_mutex);
|
||||
dentry = lookup_one_len(qf_name, sb->s_root, strlen(qf_name));
|
||||
mutex_unlock(&sb->s_root->d_inode->i_mutex);
|
||||
mutex_unlock(&d_inode(sb->s_root)->i_mutex);
|
||||
if (IS_ERR(dentry))
|
||||
return PTR_ERR(dentry);
|
||||
|
||||
if (!dentry->d_inode) {
|
||||
if (d_really_is_negative(dentry)) {
|
||||
error = -ENOENT;
|
||||
goto out;
|
||||
}
|
||||
|
||||
error = security_quota_on(dentry);
|
||||
if (!error)
|
||||
error = vfs_load_quota_inode(dentry->d_inode, type, format_id,
|
||||
error = vfs_load_quota_inode(d_inode(dentry), type, format_id,
|
||||
DQUOT_USAGE_ENABLED | DQUOT_LIMITS_ENABLED);
|
||||
|
||||
out:
|
||||
|
|
Loading…
Reference in New Issue