- move au_ino() from vdir.c to inode.c. - move au_wh_ino() from vdir.c to inode.h.
Signed-off-by: J. R. Okajima <[email protected]> --- fs/aufs/inode.c | 53 ++++++++++++++++++++++++++++++++++++++++++++++++ fs/aufs/inode.h | 12 +++++++++++ fs/aufs/vdir.c | 60 ------------------------------------------------------- 3 files changed, 65 insertions(+), 60 deletions(-) diff --git a/fs/aufs/inode.c b/fs/aufs/inode.c index 023fb27..1bc13dd 100644 --- a/fs/aufs/inode.c +++ b/fs/aufs/inode.c @@ -24,6 +24,59 @@ #include "aufs.h" + +int au_ino(struct super_block *sb, aufs_bindex_t bindex, ino_t h_ino, + unsigned int d_type, ino_t *ino) +{ + int err; + struct au_xino_entry xinoe; + struct mutex *mtx; + const int isdir = (d_type == DT_DIR); + + /* prevent hardlinks from race condition */ + mtx = NULL; + if (!isdir) { + mtx = &au_sbr(sb, bindex)->br_xino.xi_nondir_mtx; + mutex_lock(mtx); + } + err = au_xino_read(sb, bindex, h_ino, &xinoe); + if (unlikely(err)) + goto out; + + if (!xinoe.ino) { + err = -EIO; + xinoe.ino = au_xino_new_ino(sb); + if (unlikely(!xinoe.ino)) + goto out; + +#if 0 /* reserved for future use */ + struct inode *h_inode; + xinoe.h_gen = AuXino_INVALID_HGEN; + h_inode = ilookup(au_sbr_sb(sb, bindex), h_ino); + if (h_inode) { + if (!is_bad_inode(h_inode)) { + xinoe.h_gen = h_inode->i_generation; + WARN_ON(xinoe.h_gen == AuXino_INVALID_HGEN); + } + iput(h_inode); + } +#endif + err = au_xino_write(sb, bindex, h_ino, &xinoe); + if (unlikely(err)) + goto out; + } + + *ino = xinoe.ino; + + out: + if (!isdir) + mutex_unlock(mtx); + AuTraceErr(err); + return err; +} + +/* ---------------------------------------------------------------------- */ + int au_refresh_hinode_self(struct inode *inode) { int err, new_sz, update; diff --git a/fs/aufs/inode.h b/fs/aufs/inode.h index 7f7e9a3..84143b9 100644 --- a/fs/aufs/inode.h +++ b/fs/aufs/inode.h @@ -85,6 +85,8 @@ struct au_pin { /* ---------------------------------------------------------------------- */ /* inode.c */ +int au_ino(struct super_block *sb, aufs_bindex_t bindex, ino_t h_ino, + unsigned int d_type, ino_t *ino); int au_refresh_hinode_self(struct inode *inode); int au_refresh_hinode(struct inode *inode, struct dentry *dentry); struct inode *au_new_inode(struct dentry *dentry, int must_new); @@ -93,6 +95,16 @@ int au_test_ro(struct super_block *sb, aufs_bindex_t bindex, int au_test_h_perm(struct inode *h_inode, int mask, int dlgt); int au_test_h_perm_sio(struct inode *h_inode, int mask, int dlgt); +static inline int au_wh_ino(struct super_block *sb, aufs_bindex_t bindex, + ino_t h_ino, unsigned int d_type, ino_t *ino) +{ +#ifdef CONFIG_AUFS_SHWH + return au_ino(sb, bindex, h_ino, d_type, ino); +#else + return 0; +#endif +} + /* i_op.c */ extern struct inode_operations aufs_iop, aufs_symlink_iop, aufs_dir_iop; diff --git a/fs/aufs/vdir.c b/fs/aufs/vdir.c index e3564fd..239c15b 100644 --- a/fs/aufs/vdir.c +++ b/fs/aufs/vdir.c @@ -417,66 +417,6 @@ static int append_de(struct au_vdir *vdir, char *name, int namelen, ino_t ino, /* ---------------------------------------------------------------------- */ -static int au_ino(struct super_block *sb, aufs_bindex_t bindex, ino_t h_ino, - unsigned int d_type, ino_t *ino) -{ - int err; - struct au_xino_entry xinoe; - struct mutex *mtx; - const int isdir = (d_type == DT_DIR); - - /* prevent hardlinks from race condition */ - mtx = NULL; - if (!isdir) { - mtx = &au_sbr(sb, bindex)->br_xino.xi_nondir_mtx; - mutex_lock(mtx); - } - err = au_xino_read(sb, bindex, h_ino, &xinoe); - if (unlikely(err)) - goto out; - - if (!xinoe.ino) { - err = -EIO; - xinoe.ino = au_xino_new_ino(sb); - if (unlikely(!xinoe.ino)) - goto out; - -#if 0 /* reserved for future use */ - struct inode *h_inode; - xinoe.h_gen = AuXino_INVALID_HGEN; - h_inode = ilookup(au_sbr_sb(sb, bindex), h_ino); - if (h_inode) { - if (!is_bad_inode(h_inode)) { - xinoe.h_gen = h_inode->i_generation; - WARN_ON(xinoe.h_gen == AuXino_INVALID_HGEN); - } - iput(h_inode); - } -#endif - err = au_xino_write(sb, bindex, h_ino, &xinoe); - if (unlikely(err)) - goto out; - } - - *ino = xinoe.ino; - - out: - if (!isdir) - mutex_unlock(mtx); - AuTraceErr(err); - return err; -} - -static int au_wh_ino(struct super_block *sb, aufs_bindex_t bindex, ino_t h_ino, - unsigned int d_type, ino_t *ino) -{ -#ifdef CONFIG_AUFS_SHWH - return au_ino(sb, bindex, h_ino, d_type, ino); -#else - return 0; -#endif -} - #define AuFillVdir_CALLED 1 #define AuFillVdir_SHWH (1 << 1) #define au_ftest_fillvdir(flags, name) ((flags) & AuFillVdir_##name) -- 1.6.1.284.g5dc13 ------------------------------------------------------------------------------ Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july
