Commit 46b85e53 authored by J. R. Okajima's avatar J. R. Okajima
Browse files

aufs: udba=none has no ->getattr() 1/2, inode_operations array



An enhancement for udba=none if possible.
The condition is same to the 'no ->d_revalidate()' patch series.
In this mode, i_op->getattr() is less important, and the default VFS
handler is enough.
Signed-off-by: default avatarJ. R. Okajima <hooanon05g@gmail.com>
parent 25f10296
...@@ -1123,7 +1123,9 @@ static int aufs_update_time(struct inode *inode, struct timespec64 *ts, ...@@ -1123,7 +1123,9 @@ static int aufs_update_time(struct inode *inode, struct timespec64 *ts,
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
struct inode_operations aufs_iop[] = { /* no getattr version will be set by module.c:aufs_init() */
struct inode_operations aufs_iop_nogetattr[AuIop_Last],
aufs_iop[] = {
[AuIop_SYMLINK] = { [AuIop_SYMLINK] = {
.permission = aufs_permission, .permission = aufs_permission,
.setattr = aufs_setattr, .setattr = aufs_setattr,
......
...@@ -173,11 +173,13 @@ static int set_inode(struct inode *inode, struct dentry *dentry) ...@@ -173,11 +173,13 @@ static int set_inode(struct inode *inode, struct dentry *dentry)
struct dentry *h_dentry; struct dentry *h_dentry;
struct inode *h_inode; struct inode *h_inode;
struct au_iinfo *iinfo; struct au_iinfo *iinfo;
struct inode_operations *iop;
IiMustWriteLock(inode); IiMustWriteLock(inode);
err = 0; err = 0;
isdir = 0; isdir = 0;
iop = au_sbi(inode->i_sb)->si_iop_array;
btop = au_dbtop(dentry); btop = au_dbtop(dentry);
h_dentry = au_h_dptr(dentry, btop); h_dentry = au_h_dptr(dentry, btop);
h_inode = d_inode(h_dentry); h_inode = d_inode(h_dentry);
...@@ -185,7 +187,7 @@ static int set_inode(struct inode *inode, struct dentry *dentry) ...@@ -185,7 +187,7 @@ static int set_inode(struct inode *inode, struct dentry *dentry)
switch (mode & S_IFMT) { switch (mode & S_IFMT) {
case S_IFREG: case S_IFREG:
btail = au_dbtail(dentry); btail = au_dbtail(dentry);
inode->i_op = aufs_iop + AuIop_OTHER; inode->i_op = iop + AuIop_OTHER;
#if 0 /* re-commit later */ #if 0 /* re-commit later */
inode->i_fop = &aufs_file_fop; inode->i_fop = &aufs_file_fop;
#endif #endif
...@@ -196,19 +198,19 @@ static int set_inode(struct inode *inode, struct dentry *dentry) ...@@ -196,19 +198,19 @@ static int set_inode(struct inode *inode, struct dentry *dentry)
case S_IFDIR: case S_IFDIR:
isdir = 1; isdir = 1;
btail = au_dbtaildir(dentry); btail = au_dbtaildir(dentry);
inode->i_op = aufs_iop + AuIop_DIR; inode->i_op = iop + AuIop_DIR;
inode->i_fop = &simple_dir_operations; /* re-commit later */ inode->i_fop = &simple_dir_operations; /* re-commit later */
break; break;
case S_IFLNK: case S_IFLNK:
btail = au_dbtail(dentry); btail = au_dbtail(dentry);
inode->i_op = aufs_iop + AuIop_SYMLINK; inode->i_op = iop + AuIop_SYMLINK;
break; break;
case S_IFBLK: case S_IFBLK:
case S_IFCHR: case S_IFCHR:
case S_IFIFO: case S_IFIFO:
case S_IFSOCK: case S_IFSOCK:
btail = au_dbtail(dentry); btail = au_dbtail(dentry);
inode->i_op = aufs_iop + AuIop_OTHER; inode->i_op = iop + AuIop_OTHER;
init_special_inode(inode, mode, h_inode->i_rdev); init_special_inode(inode, mode, h_inode->i_rdev);
break; break;
default: default:
......
...@@ -133,7 +133,8 @@ enum { ...@@ -133,7 +133,8 @@ enum {
AuIop_OTHER, AuIop_OTHER,
AuIop_Last AuIop_Last
}; };
extern struct inode_operations aufs_iop[AuIop_Last]; extern struct inode_operations aufs_iop[AuIop_Last],
aufs_iop_nogetattr[AuIop_Last];
/* au_wr_dir flags */ /* au_wr_dir flags */
#define AuWrDir_ADD_ENTRY 1 #define AuWrDir_ADD_ENTRY 1
......
...@@ -171,6 +171,10 @@ static int __init aufs_init(void) ...@@ -171,6 +171,10 @@ static int __init aufs_init(void)
au_dir_roflags = au_file_roflags(O_DIRECTORY | O_LARGEFILE); au_dir_roflags = au_file_roflags(O_DIRECTORY | O_LARGEFILE);
memcpy(aufs_iop_nogetattr, aufs_iop, sizeof(aufs_iop));
for (i = 0; i < AuIop_Last; i++)
aufs_iop_nogetattr[i].getattr = NULL;
memset(au_cache, 0, sizeof(au_cache)); /* including hnotify */ memset(au_cache, 0, sizeof(au_cache)); /* including hnotify */
au_sbilist_init(); au_sbilist_init();
......
...@@ -88,6 +88,9 @@ int au_si_alloc(struct super_block *sb) ...@@ -88,6 +88,9 @@ int au_si_alloc(struct super_block *sb)
init_waitqueue_head(&sbinfo->si_plink_wq); init_waitqueue_head(&sbinfo->si_plink_wq);
spin_lock_init(&sbinfo->si_plink_maint_lock); spin_lock_init(&sbinfo->si_plink_maint_lock);
/* with getattr by default */
sbinfo->si_iop_array = aufs_iop;
/* leave other members for sysaufs and si_mnt. */ /* leave other members for sysaufs and si_mnt. */
sbinfo->si_sb = sb; sbinfo->si_sb = sb;
sb->s_fs_info = sbinfo; sb->s_fs_info = sbinfo;
......
...@@ -133,6 +133,9 @@ struct au_sbinfo { ...@@ -133,6 +133,9 @@ struct au_sbinfo {
spinlock_t si_plink_maint_lock; spinlock_t si_plink_maint_lock;
pid_t si_plink_maint_pid; pid_t si_plink_maint_pid;
/* with/without getattr, brother of sb->s_d_op */
struct inode_operations *si_iop_array;
/* /*
* sysfs and lifetime management. * sysfs and lifetime management.
* this is not a small structure and it may be a waste of memory in case * this is not a small structure and it may be a waste of memory in case
......
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