*
* This copyrighted material is made available to anyone wishing to use,
* modify, copy, or redistribute it subject to the terms and conditions
- * of the GNU General Public License v.2.
+ * of the GNU General Public License version 2.
*/
#include <linux/sched.h>
#include <linux/sort.h>
#include <linux/gfs2_ondisk.h>
#include <linux/crc32.h>
+#include <linux/lm_interface.h>
#include "gfs2.h"
-#include "lm_interface.h"
#include "incore.h"
#include "acl.h"
#include "bmap.h"
void gfs2_inode_attr_in(struct gfs2_inode *ip)
{
struct inode *inode = &ip->i_inode;
+ struct gfs2_dinode *di = &ip->i_di;
inode->i_ino = ip->i_num.no_addr;
- switch (ip->i_di.di_mode & S_IFMT) {
+ switch (di->di_mode & S_IFMT) {
case S_IFBLK:
case S_IFCHR:
- inode->i_rdev = MKDEV(ip->i_di.di_major, ip->i_di.di_minor);
+ inode->i_rdev = MKDEV(di->di_major, di->di_minor);
break;
default:
inode->i_rdev = 0;
break;
};
- inode->i_mode = ip->i_di.di_mode;
- inode->i_nlink = ip->i_di.di_nlink;
- inode->i_uid = ip->i_di.di_uid;
- inode->i_gid = ip->i_di.di_gid;
- i_size_write(inode, ip->i_di.di_size);
- inode->i_atime.tv_sec = ip->i_di.di_atime;
- inode->i_mtime.tv_sec = ip->i_di.di_mtime;
- inode->i_ctime.tv_sec = ip->i_di.di_ctime;
+ inode->i_mode = di->di_mode;
+ inode->i_nlink = di->di_nlink;
+ inode->i_uid = di->di_uid;
+ inode->i_gid = di->di_gid;
+ i_size_write(inode, di->di_size);
+ inode->i_atime.tv_sec = di->di_atime;
+ inode->i_mtime.tv_sec = di->di_mtime;
+ inode->i_ctime.tv_sec = di->di_ctime;
inode->i_atime.tv_nsec = 0;
inode->i_mtime.tv_nsec = 0;
inode->i_ctime.tv_nsec = 0;
- inode->i_blksize = PAGE_SIZE;
- inode->i_blocks = ip->i_di.di_blocks <<
+ inode->i_blocks = di->di_blocks <<
(GFS2_SB(inode)->sd_sb.sb_bsize_shift - GFS2_BASIC_BLOCK_SHIFT);
- if (ip->i_di.di_flags & GFS2_DIF_IMMUTABLE)
+ if (di->di_flags & GFS2_DIF_IMMUTABLE)
inode->i_flags |= S_IMMUTABLE;
else
inode->i_flags &= ~S_IMMUTABLE;
- if (ip->i_di.di_flags & GFS2_DIF_APPENDONLY)
+ if (di->di_flags & GFS2_DIF_APPENDONLY)
inode->i_flags |= S_APPEND;
else
inode->i_flags &= ~S_APPEND;
void gfs2_inode_attr_out(struct gfs2_inode *ip)
{
struct inode *inode = &ip->i_inode;
-
+ struct gfs2_dinode *di = &ip->i_di;
gfs2_assert_withdraw(GFS2_SB(inode),
- (ip->i_di.di_mode & S_IFMT) == (inode->i_mode & S_IFMT));
- ip->i_di.di_mode = inode->i_mode;
- ip->i_di.di_uid = inode->i_uid;
- ip->i_di.di_gid = inode->i_gid;
- ip->i_di.di_atime = inode->i_atime.tv_sec;
- ip->i_di.di_mtime = inode->i_mtime.tv_sec;
- ip->i_di.di_ctime = inode->i_ctime.tv_sec;
+ (di->di_mode & S_IFMT) == (inode->i_mode & S_IFMT));
+ di->di_mode = inode->i_mode;
+ di->di_uid = inode->i_uid;
+ di->di_gid = inode->i_gid;
+ di->di_atime = inode->i_atime.tv_sec;
+ di->di_mtime = inode->i_mtime.tv_sec;
+ di->di_ctime = inode->i_ctime.tv_sec;
}
static int iget_test(struct inode *inode, void *opaque)
if (inode->i_state & I_NEW) {
struct gfs2_sbd *sdp = GFS2_SB(inode);
umode_t mode = DT2IF(type);
- inode->u.generic_ip = ip;
+ inode->i_private = ip;
inode->i_mode = mode;
if (S_ISREG(mode)) {
if (error)
goto out_rindex_relse;
- error = gfs2_trans_begin(sdp, RES_RG_BIT +
- RES_STATFS + RES_QUOTA, 1);
+ error = gfs2_trans_begin(sdp, RES_RG_BIT + RES_STATFS + RES_QUOTA, 1);
if (error)
goto out_rg_gunlock;
{
struct gfs2_sbd *sdp = ip->i_inode.i_sb->s_fs_info;
struct buffer_head *dibh;
- uint32_t nlink;
+ u32 nlink;
int error;
BUG_ON(ip->i_di.di_nlink != ip->i_inode.i_nlink);
struct inode *gfs2_lookupi(struct inode *dir, const struct qstr *name,
int is_root, struct nameidata *nd)
-
{
struct super_block *sb = dir->i_sb;
struct gfs2_inode *dip = GFS2_I(dir);
return inode;
}
-static int pick_formal_ino_1(struct gfs2_sbd *sdp, uint64_t *formal_ino)
+static int pick_formal_ino_1(struct gfs2_sbd *sdp, u64 *formal_ino)
{
struct gfs2_inode *ip = GFS2_I(sdp->sd_ir_inode);
struct buffer_head *bh;
return 1;
}
-static int pick_formal_ino_2(struct gfs2_sbd *sdp, uint64_t *formal_ino)
+static int pick_formal_ino_2(struct gfs2_sbd *sdp, u64 *formal_ino)
{
struct gfs2_inode *ip = GFS2_I(sdp->sd_ir_inode);
struct gfs2_inode *m_ip = GFS2_I(sdp->sd_inum_inode);
error = gfs2_meta_inode_buffer(ip, &bh);
if (error)
goto out_end_trans;
-
+
gfs2_inum_range_in(&ir, bh->b_data + sizeof(struct gfs2_dinode));
if (!ir.ir_length) {
struct buffer_head *m_bh;
- uint64_t x, y;
+ u64 x, y;
error = gfs2_meta_inode_buffer(m_ip, &m_bh);
if (error)
goto out_brelse;
- x = *(uint64_t *)(m_bh->b_data + sizeof(struct gfs2_dinode));
+ x = *(u64 *)(m_bh->b_data + sizeof(struct gfs2_dinode));
x = y = be64_to_cpu(x);
ir.ir_start = x;
ir.ir_length = GFS2_INUM_QUANTUM;
gfs2_consist_inode(m_ip);
x = cpu_to_be64(x);
gfs2_trans_add_bh(m_ip->i_gl, m_bh, 1);
- *(uint64_t *)(m_bh->b_data + sizeof(struct gfs2_dinode)) = x;
+ *(u64 *)(m_bh->b_data + sizeof(struct gfs2_dinode)) = x;
brelse(m_bh);
}
gfs2_trans_add_bh(ip->i_gl, bh, 1);
gfs2_inum_range_out(&ir, bh->b_data + sizeof(struct gfs2_dinode));
- out_brelse:
+out_brelse:
brelse(bh);
-
- out_end_trans:
+out_end_trans:
mutex_unlock(&sdp->sd_inum_mutex);
gfs2_trans_end(sdp);
-
- out:
+out:
gfs2_glock_dq_uninit(&gh);
-
return error;
}
-static int pick_formal_ino(struct gfs2_sbd *sdp, uint64_t *inum)
+static int pick_formal_ino(struct gfs2_sbd *sdp, u64 *inum)
{
int error;
return error;
}
- if (dip->i_di.di_entries == (uint32_t)-1)
+ if (dip->i_di.di_entries == (u32)-1)
return -EFBIG;
- if (S_ISDIR(mode) && dip->i_di.di_nlink == (uint32_t)-1)
+ if (S_ISDIR(mode) && dip->i_di.di_nlink == (u32)-1)
return -EMLINK;
return 0;
unsigned int *uid, unsigned int *gid)
{
if (GFS2_SB(&dip->i_inode)->sd_args.ar_suiddir &&
- (dip->i_di.di_mode & S_ISUID) &&
- dip->i_di.di_uid) {
+ (dip->i_di.di_mode & S_ISUID) && dip->i_di.di_uid) {
if (S_ISDIR(*mode))
*mode |= S_ISUID;
else if (dip->i_di.di_uid != current->fsuid)
out_ipreserv:
gfs2_inplace_release(dip);
-
out:
gfs2_alloc_put(dip);
-
return error;
}
}
di->__pad1 = 0;
+ di->di_payload_format = cpu_to_be32(0);
di->di_height = cpu_to_be32(0);
di->__pad2 = 0;
di->__pad3 = 0;
error = gfs2_trans_begin(sdp, sdp->sd_max_dirres +
al->al_rgd->rd_ri.ri_length +
- 2 * RES_DINODE +
+ 2 * RES_DINODE +
RES_STATFS + RES_QUOTA, 0);
if (error)
goto fail_ipreserv;
struct gfs2_glock *gl = gh->gh_gl;
struct gfs2_sbd *sdp = gl->gl_sbd;
struct gfs2_inode *ip = gl->gl_object;
- int64_t curtime, quantum = gfs2_tune_get(sdp, gt_atime_quantum);
+ s64 curtime, quantum = gfs2_tune_get(sdp, gt_atime_quantum);
unsigned int state;
int flags;
int error;
*
* Returns: 1 if A > B
* -1 if A < B
- * 0 if A = B
+ * 0 if A == B
*/
static int glock_compare_atime(const void *arg_a, const void *arg_b)
{
- struct gfs2_holder *gh_a = *(struct gfs2_holder **)arg_a;
- struct gfs2_holder *gh_b = *(struct gfs2_holder **)arg_b;
- struct lm_lockname *a = &gh_a->gh_gl->gl_name;
- struct lm_lockname *b = &gh_b->gh_gl->gl_name;
- int ret = 0;
+ const struct gfs2_holder *gh_a = *(const struct gfs2_holder **)arg_a;
+ const struct gfs2_holder *gh_b = *(const struct gfs2_holder **)arg_b;
+ const struct lm_lockname *a = &gh_a->gh_gl->gl_name;
+ const struct lm_lockname *b = &gh_b->gh_gl->gl_name;
if (a->ln_number > b->ln_number)
- ret = 1;
- else if (a->ln_number < b->ln_number)
- ret = -1;
- else {
- if (gh_a->gh_state == LM_ST_SHARED &&
- gh_b->gh_state == LM_ST_EXCLUSIVE)
- ret = 1;
- else if (gh_a->gh_state == LM_ST_SHARED &&
- (gh_b->gh_flags & GL_ATIME))
- ret = 1;
- }
+ return 1;
+ if (a->ln_number < b->ln_number)
+ return -1;
+ if (gh_a->gh_state == LM_ST_SHARED && gh_b->gh_state == LM_ST_EXCLUSIVE)
+ return 1;
+ if (gh_a->gh_state == LM_ST_SHARED && (gh_b->gh_flags & GL_ATIME))
+ return 1;
- return ret;
+ return 0;
}
/**
}
kfree(p);
-
return error;
}
return error;
error = __gfs2_setattr_simple(ip, attr);
-
gfs2_trans_end(GFS2_SB(&ip->i_inode));
-
return error;
}