mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-06-21 14:11:20 +00:00
vfs: merge .d_select_inode() into .d_real()
The two methods essentially do the same: find the real dentry/inode belonging to an overlay dentry. The difference is in the usage: vfs_open() uses ->d_select_inode() and expects the function to perform copy-up if necessary based on the open flags argument. file_dentry() uses ->d_real() passing in the overlay dentry as well as the underlying inode. vfs_rename() uses ->d_select_inode() but passes zero flags. ->d_real() with a zero inode would have worked just as well here. This patch merges the functionality of ->d_select_inode() into ->d_real() by adding an 'open_flags' argument to the latter. [Al Viro] Make the signature of d_real() match that of ->d_real() again. And constify the inode argument, while we are at it. Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
This commit is contained in:
parent
4c2e07c6a2
commit
2d902671ce
8 changed files with 39 additions and 62 deletions
|
@ -139,8 +139,7 @@ struct dentry_operations {
|
|||
char *(*d_dname)(struct dentry *, char *, int);
|
||||
struct vfsmount *(*d_automount)(struct path *);
|
||||
int (*d_manage)(struct dentry *, bool);
|
||||
struct inode *(*d_select_inode)(struct dentry *, unsigned);
|
||||
struct dentry *(*d_real)(struct dentry *, struct inode *);
|
||||
struct dentry *(*d_real)(struct dentry *, const struct inode *, unsigned int);
|
||||
} ____cacheline_aligned;
|
||||
|
||||
/*
|
||||
|
@ -206,10 +205,8 @@ struct dentry_operations {
|
|||
|
||||
#define DCACHE_MAY_FREE 0x00800000
|
||||
#define DCACHE_FALLTHRU 0x01000000 /* Fall through to lower layer */
|
||||
#define DCACHE_OP_SELECT_INODE 0x02000000 /* Unioned entry: dcache op selects inode */
|
||||
|
||||
#define DCACHE_ENCRYPTED_WITH_KEY 0x04000000 /* dir is encrypted with a valid key */
|
||||
#define DCACHE_OP_REAL 0x08000000
|
||||
#define DCACHE_ENCRYPTED_WITH_KEY 0x02000000 /* dir is encrypted with a valid key */
|
||||
#define DCACHE_OP_REAL 0x04000000
|
||||
|
||||
#define DCACHE_PAR_LOOKUP 0x10000000 /* being looked up (with parent locked shared) */
|
||||
#define DCACHE_DENTRY_CURSOR 0x20000000
|
||||
|
@ -557,25 +554,16 @@ static inline struct dentry *d_backing_dentry(struct dentry *upper)
|
|||
return upper;
|
||||
}
|
||||
|
||||
static inline struct dentry *d_real(struct dentry *dentry)
|
||||
static inline struct dentry *d_real(struct dentry *dentry,
|
||||
const struct inode *inode,
|
||||
unsigned int flags)
|
||||
{
|
||||
if (unlikely(dentry->d_flags & DCACHE_OP_REAL))
|
||||
return dentry->d_op->d_real(dentry, NULL);
|
||||
return dentry->d_op->d_real(dentry, inode, flags);
|
||||
else
|
||||
return dentry;
|
||||
}
|
||||
|
||||
static inline struct inode *vfs_select_inode(struct dentry *dentry,
|
||||
unsigned open_flags)
|
||||
{
|
||||
struct inode *inode = d_inode(dentry);
|
||||
|
||||
if (inode && unlikely(dentry->d_flags & DCACHE_OP_SELECT_INODE))
|
||||
inode = dentry->d_op->d_select_inode(dentry, open_flags);
|
||||
|
||||
return inode;
|
||||
}
|
||||
|
||||
/**
|
||||
* d_real_inode - Return the real inode
|
||||
* @dentry: The dentry to query
|
||||
|
@ -585,7 +573,7 @@ static inline struct inode *vfs_select_inode(struct dentry *dentry,
|
|||
*/
|
||||
static inline struct inode *d_real_inode(struct dentry *dentry)
|
||||
{
|
||||
return d_backing_inode(d_real(dentry));
|
||||
return d_backing_inode(d_real(dentry, NULL, 0));
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue