Commit b60623c2 authored by Steven Whitehouse's avatar Steven Whitehouse

[GFS2] Shrink gfs2_inode (3) - di_mode

This removes the duplicate di_mode field in favour of using the
inode->i_mode field. This saves 4 bytes.
Signed-off-by: default avatarSteven Whitehouse <swhiteho@redhat.com>
parent e7f14f4d
...@@ -76,9 +76,9 @@ int gfs2_acl_validate_remove(struct gfs2_inode *ip, int access) ...@@ -76,9 +76,9 @@ int gfs2_acl_validate_remove(struct gfs2_inode *ip, int access)
return -EOPNOTSUPP; return -EOPNOTSUPP;
if (current->fsuid != ip->i_di.di_uid && !capable(CAP_FOWNER)) if (current->fsuid != ip->i_di.di_uid && !capable(CAP_FOWNER))
return -EPERM; return -EPERM;
if (S_ISLNK(ip->i_di.di_mode)) if (S_ISLNK(ip->i_inode.i_mode))
return -EOPNOTSUPP; return -EOPNOTSUPP;
if (!access && !S_ISDIR(ip->i_di.di_mode)) if (!access && !S_ISDIR(ip->i_inode.i_mode))
return -EACCES; return -EACCES;
return 0; return 0;
...@@ -198,8 +198,8 @@ static int munge_mode(struct gfs2_inode *ip, mode_t mode) ...@@ -198,8 +198,8 @@ static int munge_mode(struct gfs2_inode *ip, mode_t mode)
error = gfs2_meta_inode_buffer(ip, &dibh); error = gfs2_meta_inode_buffer(ip, &dibh);
if (!error) { if (!error) {
gfs2_assert_withdraw(sdp, gfs2_assert_withdraw(sdp,
(ip->i_di.di_mode & S_IFMT) == (mode & S_IFMT)); (ip->i_inode.i_mode & S_IFMT) == (mode & S_IFMT));
ip->i_di.di_mode = mode; ip->i_inode.i_mode = mode;
gfs2_trans_add_bh(ip->i_gl, dibh, 1); gfs2_trans_add_bh(ip->i_gl, dibh, 1);
gfs2_dinode_out(ip, dibh->b_data); gfs2_dinode_out(ip, dibh->b_data);
brelse(dibh); brelse(dibh);
...@@ -215,12 +215,12 @@ int gfs2_acl_create(struct gfs2_inode *dip, struct gfs2_inode *ip) ...@@ -215,12 +215,12 @@ int gfs2_acl_create(struct gfs2_inode *dip, struct gfs2_inode *ip)
struct gfs2_sbd *sdp = GFS2_SB(&dip->i_inode); struct gfs2_sbd *sdp = GFS2_SB(&dip->i_inode);
struct posix_acl *acl = NULL, *clone; struct posix_acl *acl = NULL, *clone;
struct gfs2_ea_request er; struct gfs2_ea_request er;
mode_t mode = ip->i_di.di_mode; mode_t mode = ip->i_inode.i_mode;
int error; int error;
if (!sdp->sd_args.ar_posix_acl) if (!sdp->sd_args.ar_posix_acl)
return 0; return 0;
if (S_ISLNK(ip->i_di.di_mode)) if (S_ISLNK(ip->i_inode.i_mode))
return 0; return 0;
memset(&er, 0, sizeof(struct gfs2_ea_request)); memset(&er, 0, sizeof(struct gfs2_ea_request));
...@@ -232,7 +232,7 @@ int gfs2_acl_create(struct gfs2_inode *dip, struct gfs2_inode *ip) ...@@ -232,7 +232,7 @@ int gfs2_acl_create(struct gfs2_inode *dip, struct gfs2_inode *ip)
return error; return error;
if (!acl) { if (!acl) {
mode &= ~current->fs->umask; mode &= ~current->fs->umask;
if (mode != ip->i_di.di_mode) if (mode != ip->i_inode.i_mode)
error = munge_mode(ip, mode); error = munge_mode(ip, mode);
return error; return error;
} }
...@@ -244,7 +244,7 @@ int gfs2_acl_create(struct gfs2_inode *dip, struct gfs2_inode *ip) ...@@ -244,7 +244,7 @@ int gfs2_acl_create(struct gfs2_inode *dip, struct gfs2_inode *ip)
posix_acl_release(acl); posix_acl_release(acl);
acl = clone; acl = clone;
if (S_ISDIR(ip->i_di.di_mode)) { if (S_ISDIR(ip->i_inode.i_mode)) {
er.er_name = GFS2_POSIX_ACL_DEFAULT; er.er_name = GFS2_POSIX_ACL_DEFAULT;
er.er_name_len = GFS2_POSIX_ACL_DEFAULT_LEN; er.er_name_len = GFS2_POSIX_ACL_DEFAULT_LEN;
error = gfs2_system_eaops.eo_set(ip, &er); error = gfs2_system_eaops.eo_set(ip, &er);
......
...@@ -1109,7 +1109,7 @@ int gfs2_truncatei(struct gfs2_inode *ip, u64 size) ...@@ -1109,7 +1109,7 @@ int gfs2_truncatei(struct gfs2_inode *ip, u64 size)
{ {
int error; int error;
if (gfs2_assert_warn(GFS2_SB(&ip->i_inode), S_ISREG(ip->i_di.di_mode))) if (gfs2_assert_warn(GFS2_SB(&ip->i_inode), S_ISREG(ip->i_inode.i_mode)))
return -EINVAL; return -EINVAL;
if (size > ip->i_di.di_size) if (size > ip->i_di.di_size)
......
...@@ -120,7 +120,7 @@ static int system_eo_set(struct gfs2_inode *ip, struct gfs2_ea_request *er) ...@@ -120,7 +120,7 @@ static int system_eo_set(struct gfs2_inode *ip, struct gfs2_ea_request *er)
if (GFS2_ACL_IS_ACCESS(er->er_name, er->er_name_len)) { if (GFS2_ACL_IS_ACCESS(er->er_name, er->er_name_len)) {
if (!(er->er_flags & GFS2_ERF_MODE)) { if (!(er->er_flags & GFS2_ERF_MODE)) {
er->er_mode = ip->i_di.di_mode; er->er_mode = ip->i_inode.i_mode;
er->er_flags |= GFS2_ERF_MODE; er->er_flags |= GFS2_ERF_MODE;
} }
error = gfs2_acl_validate_set(ip, 1, er, error = gfs2_acl_validate_set(ip, 1, er,
......
...@@ -711,9 +711,9 @@ static int ea_alloc_skeleton(struct gfs2_inode *ip, struct gfs2_ea_request *er, ...@@ -711,9 +711,9 @@ static int ea_alloc_skeleton(struct gfs2_inode *ip, struct gfs2_ea_request *er,
if (!error) { if (!error) {
if (er->er_flags & GFS2_ERF_MODE) { if (er->er_flags & GFS2_ERF_MODE) {
gfs2_assert_withdraw(GFS2_SB(&ip->i_inode), gfs2_assert_withdraw(GFS2_SB(&ip->i_inode),
(ip->i_di.di_mode & S_IFMT) == (ip->i_inode.i_mode & S_IFMT) ==
(er->er_mode & S_IFMT)); (er->er_mode & S_IFMT));
ip->i_di.di_mode = er->er_mode; ip->i_inode.i_mode = er->er_mode;
} }
ip->i_di.di_ctime = get_seconds(); ip->i_di.di_ctime = get_seconds();
gfs2_trans_add_bh(ip->i_gl, dibh, 1); gfs2_trans_add_bh(ip->i_gl, dibh, 1);
...@@ -847,8 +847,8 @@ static int ea_set_simple_noalloc(struct gfs2_inode *ip, struct buffer_head *bh, ...@@ -847,8 +847,8 @@ static int ea_set_simple_noalloc(struct gfs2_inode *ip, struct buffer_head *bh,
if (er->er_flags & GFS2_ERF_MODE) { if (er->er_flags & GFS2_ERF_MODE) {
gfs2_assert_withdraw(GFS2_SB(&ip->i_inode), gfs2_assert_withdraw(GFS2_SB(&ip->i_inode),
(ip->i_di.di_mode & S_IFMT) == (er->er_mode & S_IFMT)); (ip->i_inode.i_mode & S_IFMT) == (er->er_mode & S_IFMT));
ip->i_di.di_mode = er->er_mode; ip->i_inode.i_mode = er->er_mode;
} }
ip->i_di.di_ctime = get_seconds(); ip->i_di.di_ctime = get_seconds();
gfs2_trans_add_bh(ip->i_gl, dibh, 1); gfs2_trans_add_bh(ip->i_gl, dibh, 1);
......
...@@ -2078,7 +2078,7 @@ static int dump_inode(struct gfs2_inode *ip) ...@@ -2078,7 +2078,7 @@ static int dump_inode(struct gfs2_inode *ip)
printk(KERN_INFO " num = %llu %llu\n", printk(KERN_INFO " num = %llu %llu\n",
(unsigned long long)ip->i_num.no_formal_ino, (unsigned long long)ip->i_num.no_formal_ino,
(unsigned long long)ip->i_num.no_addr); (unsigned long long)ip->i_num.no_addr);
printk(KERN_INFO " type = %u\n", IF2DT(ip->i_di.di_mode)); printk(KERN_INFO " type = %u\n", IF2DT(ip->i_inode.i_mode));
printk(KERN_INFO " i_flags ="); printk(KERN_INFO " i_flags =");
for (x = 0; x < 32; x++) for (x = 0; x < 32; x++)
if (test_bit(x, &ip->i_flags)) if (test_bit(x, &ip->i_flags))
......
...@@ -92,7 +92,7 @@ static void gfs2_pte_inval(struct gfs2_glock *gl) ...@@ -92,7 +92,7 @@ static void gfs2_pte_inval(struct gfs2_glock *gl)
ip = gl->gl_object; ip = gl->gl_object;
inode = &ip->i_inode; inode = &ip->i_inode;
if (!ip || !S_ISREG(ip->i_di.di_mode)) if (!ip || !S_ISREG(inode->i_mode))
return; return;
if (!test_bit(GIF_PAGED, &ip->i_flags)) if (!test_bit(GIF_PAGED, &ip->i_flags))
...@@ -119,7 +119,7 @@ static void gfs2_page_inval(struct gfs2_glock *gl) ...@@ -119,7 +119,7 @@ static void gfs2_page_inval(struct gfs2_glock *gl)
ip = gl->gl_object; ip = gl->gl_object;
inode = &ip->i_inode; inode = &ip->i_inode;
if (!ip || !S_ISREG(ip->i_di.di_mode)) if (!ip || !S_ISREG(inode->i_mode))
return; return;
truncate_inode_pages(inode->i_mapping, 0); truncate_inode_pages(inode->i_mapping, 0);
...@@ -142,7 +142,7 @@ static void gfs2_page_wait(struct gfs2_glock *gl) ...@@ -142,7 +142,7 @@ static void gfs2_page_wait(struct gfs2_glock *gl)
struct address_space *mapping = inode->i_mapping; struct address_space *mapping = inode->i_mapping;
int error; int error;
if (!S_ISREG(ip->i_di.di_mode)) if (!S_ISREG(inode->i_mode))
return; return;
error = filemap_fdatawait(mapping); error = filemap_fdatawait(mapping);
...@@ -164,7 +164,7 @@ static void gfs2_page_writeback(struct gfs2_glock *gl) ...@@ -164,7 +164,7 @@ static void gfs2_page_writeback(struct gfs2_glock *gl)
struct inode *inode = &ip->i_inode; struct inode *inode = &ip->i_inode;
struct address_space *mapping = inode->i_mapping; struct address_space *mapping = inode->i_mapping;
if (!S_ISREG(ip->i_di.di_mode)) if (!S_ISREG(inode->i_mode))
return; return;
filemap_fdatawrite(mapping); filemap_fdatawrite(mapping);
......
...@@ -51,7 +51,6 @@ void gfs2_inode_attr_in(struct gfs2_inode *ip) ...@@ -51,7 +51,6 @@ void gfs2_inode_attr_in(struct gfs2_inode *ip)
struct gfs2_dinode_host *di = &ip->i_di; struct gfs2_dinode_host *di = &ip->i_di;
inode->i_ino = ip->i_num.no_addr; inode->i_ino = ip->i_num.no_addr;
inode->i_mode = di->di_mode;
inode->i_nlink = di->di_nlink; inode->i_nlink = di->di_nlink;
inode->i_uid = di->di_uid; inode->i_uid = di->di_uid;
inode->i_gid = di->di_gid; inode->i_gid = di->di_gid;
...@@ -88,9 +87,6 @@ void gfs2_inode_attr_out(struct gfs2_inode *ip) ...@@ -88,9 +87,6 @@ void gfs2_inode_attr_out(struct gfs2_inode *ip)
{ {
struct inode *inode = &ip->i_inode; struct inode *inode = &ip->i_inode;
struct gfs2_dinode_host *di = &ip->i_di; struct gfs2_dinode_host *di = &ip->i_di;
gfs2_assert_withdraw(GFS2_SB(inode),
(di->di_mode & S_IFMT) == (inode->i_mode & S_IFMT));
di->di_mode = inode->i_mode;
di->di_uid = inode->i_uid; di->di_uid = inode->i_uid;
di->di_gid = inode->i_gid; di->di_gid = inode->i_gid;
di->di_atime = inode->i_atime.tv_sec; di->di_atime = inode->i_atime.tv_sec;
...@@ -210,9 +206,9 @@ static int gfs2_dinode_in(struct gfs2_inode *ip, const void *buf) ...@@ -210,9 +206,9 @@ static int gfs2_dinode_in(struct gfs2_inode *ip, const void *buf)
if (ip->i_num.no_formal_ino != be64_to_cpu(str->di_num.no_formal_ino)) if (ip->i_num.no_formal_ino != be64_to_cpu(str->di_num.no_formal_ino))
return -ESTALE; return -ESTALE;
di->di_mode = be32_to_cpu(str->di_mode); ip->i_inode.i_mode = be32_to_cpu(str->di_mode);
ip->i_inode.i_rdev = 0; ip->i_inode.i_rdev = 0;
switch (di->di_mode & S_IFMT) { switch (ip->i_inode.i_mode & S_IFMT) {
case S_IFBLK: case S_IFBLK:
case S_IFCHR: case S_IFCHR:
ip->i_inode.i_rdev = MKDEV(be32_to_cpu(str->di_major), ip->i_inode.i_rdev = MKDEV(be32_to_cpu(str->di_major),
...@@ -620,7 +616,7 @@ static void munge_mode_uid_gid(struct gfs2_inode *dip, unsigned int *mode, ...@@ -620,7 +616,7 @@ static void munge_mode_uid_gid(struct gfs2_inode *dip, unsigned int *mode,
unsigned int *uid, unsigned int *gid) unsigned int *uid, unsigned int *gid)
{ {
if (GFS2_SB(&dip->i_inode)->sd_args.ar_suiddir && if (GFS2_SB(&dip->i_inode)->sd_args.ar_suiddir &&
(dip->i_di.di_mode & S_ISUID) && dip->i_di.di_uid) { (dip->i_inode.i_mode & S_ISUID) && dip->i_di.di_uid) {
if (S_ISDIR(*mode)) if (S_ISDIR(*mode))
*mode |= S_ISUID; *mode |= S_ISUID;
else if (dip->i_di.di_uid != current->fsuid) else if (dip->i_di.di_uid != current->fsuid)
...@@ -629,7 +625,7 @@ static void munge_mode_uid_gid(struct gfs2_inode *dip, unsigned int *mode, ...@@ -629,7 +625,7 @@ static void munge_mode_uid_gid(struct gfs2_inode *dip, unsigned int *mode,
} else } else
*uid = current->fsuid; *uid = current->fsuid;
if (dip->i_di.di_mode & S_ISGID) { if (dip->i_inode.i_mode & S_ISGID) {
if (S_ISDIR(*mode)) if (S_ISDIR(*mode))
*mode |= S_ISGID; *mode |= S_ISGID;
*gid = dip->i_di.di_gid; *gid = dip->i_di.di_gid;
...@@ -810,7 +806,7 @@ static int link_dinode(struct gfs2_inode *dip, const struct qstr *name, ...@@ -810,7 +806,7 @@ static int link_dinode(struct gfs2_inode *dip, const struct qstr *name,
goto fail_quota_locks; goto fail_quota_locks;
} }
error = gfs2_dir_add(&dip->i_inode, name, &ip->i_num, IF2DT(ip->i_di.di_mode)); error = gfs2_dir_add(&dip->i_inode, name, &ip->i_num, IF2DT(ip->i_inode.i_mode));
if (error) if (error)
goto fail_end_trans; goto fail_end_trans;
...@@ -1053,7 +1049,7 @@ int gfs2_unlink_ok(struct gfs2_inode *dip, const struct qstr *name, ...@@ -1053,7 +1049,7 @@ int gfs2_unlink_ok(struct gfs2_inode *dip, const struct qstr *name,
if (IS_IMMUTABLE(&ip->i_inode) || IS_APPEND(&ip->i_inode)) if (IS_IMMUTABLE(&ip->i_inode) || IS_APPEND(&ip->i_inode))
return -EPERM; return -EPERM;
if ((dip->i_di.di_mode & S_ISVTX) && if ((dip->i_inode.i_mode & S_ISVTX) &&
dip->i_di.di_uid != current->fsuid && dip->i_di.di_uid != current->fsuid &&
ip->i_di.di_uid != current->fsuid && !capable(CAP_FOWNER)) ip->i_di.di_uid != current->fsuid && !capable(CAP_FOWNER))
return -EPERM; return -EPERM;
...@@ -1072,7 +1068,7 @@ int gfs2_unlink_ok(struct gfs2_inode *dip, const struct qstr *name, ...@@ -1072,7 +1068,7 @@ int gfs2_unlink_ok(struct gfs2_inode *dip, const struct qstr *name,
if (!gfs2_inum_equal(&inum, &ip->i_num)) if (!gfs2_inum_equal(&inum, &ip->i_num))
return -ENOENT; return -ENOENT;
if (IF2DT(ip->i_di.di_mode) != type) { if (IF2DT(ip->i_inode.i_mode) != type) {
gfs2_consist_inode(dip); gfs2_consist_inode(dip);
return -EIO; return -EIO;
} }
......
...@@ -22,7 +22,7 @@ static inline int gfs2_is_jdata(struct gfs2_inode *ip) ...@@ -22,7 +22,7 @@ static inline int gfs2_is_jdata(struct gfs2_inode *ip)
static inline int gfs2_is_dir(struct gfs2_inode *ip) static inline int gfs2_is_dir(struct gfs2_inode *ip)
{ {
return S_ISDIR(ip->i_di.di_mode); return S_ISDIR(ip->i_inode.i_mode);
} }
void gfs2_inode_attr_in(struct gfs2_inode *ip); void gfs2_inode_attr_in(struct gfs2_inode *ip);
......
...@@ -161,7 +161,7 @@ void gfs2_dinode_out(const struct gfs2_inode *ip, void *buf) ...@@ -161,7 +161,7 @@ void gfs2_dinode_out(const struct gfs2_inode *ip, void *buf)
gfs2_inum_out(&ip->i_num, &str->di_num); gfs2_inum_out(&ip->i_num, &str->di_num);
str->di_mode = cpu_to_be32(di->di_mode); str->di_mode = cpu_to_be32(ip->i_inode.i_mode);
str->di_uid = cpu_to_be32(di->di_uid); str->di_uid = cpu_to_be32(di->di_uid);
str->di_gid = cpu_to_be32(di->di_gid); str->di_gid = cpu_to_be32(di->di_gid);
str->di_nlink = cpu_to_be32(di->di_nlink); str->di_nlink = cpu_to_be32(di->di_nlink);
...@@ -191,7 +191,6 @@ void gfs2_dinode_print(const struct gfs2_inode *ip) ...@@ -191,7 +191,6 @@ void gfs2_dinode_print(const struct gfs2_inode *ip)
gfs2_inum_print(&ip->i_num); gfs2_inum_print(&ip->i_num);
pv(di, di_mode, "0%o");
pv(di, di_uid, "%u"); pv(di, di_uid, "%u");
pv(di, di_gid, "%u"); pv(di, di_gid, "%u");
pv(di, di_nlink, "%u"); pv(di, di_nlink, "%u");
......
...@@ -498,7 +498,6 @@ static int gfs2_commit_write(struct file *file, struct page *page, ...@@ -498,7 +498,6 @@ static int gfs2_commit_write(struct file *file, struct page *page,
di->di_size = cpu_to_be64(inode->i_size); di->di_size = cpu_to_be64(inode->i_size);
} }
di->di_mode = cpu_to_be32(inode->i_mode);
di->di_atime = cpu_to_be64(inode->i_atime.tv_sec); di->di_atime = cpu_to_be64(inode->i_atime.tv_sec);
di->di_mtime = cpu_to_be64(inode->i_mtime.tv_sec); di->di_mtime = cpu_to_be64(inode->i_mtime.tv_sec);
di->di_ctime = cpu_to_be64(inode->i_ctime.tv_sec); di->di_ctime = cpu_to_be64(inode->i_ctime.tv_sec);
......
...@@ -76,7 +76,7 @@ static int gfs2_drevalidate(struct dentry *dentry, struct nameidata *nd) ...@@ -76,7 +76,7 @@ static int gfs2_drevalidate(struct dentry *dentry, struct nameidata *nd)
if (!gfs2_inum_equal(&ip->i_num, &inum)) if (!gfs2_inum_equal(&ip->i_num, &inum))
goto invalid_gunlock; goto invalid_gunlock;
if (IF2DT(ip->i_di.di_mode) != type) { if (IF2DT(ip->i_inode.i_mode) != type) {
gfs2_consist_inode(dip); gfs2_consist_inode(dip);
goto fail_gunlock; goto fail_gunlock;
} }
......
...@@ -425,7 +425,7 @@ static int gfs2_open(struct inode *inode, struct file *file) ...@@ -425,7 +425,7 @@ static int gfs2_open(struct inode *inode, struct file *file)
gfs2_assert_warn(GFS2_SB(inode), !file->private_data); gfs2_assert_warn(GFS2_SB(inode), !file->private_data);
file->private_data = fp; file->private_data = fp;
if (S_ISREG(ip->i_di.di_mode)) { if (S_ISREG(ip->i_inode.i_mode)) {
error = gfs2_glock_nq_init(ip->i_gl, LM_ST_SHARED, LM_FLAG_ANY, error = gfs2_glock_nq_init(ip->i_gl, LM_ST_SHARED, LM_FLAG_ANY,
&i_gh); &i_gh);
if (error) if (error)
...@@ -515,7 +515,7 @@ static int gfs2_lock(struct file *file, int cmd, struct file_lock *fl) ...@@ -515,7 +515,7 @@ static int gfs2_lock(struct file *file, int cmd, struct file_lock *fl)
if (!(fl->fl_flags & FL_POSIX)) if (!(fl->fl_flags & FL_POSIX))
return -ENOLCK; return -ENOLCK;
if ((ip->i_di.di_mode & (S_ISGID | S_IXGRP)) == S_ISGID) if ((ip->i_inode.i_mode & (S_ISGID | S_IXGRP)) == S_ISGID)
return -ENOLCK; return -ENOLCK;
if (sdp->sd_args.ar_localflocks) { if (sdp->sd_args.ar_localflocks) {
...@@ -617,7 +617,7 @@ static int gfs2_flock(struct file *file, int cmd, struct file_lock *fl) ...@@ -617,7 +617,7 @@ static int gfs2_flock(struct file *file, int cmd, struct file_lock *fl)
if (!(fl->fl_flags & FL_FLOCK)) if (!(fl->fl_flags & FL_FLOCK))
return -ENOLCK; return -ENOLCK;
if ((ip->i_di.di_mode & (S_ISGID | S_IXGRP)) == S_ISGID) if ((ip->i_inode.i_mode & (S_ISGID | S_IXGRP)) == S_ISGID)
return -ENOLCK; return -ENOLCK;
if (sdp->sd_args.ar_localflocks) if (sdp->sd_args.ar_localflocks)
......
...@@ -144,7 +144,7 @@ static int gfs2_link(struct dentry *old_dentry, struct inode *dir, ...@@ -144,7 +144,7 @@ static int gfs2_link(struct dentry *old_dentry, struct inode *dir,
int alloc_required; int alloc_required;
int error; int error;
if (S_ISDIR(ip->i_di.di_mode)) if (S_ISDIR(inode->i_mode))
return -EPERM; return -EPERM;
gfs2_holder_init(dip->i_gl, LM_ST_EXCLUSIVE, 0, ghs); gfs2_holder_init(dip->i_gl, LM_ST_EXCLUSIVE, 0, ghs);
...@@ -220,7 +220,7 @@ static int gfs2_link(struct dentry *old_dentry, struct inode *dir, ...@@ -220,7 +220,7 @@ static int gfs2_link(struct dentry *old_dentry, struct inode *dir,
} }
error = gfs2_dir_add(dir, &dentry->d_name, &ip->i_num, error = gfs2_dir_add(dir, &dentry->d_name, &ip->i_num,
IF2DT(ip->i_di.di_mode)); IF2DT(inode->i_mode));
if (error) if (error)
goto out_end_trans; goto out_end_trans;
...@@ -564,11 +564,10 @@ static int gfs2_rename(struct inode *odir, struct dentry *odentry, ...@@ -564,11 +564,10 @@ static int gfs2_rename(struct inode *odir, struct dentry *odentry,
/* Make sure we aren't trying to move a dirctory into it's subdir */ /* Make sure we aren't trying to move a dirctory into it's subdir */
if (S_ISDIR(ip->i_di.di_mode) && odip != ndip) { if (S_ISDIR(ip->i_inode.i_mode) && odip != ndip) {
dir_rename = 1; dir_rename = 1;
error = gfs2_glock_nq_init(sdp->sd_rename_gl, error = gfs2_glock_nq_init(sdp->sd_rename_gl, LM_ST_EXCLUSIVE, 0,
LM_ST_EXCLUSIVE, 0,
&r_gh); &r_gh);
if (error) if (error)
goto out; goto out;
...@@ -609,7 +608,7 @@ static int gfs2_rename(struct inode *odir, struct dentry *odentry, ...@@ -609,7 +608,7 @@ static int gfs2_rename(struct inode *odir, struct dentry *odentry,
if (error) if (error)
goto out_gunlock; goto out_gunlock;
if (S_ISDIR(nip->i_di.di_mode)) { if (S_ISDIR(nip->i_inode.i_mode)) {
if (nip->i_di.di_entries < 2) { if (nip->i_di.di_entries < 2) {
if (gfs2_consist_inode(nip)) if (gfs2_consist_inode(nip))
gfs2_dinode_print(nip); gfs2_dinode_print(nip);
...@@ -646,7 +645,7 @@ static int gfs2_rename(struct inode *odir, struct dentry *odentry, ...@@ -646,7 +645,7 @@ static int gfs2_rename(struct inode *odir, struct dentry *odentry,
error = -EFBIG; error = -EFBIG;
goto out_gunlock; goto out_gunlock;
} }
if (S_ISDIR(ip->i_di.di_mode) && if (S_ISDIR(ip->i_inode.i_mode) &&
ndip->i_di.di_nlink == (u32)-1) { ndip->i_di.di_nlink == (u32)-1) {
error = -EMLINK; error = -EMLINK;
goto out_gunlock; goto out_gunlock;
...@@ -701,7 +700,7 @@ static int gfs2_rename(struct inode *odir, struct dentry *odentry, ...@@ -701,7 +700,7 @@ static int gfs2_rename(struct inode *odir, struct dentry *odentry,
/* Remove the target file, if it exists */ /* Remove the target file, if it exists */
if (nip) { if (nip) {
if (S_ISDIR(nip->i_di.di_mode)) if (S_ISDIR(nip->i_inode.i_mode))
error = gfs2_rmdiri(ndip, &ndentry->d_name, nip); error = gfs2_rmdiri(ndip, &ndentry->d_name, nip);
else { else {
error = gfs2_dir_del(ndip, &ndentry->d_name); error = gfs2_dir_del(ndip, &ndentry->d_name);
...@@ -743,7 +742,7 @@ static int gfs2_rename(struct inode *odir, struct dentry *odentry, ...@@ -743,7 +742,7 @@ static int gfs2_rename(struct inode *odir, struct dentry *odentry,
goto out_end_trans; goto out_end_trans;
error = gfs2_dir_add(ndir, &ndentry->d_name, &ip->i_num, error = gfs2_dir_add(ndir, &ndentry->d_name, &ip->i_num,
IF2DT(ip->i_di.di_mode)); IF2DT(ip->i_inode.i_mode));
if (error) if (error)
goto out_end_trans; goto out_end_trans;
......
...@@ -407,7 +407,7 @@ static void gfs2_delete_inode(struct inode *inode) ...@@ -407,7 +407,7 @@ static void gfs2_delete_inode(struct inode *inode)
if (error) if (error)
goto out_uninit; goto out_uninit;
if (S_ISDIR(ip->i_di.di_mode) && if (S_ISDIR(inode->i_mode) &&
(ip->i_di.di_flags & GFS2_DIF_EXHASH)) { (ip->i_di.di_flags & GFS2_DIF_EXHASH)) {
error = gfs2_dir_exhash_dealloc(ip); error = gfs2_dir_exhash_dealloc(ip);
if (error) if (error)
......
...@@ -322,7 +322,6 @@ struct gfs2_dinode { ...@@ -322,7 +322,6 @@ struct gfs2_dinode {
}; };
struct gfs2_dinode_host { struct gfs2_dinode_host {
__u32 di_mode; /* mode of file */
__u32 di_uid; /* owner's user id */ __u32 di_uid; /* owner's user id */
__u32 di_gid; /* owner's group id */ __u32 di_gid; /* owner's group id */
__u32 di_nlink; /* number of links to this file */ __u32 di_nlink; /* number of links to this file */
......
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