Add the new external read function. Its temporarily in jdata.c
even though the protoype is in ops_file.h - this will change
shortly. The current implementation will change to a page cache
one when that happens.
In order to effect the above changes, the various internal inodes
now have Linux inodes attached to them. We keep the references to
the Linux inodes, rather than the gfs2_inodes in the super block.
In order to get everything to work correctly I've had to reorder
the init sequence on mount (which I should probably have done
earlier when .gfs2_admin was made visible).
Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
12 files changed:
enum gfs2_state_bits {
BH_Pinned = BH_PrivateStart,
enum gfs2_state_bits {
BH_Pinned = BH_PrivateStart,
+ BH_Escaped = BH_PrivateStart + 1,
};
BUFFER_FNS(Pinned, pinned)
TAS_BUFFER_FNS(Pinned, pinned)
};
BUFFER_FNS(Pinned, pinned)
TAS_BUFFER_FNS(Pinned, pinned)
+BUFFER_FNS(Escaped, escaped)
+TAS_BUFFER_FNS(Escaped, escaped)
struct gfs2_bufdata {
struct buffer_head *bd_bh;
struct gfs2_bufdata {
struct buffer_head *bd_bh;
struct inode *i_vnode;
struct gfs2_holder i_iopen_gh;
struct inode *i_vnode;
struct gfs2_holder i_iopen_gh;
+ struct gfs2_holder i_gh; /* for prepare/commit_write only */
struct gfs2_alloc i_alloc;
uint64_t i_last_rg_alloc;
struct gfs2_alloc i_alloc;
uint64_t i_last_rg_alloc;
- struct gfs2_inode *sd_master_dir;
- struct gfs2_inode *sd_jindex;
- struct gfs2_inode *sd_inum_inode;
- struct gfs2_inode *sd_statfs_inode;
- struct gfs2_inode *sd_ir_inode;
- struct gfs2_inode *sd_sc_inode;
- struct gfs2_inode *sd_ut_inode;
- struct gfs2_inode *sd_qc_inode;
- struct gfs2_inode *sd_rindex;
- struct gfs2_inode *sd_quota_inode;
- struct gfs2_inode *sd_root_dir;
+ struct inode *sd_master_dir;
+ struct inode *sd_jindex;
+ struct inode *sd_inum_inode;
+ struct inode *sd_statfs_inode;
+ struct inode *sd_ir_inode;
+ struct inode *sd_sc_inode;
+ struct inode *sd_ut_inode;
+ struct inode *sd_qc_inode;
+ struct inode *sd_rindex;
+ struct inode *sd_quota_inode;
+ struct inode *sd_root_dir;
unsigned int sd_log_num_revoke;
unsigned int sd_log_num_rg;
unsigned int sd_log_num_databuf;
unsigned int sd_log_num_revoke;
unsigned int sd_log_num_rg;
unsigned int sd_log_num_databuf;
+ unsigned int sd_log_num_jdata;
+
struct list_head sd_log_le_gl;
struct list_head sd_log_le_buf;
struct list_head sd_log_le_revoke;
struct list_head sd_log_le_gl;
struct list_head sd_log_le_buf;
struct list_head sd_log_le_revoke;
return -ENAMETOOLONG;
if (gfs2_filecmp(name, ".", 1) ||
return -ENAMETOOLONG;
if (gfs2_filecmp(name, ".", 1) ||
- (gfs2_filecmp(name, "..", 2) && dip == sdp->sd_root_dir)) {
+ (gfs2_filecmp(name, "..", 2) && dip == get_v2ip(sdp->sd_root_dir))) {
gfs2_inode_hold(dip);
*ipp = dip;
return 0;
gfs2_inode_hold(dip);
*ipp = dip;
return 0;
static int pick_formal_ino_1(struct gfs2_sbd *sdp, uint64_t *formal_ino)
{
static int pick_formal_ino_1(struct gfs2_sbd *sdp, uint64_t *formal_ino)
{
- struct gfs2_inode *ip = sdp->sd_ir_inode;
+ struct gfs2_inode *ip = get_v2ip(sdp->sd_ir_inode);
struct buffer_head *bh;
struct gfs2_inum_range ir;
int error;
struct buffer_head *bh;
struct gfs2_inum_range ir;
int error;
static int pick_formal_ino_2(struct gfs2_sbd *sdp, uint64_t *formal_ino)
{
static int pick_formal_ino_2(struct gfs2_sbd *sdp, uint64_t *formal_ino)
{
- struct gfs2_inode *ip = sdp->sd_ir_inode;
- struct gfs2_inode *m_ip = sdp->sd_inum_inode;
+ struct gfs2_inode *ip = get_v2ip(sdp->sd_ir_inode);
+ struct gfs2_inode *m_ip = get_v2ip(sdp->sd_inum_inode);
struct gfs2_holder gh;
struct buffer_head *bh;
struct gfs2_inum_range ir;
struct gfs2_holder gh;
struct buffer_head *bh;
struct gfs2_inum_range ir;
error = -EINVAL;
break;
}
error = -EINVAL;
break;
}
- if (to == sdp->sd_root_dir) {
+ if (to == get_v2ip(sdp->sd_root_dir)) {
int gfs2_repermission(struct inode *inode, int mask, struct nameidata *nd);
int gfs2_repermission(struct inode *inode, int mask, struct nameidata *nd);
-static inline int gfs2_lookup_simple(struct gfs2_inode *dip, char *name,
- struct gfs2_inode **ipp)
+static inline int gfs2_lookup_simple(struct inode *dip, char *name,
+ struct inode **ipp)
memset(&qstr, 0, sizeof(struct qstr));
qstr.name = name;
qstr.len = strlen(name);
memset(&qstr, 0, sizeof(struct qstr));
qstr.name = name;
qstr.len = strlen(name);
- return gfs2_lookupi(dip, &qstr, 1, ipp);
+ err = gfs2_lookupi(get_v2ip(dip), &qstr, 1, &ip);
+ if (err == 0) {
+ *ipp = gfs2_ip2v(ip);
+ if (*ipp == NULL)
+ err = -ENOMEM;
+ gfs2_inode_put(ip);
+ }
+ return err;
}
#endif /* __INODE_DOT_H__ */
}
#endif /* __INODE_DOT_H__ */
#include "meta_io.h"
#include "trans.h"
#include "meta_io.h"
#include "trans.h"
+int gfs2_internal_read(struct gfs2_inode *ip,
+ struct file_ra_state *ra_state,
+ char *buf, loff_t *pos, unsigned size)
+{
+ return gfs2_jdata_read_mem(ip, buf, *pos, size);
+}
+
int gfs2_jdata_get_buffer(struct gfs2_inode *ip, uint64_t block, int new,
struct buffer_head **bhp)
{
int gfs2_jdata_get_buffer(struct gfs2_inode *ip, uint64_t block, int new,
struct buffer_head **bhp)
{
fh[3] = cpu_to_be32(fh[3]);
*len = 4;
fh[3] = cpu_to_be32(fh[3]);
*len = 4;
- if (!connectable || ip == sdp->sd_root_dir)
+ if (!connectable || ip == get_v2ip(sdp->sd_root_dir))
return *len;
spin_lock(&dentry->d_lock);
return *len;
spin_lock(&dentry->d_lock);
#ifndef __OPS_FILE_DOT_H__
#define __OPS_FILE_DOT_H__
#ifndef __OPS_FILE_DOT_H__
#define __OPS_FILE_DOT_H__
+extern int gfs2_internal_read(struct gfs2_inode *ip,
+ struct file_ra_state *ra_state,
+ char *buf, loff_t *pos, unsigned size);
+
extern struct file_operations gfs2_file_fops;
extern struct file_operations gfs2_dir_fops;
extern struct file_operations gfs2_file_fops;
extern struct file_operations gfs2_dir_fops;
+int gfs2_lookup_root(struct gfs2_sbd *sdp)
+{
+ int error;
+ struct gfs2_glock *gl;
+ struct gfs2_inode *ip;
+
+ error = gfs2_glock_get(sdp, sdp->sd_sb.sb_root_dir.no_addr,
+ &gfs2_inode_glops, CREATE, &gl);
+ if (!error) {
+ error = gfs2_inode_get(gl, &sdp->sd_sb.sb_root_dir,
+ CREATE, &ip);
+ if (!error) {
+ if (!error)
+ gfs2_inode_min_init(ip, DT_DIR);
+ sdp->sd_root_dir = gfs2_ip2v(ip);
+ gfs2_inode_put(ip);
+ }
+ gfs2_glock_put(gl);
+ }
+
+ return error;
+}
+
static int init_sb(struct gfs2_sbd *sdp, int silent, int undo)
{
struct super_block *sb = sdp->sd_vfs;
struct gfs2_holder sb_gh;
static int init_sb(struct gfs2_sbd *sdp, int silent, int undo)
{
struct super_block *sb = sdp->sd_vfs;
struct gfs2_holder sb_gh;
int error = 0;
if (undo) {
int error = 0;
if (undo) {
- gfs2_inode_put(sdp->sd_master_dir);
+ iput(sdp->sd_master_dir);
sb_set_blocksize(sb, sdp->sd_sb.sb_bsize);
sb_set_blocksize(sb, sdp->sd_sb.sb_bsize);
- error = gfs2_lookup_master_dir(sdp);
- if (error)
- fs_err(sdp, "can't read in master directory: %d\n", error);
+ /* Get the root inode */
+ error = gfs2_lookup_root(sdp);
+ if (error) {
+ fs_err(sdp, "can't read in root inode: %d\n", error);
+ goto out;
+ }
+ /* Get the root inode/dentry */
+ inode = sdp->sd_root_dir;
+ if (!inode) {
+ fs_err(sdp, "can't get root inode\n");
+ error = -ENOMEM;
+ goto out_rooti;
+ }
+
+ sb->s_root = d_alloc_root(inode);
+ if (!sb->s_root) {
+ fs_err(sdp, "can't get root dentry\n");
+ error = -ENOMEM;
+ goto out_rooti;
+ }
+
+out:
gfs2_glock_dq_uninit(&sb_gh);
return error;
gfs2_glock_dq_uninit(&sb_gh);
return error;
+out_rooti:
+ iput(sdp->sd_root_dir);
+ goto out;
}
static int init_journal(struct gfs2_sbd *sdp, int undo)
}
static int init_journal(struct gfs2_sbd *sdp, int undo)
fs_err(sdp, "can't lookup journal index: %d\n", error);
return error;
}
fs_err(sdp, "can't lookup journal index: %d\n", error);
return error;
}
- set_bit(GLF_STICKY, &sdp->sd_jindex->i_gl->gl_flags);
+ set_bit(GLF_STICKY, &get_v2ip(sdp->sd_jindex)->i_gl->gl_flags);
/* Load in the journal index special file */
/* Load in the journal index special file */
gfs2_glock_dq_uninit(&ji_gh);
fail:
gfs2_glock_dq_uninit(&ji_gh);
fail:
- gfs2_inode_put(sdp->sd_jindex);
-int gfs2_lookup_root(struct gfs2_sbd *sdp)
-{
- int error;
- struct gfs2_glock *gl;
-
- error = gfs2_glock_get(sdp, sdp->sd_sb.sb_root_dir.no_addr,
- &gfs2_inode_glops, CREATE, &gl);
- if (!error) {
- error = gfs2_inode_get(gl, &sdp->sd_sb.sb_root_dir,
- CREATE, &sdp->sd_root_dir);
- if (!error)
- gfs2_inode_min_init(sdp->sd_root_dir, DT_DIR);
- gfs2_glock_put(gl);
- }
-
- return error;
-}
-
static int init_inodes(struct gfs2_sbd *sdp, int undo)
{
static int init_inodes(struct gfs2_sbd *sdp, int undo)
{
- struct inode *inode;
- struct dentry **dentry = &sdp->sd_vfs->s_root;
+ goto fail_qinode;
+
+ error = gfs2_lookup_master_dir(sdp);
+ if (error) {
+ fs_err(sdp, "can't read in master directory: %d\n", error);
+ goto fail;
+ }
+
+ error = init_journal(sdp, undo);
+ if (error)
+ goto fail_master;
/* Read in the master inode number inode */
error = gfs2_lookup_simple(sdp->sd_master_dir, "inum",
&sdp->sd_inum_inode);
if (error) {
fs_err(sdp, "can't read in inum inode: %d\n", error);
/* Read in the master inode number inode */
error = gfs2_lookup_simple(sdp->sd_master_dir, "inum",
&sdp->sd_inum_inode);
if (error) {
fs_err(sdp, "can't read in inum inode: %d\n", error);
/* Read in the master statfs inode */
error = gfs2_lookup_simple(sdp->sd_master_dir, "statfs",
&sdp->sd_statfs_inode);
if (error) {
fs_err(sdp, "can't read in statfs inode: %d\n", error);
/* Read in the master statfs inode */
error = gfs2_lookup_simple(sdp->sd_master_dir, "statfs",
&sdp->sd_statfs_inode);
if (error) {
fs_err(sdp, "can't read in statfs inode: %d\n", error);
}
/* Read in the resource index inode */
}
/* Read in the resource index inode */
fs_err(sdp, "can't get resource index inode: %d\n", error);
goto fail_statfs;
}
fs_err(sdp, "can't get resource index inode: %d\n", error);
goto fail_statfs;
}
- set_bit(GLF_STICKY, &sdp->sd_rindex->i_gl->gl_flags);
- sdp->sd_rindex_vn = sdp->sd_rindex->i_gl->gl_vn - 1;
+ set_bit(GLF_STICKY, &get_v2ip(sdp->sd_rindex)->i_gl->gl_flags);
+ sdp->sd_rindex_vn = get_v2ip(sdp->sd_rindex)->i_gl->gl_vn - 1;
/* Read in the quota inode */
error = gfs2_lookup_simple(sdp->sd_master_dir, "quota",
/* Read in the quota inode */
error = gfs2_lookup_simple(sdp->sd_master_dir, "quota",
fs_err(sdp, "can't get quota file inode: %d\n", error);
goto fail_rindex;
}
fs_err(sdp, "can't get quota file inode: %d\n", error);
goto fail_rindex;
}
-
- /* Get the root inode */
- error = gfs2_lookup_root(sdp);
- if (error) {
- fs_err(sdp, "can't read in root inode: %d\n", error);
- goto fail_qinode;
- }
-
- /* Get the root inode/dentry */
- inode = gfs2_ip2v(sdp->sd_root_dir);
- if (!inode) {
- fs_err(sdp, "can't get root inode\n");
- error = -ENOMEM;
- goto fail_rooti;
- }
-
- *dentry = d_alloc_root(inode);
- if (!*dentry) {
- iput(inode);
- fs_err(sdp, "can't get root dentry\n");
- error = -ENOMEM;
- goto fail_rooti;
- }
-
- fail_dput:
- dput(*dentry);
- *dentry = NULL;
+fail_qinode:
+ iput(sdp->sd_quota_inode);
- fail_rooti:
- gfs2_inode_put(sdp->sd_root_dir);
-
- fail_qinode:
- gfs2_inode_put(sdp->sd_quota_inode);
-
- fail_rindex:
- gfs2_inode_put(sdp->sd_rindex);
-
- fail_statfs:
- gfs2_inode_put(sdp->sd_statfs_inode);
- fail:
- gfs2_inode_put(sdp->sd_inum_inode);
+fail_statfs:
+ iput(sdp->sd_statfs_inode);
+fail_inum:
+ iput(sdp->sd_inum_inode);
+fail_journal:
+ init_journal(sdp, UNDO);
+fail_master:
+ iput(sdp->sd_master_dir);
+fail:
return error;
}
static int init_per_node(struct gfs2_sbd *sdp, int undo)
{
return error;
}
static int init_per_node(struct gfs2_sbd *sdp, int undo)
{
- struct gfs2_inode *pn = NULL;
+ struct inode *pn = NULL;
char buf[30];
int error = 0;
char buf[30];
int error = 0;
- error = gfs2_glock_nq_init(sdp->sd_ir_inode->i_gl,
+ error = gfs2_glock_nq_init(get_v2ip(sdp->sd_ir_inode)->i_gl,
LM_ST_EXCLUSIVE, GL_NEVER_RECURSE,
&sdp->sd_ir_gh);
if (error) {
LM_ST_EXCLUSIVE, GL_NEVER_RECURSE,
&sdp->sd_ir_gh);
if (error) {
- error = gfs2_glock_nq_init(sdp->sd_sc_inode->i_gl,
+ error = gfs2_glock_nq_init(get_v2ip(sdp->sd_sc_inode)->i_gl,
LM_ST_EXCLUSIVE, GL_NEVER_RECURSE,
&sdp->sd_sc_gh);
if (error) {
LM_ST_EXCLUSIVE, GL_NEVER_RECURSE,
&sdp->sd_sc_gh);
if (error) {
- error = gfs2_glock_nq_init(sdp->sd_ut_inode->i_gl,
+ error = gfs2_glock_nq_init(get_v2ip(sdp->sd_ut_inode)->i_gl,
LM_ST_EXCLUSIVE, GL_NEVER_RECURSE,
&sdp->sd_ut_gh);
if (error) {
LM_ST_EXCLUSIVE, GL_NEVER_RECURSE,
&sdp->sd_ut_gh);
if (error) {
- error = gfs2_glock_nq_init(sdp->sd_qc_inode->i_gl,
+ error = gfs2_glock_nq_init(get_v2ip(sdp->sd_qc_inode)->i_gl,
LM_ST_EXCLUSIVE, GL_NEVER_RECURSE,
&sdp->sd_qc_gh);
if (error) {
LM_ST_EXCLUSIVE, GL_NEVER_RECURSE,
&sdp->sd_qc_gh);
if (error) {
gfs2_glock_dq_uninit(&sdp->sd_ir_gh);
fail_qc_i:
gfs2_glock_dq_uninit(&sdp->sd_ir_gh);
fail_qc_i:
- gfs2_inode_put(sdp->sd_qc_inode);
+ iput(sdp->sd_qc_inode);
- gfs2_inode_put(sdp->sd_ut_inode);
+ iput(sdp->sd_ut_inode);
- gfs2_inode_put(sdp->sd_sc_inode);
+ iput(sdp->sd_sc_inode);
- gfs2_inode_put(sdp->sd_ir_inode);
+ iput(sdp->sd_ir_inode);
error = init_sb(sdp, silent, DO);
if (error)
goto fail_locking;
error = init_sb(sdp, silent, DO);
if (error)
goto fail_locking;
-
- error = init_journal(sdp, DO);
- if (error)
- goto fail_sb;
error = init_inodes(sdp, DO);
if (error)
error = init_inodes(sdp, DO);
if (error)
error = init_per_node(sdp, DO);
if (error)
error = init_per_node(sdp, DO);
if (error)
fail_inodes:
init_inodes(sdp, UNDO);
fail_inodes:
init_inodes(sdp, UNDO);
- fail_journals:
- init_journal(sdp, UNDO);
-
fail_sb:
init_sb(sdp, 0, UNDO);
fail_sb:
init_sb(sdp, 0, UNDO);
- gfs2_inode_put(sdp->sd_master_dir);
- gfs2_inode_put(sdp->sd_jindex);
- gfs2_inode_put(sdp->sd_inum_inode);
- gfs2_inode_put(sdp->sd_statfs_inode);
- gfs2_inode_put(sdp->sd_rindex);
- gfs2_inode_put(sdp->sd_quota_inode);
- gfs2_inode_put(sdp->sd_root_dir);
+ iput(sdp->sd_master_dir);
+ iput(sdp->sd_jindex);
+ iput(sdp->sd_inum_inode);
+ iput(sdp->sd_statfs_inode);
+ iput(sdp->sd_rindex);
+ iput(sdp->sd_quota_inode);
+ iput(sdp->sd_root_dir);
gfs2_glock_put(sdp->sd_rename_gl);
gfs2_glock_put(sdp->sd_trans_gl);
gfs2_glock_put(sdp->sd_rename_gl);
gfs2_glock_put(sdp->sd_trans_gl);
gfs2_glock_dq_uninit(&sdp->sd_sc_gh);
gfs2_glock_dq_uninit(&sdp->sd_ut_gh);
gfs2_glock_dq_uninit(&sdp->sd_qc_gh);
gfs2_glock_dq_uninit(&sdp->sd_sc_gh);
gfs2_glock_dq_uninit(&sdp->sd_ut_gh);
gfs2_glock_dq_uninit(&sdp->sd_qc_gh);
- gfs2_inode_put(sdp->sd_ir_inode);
- gfs2_inode_put(sdp->sd_sc_inode);
- gfs2_inode_put(sdp->sd_ut_inode);
- gfs2_inode_put(sdp->sd_qc_inode);
+ iput(sdp->sd_ir_inode);
+ iput(sdp->sd_sc_inode);
+ iput(sdp->sd_ut_inode);
+ iput(sdp->sd_qc_inode);
}
gfs2_glock_dq_uninit(&sdp->sd_live_gh);
}
gfs2_glock_dq_uninit(&sdp->sd_live_gh);
#include "rgrp.h"
#include "super.h"
#include "trans.h"
#include "rgrp.h"
#include "super.h"
#include "trans.h"
#define QUOTA_USER 1
#define QUOTA_GROUP 0
#define QUOTA_USER 1
#define QUOTA_GROUP 0
static int bh_get(struct gfs2_quota_data *qd)
{
struct gfs2_sbd *sdp = qd->qd_gl->gl_sbd;
static int bh_get(struct gfs2_quota_data *qd)
{
struct gfs2_sbd *sdp = qd->qd_gl->gl_sbd;
- struct gfs2_inode *ip = sdp->sd_qc_inode;
+ struct gfs2_inode *ip = get_v2ip(sdp->sd_qc_inode);
unsigned int block, offset;
uint64_t dblock;
int new = 0;
unsigned int block, offset;
uint64_t dblock;
int new = 0;
static void do_qc(struct gfs2_quota_data *qd, int64_t change)
{
struct gfs2_sbd *sdp = qd->qd_gl->gl_sbd;
static void do_qc(struct gfs2_quota_data *qd, int64_t change)
{
struct gfs2_sbd *sdp = qd->qd_gl->gl_sbd;
- struct gfs2_inode *ip = sdp->sd_qc_inode;
+ struct gfs2_inode *ip = get_v2ip(sdp->sd_qc_inode);
struct gfs2_quota_change *qc = qd->qd_bh_qc;
int64_t x;
struct gfs2_quota_change *qc = qd->qd_bh_qc;
int64_t x;
static int do_sync(unsigned int num_qd, struct gfs2_quota_data **qda)
{
struct gfs2_sbd *sdp = (*qda)->qd_gl->gl_sbd;
static int do_sync(unsigned int num_qd, struct gfs2_quota_data **qda)
{
struct gfs2_sbd *sdp = (*qda)->qd_gl->gl_sbd;
- struct gfs2_inode *ip = sdp->sd_quota_inode;
+ struct gfs2_inode *ip = get_v2ip(sdp->sd_quota_inode);
unsigned int data_blocks, ind_blocks;
unsigned int data_blocks, ind_blocks;
+ struct file_ra_state ra_state;
struct gfs2_holder *ghs, i_gh;
unsigned int qx, x;
struct gfs2_quota_data *qd;
struct gfs2_holder *ghs, i_gh;
unsigned int qx, x;
struct gfs2_quota_data *qd;
unsigned int nalloc = 0;
struct gfs2_alloc *al = NULL;
int error;
unsigned int nalloc = 0;
struct gfs2_alloc *al = NULL;
int error;
+ file_ra_state_init(&ra_state, ip->i_vnode->i_mapping);
for (x = 0; x < num_qd; x++) {
char buf[sizeof(struct gfs2_quota)];
struct gfs2_quota q;
for (x = 0; x < num_qd; x++) {
char buf[sizeof(struct gfs2_quota)];
struct gfs2_quota q;
sizeof(struct gfs2_quota) bytes. */
memset(buf, 0, sizeof(struct gfs2_quota));
sizeof(struct gfs2_quota) bytes. */
memset(buf, 0, sizeof(struct gfs2_quota));
- error = gfs2_jdata_read_mem(ip, buf, offset,
+ error = gfs2_internal_read(ip, &ra_state, buf, &offset,
sizeof(struct gfs2_quota));
if (error < 0)
goto out_end_trans;
sizeof(struct gfs2_quota));
if (error < 0)
goto out_end_trans;
struct gfs2_holder i_gh;
struct gfs2_quota q;
char buf[sizeof(struct gfs2_quota)];
struct gfs2_holder i_gh;
struct gfs2_quota q;
char buf[sizeof(struct gfs2_quota)];
+ struct file_ra_state ra_state;
+ file_ra_state_init(&ra_state, sdp->sd_quota_inode->i_mapping);
restart:
error = gfs2_glock_nq_init(qd->qd_gl, LM_ST_SHARED, 0, q_gh);
if (error)
restart:
error = gfs2_glock_nq_init(qd->qd_gl, LM_ST_SHARED, 0, q_gh);
if (error)
gfs2_quota_lvb_in(&qd->qd_qb, qd->qd_gl->gl_lvb);
if (force_refresh || qd->qd_qb.qb_magic != GFS2_MAGIC) {
gfs2_quota_lvb_in(&qd->qd_qb, qd->qd_gl->gl_lvb);
if (force_refresh || qd->qd_qb.qb_magic != GFS2_MAGIC) {
gfs2_glock_dq_uninit(q_gh);
error = gfs2_glock_nq_init(qd->qd_gl,
LM_ST_EXCLUSIVE, GL_NOCACHE,
gfs2_glock_dq_uninit(q_gh);
error = gfs2_glock_nq_init(qd->qd_gl,
LM_ST_EXCLUSIVE, GL_NOCACHE,
- error = gfs2_glock_nq_init(sdp->sd_quota_inode->i_gl,
+ error = gfs2_glock_nq_init(get_v2ip(sdp->sd_quota_inode)->i_gl,
LM_ST_SHARED, 0,
&i_gh);
if (error)
goto fail;
memset(buf, 0, sizeof(struct gfs2_quota));
LM_ST_SHARED, 0,
&i_gh);
if (error)
goto fail;
memset(buf, 0, sizeof(struct gfs2_quota));
-
- error = gfs2_jdata_read_mem(sdp->sd_quota_inode, buf,
- qd2offset(qd),
+ pos = qd2offset(qd);
+ error = gfs2_internal_read(get_v2ip(sdp->sd_quota_inode),
+ &ra_state, buf,
+ &pos,
sizeof(struct gfs2_quota));
if (error < 0)
goto fail_gunlock;
sizeof(struct gfs2_quota));
if (error < 0)
goto fail_gunlock;
int gfs2_quota_init(struct gfs2_sbd *sdp)
{
int gfs2_quota_init(struct gfs2_sbd *sdp)
{
- struct gfs2_inode *ip = sdp->sd_qc_inode;
+ struct gfs2_inode *ip = get_v2ip(sdp->sd_qc_inode);
unsigned int blocks = ip->i_di.di_size >> sdp->sd_sb.sb_bsize_shift;
unsigned int x, slot = 0;
unsigned int found = 0;
unsigned int blocks = ip->i_di.di_size >> sdp->sd_sb.sb_bsize_shift;
unsigned int x, slot = 0;
unsigned int found = 0;
#include <linux/spinlock.h>
#include <linux/completion.h>
#include <linux/buffer_head.h>
#include <linux/spinlock.h>
#include <linux/completion.h>
#include <linux/buffer_head.h>
#include <asm/semaphore.h>
#include "gfs2.h"
#include "bits.h"
#include "glock.h"
#include "glops.h"
#include <asm/semaphore.h>
#include "gfs2.h"
#include "bits.h"
#include "glock.h"
#include "glops.h"
#include "lops.h"
#include "meta_io.h"
#include "quota.h"
#include "rgrp.h"
#include "super.h"
#include "trans.h"
#include "lops.h"
#include "meta_io.h"
#include "quota.h"
#include "rgrp.h"
#include "super.h"
#include "trans.h"
/**
* gfs2_rgrp_verify - Verify that a resource group is consistent
/**
* gfs2_rgrp_verify - Verify that a resource group is consistent
static int gfs2_ri_update(struct gfs2_inode *ip)
{
struct gfs2_sbd *sdp = ip->i_sbd;
static int gfs2_ri_update(struct gfs2_inode *ip)
{
struct gfs2_sbd *sdp = ip->i_sbd;
+ struct inode *inode = ip->i_vnode;
struct gfs2_rgrpd *rgd;
char buf[sizeof(struct gfs2_rindex)];
struct gfs2_rgrpd *rgd;
char buf[sizeof(struct gfs2_rindex)];
+ struct file_ra_state ra_state;
uint64_t junk = ip->i_di.di_size;
int error;
uint64_t junk = ip->i_di.di_size;
int error;
+ file_ra_state_init(&ra_state, inode->i_mapping);
for (sdp->sd_rgrps = 0;; sdp->sd_rgrps++) {
for (sdp->sd_rgrps = 0;; sdp->sd_rgrps++) {
- error = gfs2_jdata_read_mem(ip, buf,
- sdp->sd_rgrps *
- sizeof(struct gfs2_rindex),
+ loff_t pos = sdp->sd_rgrps * sizeof(struct gfs2_rindex);
+ error = gfs2_internal_read(ip, &ra_state, buf, &pos,
sizeof(struct gfs2_rindex));
if (!error)
break;
sizeof(struct gfs2_rindex));
if (!error)
break;
int gfs2_rindex_hold(struct gfs2_sbd *sdp, struct gfs2_holder *ri_gh)
{
int gfs2_rindex_hold(struct gfs2_sbd *sdp, struct gfs2_holder *ri_gh)
{
- struct gfs2_inode *ip = sdp->sd_rindex;
+ struct gfs2_inode *ip = get_v2ip(sdp->sd_rindex);
struct gfs2_glock *gl = ip->i_gl;
int error;
struct gfs2_glock *gl = ip->i_gl;
int error;
int gfs2_jindex_hold(struct gfs2_sbd *sdp, struct gfs2_holder *ji_gh)
{
int gfs2_jindex_hold(struct gfs2_sbd *sdp, struct gfs2_holder *ji_gh)
{
- struct gfs2_inode *dip = sdp->sd_jindex;
+ struct gfs2_inode *dip = get_v2ip(sdp->sd_jindex);
struct qstr name;
char buf[20];
struct gfs2_jdesc *jd;
struct qstr name;
char buf[20];
struct gfs2_jdesc *jd;
name.len = sprintf(buf, "journal%u", sdp->sd_journals);
name.len = sprintf(buf, "journal%u", sdp->sd_journals);
- error = gfs2_dir_search(sdp->sd_jindex, &name, NULL, NULL);
+ error = gfs2_dir_search(get_v2ip(sdp->sd_jindex), &name, NULL, NULL);
if (error == -ENOENT) {
error = 0;
break;
if (error == -ENOENT) {
error = 0;
break;
int gfs2_lookup_master_dir(struct gfs2_sbd *sdp)
{
int gfs2_lookup_master_dir(struct gfs2_sbd *sdp)
{
+ struct inode *inode = NULL;
struct gfs2_glock *gl;
int error;
struct gfs2_glock *gl;
int error;
sdp->sd_sb.sb_master_dir.no_addr,
&gfs2_inode_glops, CREATE, &gl);
if (!error) {
sdp->sd_sb.sb_master_dir.no_addr,
&gfs2_inode_glops, CREATE, &gl);
if (!error) {
- error = gfs2_inode_get(gl, &sdp->sd_sb.sb_master_dir, CREATE,
- &sdp->sd_master_dir);
+ error = gfs2_lookup_simple(sdp->sd_root_dir, ".gfs2_admin", &inode);
+ sdp->sd_master_dir = inode;
int gfs2_statfs_init(struct gfs2_sbd *sdp)
{
int gfs2_statfs_init(struct gfs2_sbd *sdp)
{
- struct gfs2_inode *m_ip = sdp->sd_statfs_inode;
+ struct gfs2_inode *m_ip = get_v2ip(sdp->sd_statfs_inode);
struct gfs2_statfs_change *m_sc = &sdp->sd_statfs_master;
struct gfs2_statfs_change *m_sc = &sdp->sd_statfs_master;
- struct gfs2_inode *l_ip = sdp->sd_sc_inode;
+ struct gfs2_inode *l_ip = get_v2ip(sdp->sd_sc_inode);
struct gfs2_statfs_change *l_sc = &sdp->sd_statfs_local;
struct buffer_head *m_bh, *l_bh;
struct gfs2_holder gh;
struct gfs2_statfs_change *l_sc = &sdp->sd_statfs_local;
struct buffer_head *m_bh, *l_bh;
struct gfs2_holder gh;
void gfs2_statfs_change(struct gfs2_sbd *sdp, int64_t total, int64_t free,
int64_t dinodes)
{
void gfs2_statfs_change(struct gfs2_sbd *sdp, int64_t total, int64_t free,
int64_t dinodes)
{
- struct gfs2_inode *l_ip = sdp->sd_sc_inode;
+ struct gfs2_inode *l_ip = get_v2ip(sdp->sd_sc_inode);
struct gfs2_statfs_change *l_sc = &sdp->sd_statfs_local;
struct buffer_head *l_bh;
int error;
struct gfs2_statfs_change *l_sc = &sdp->sd_statfs_local;
struct buffer_head *l_bh;
int error;
int gfs2_statfs_sync(struct gfs2_sbd *sdp)
{
int gfs2_statfs_sync(struct gfs2_sbd *sdp)
{
- struct gfs2_inode *m_ip = sdp->sd_statfs_inode;
- struct gfs2_inode *l_ip = sdp->sd_sc_inode;
+ struct gfs2_inode *m_ip = get_v2ip(sdp->sd_statfs_inode);
+ struct gfs2_inode *l_ip = get_v2ip(sdp->sd_sc_inode);
struct gfs2_statfs_change *m_sc = &sdp->sd_statfs_master;
struct gfs2_statfs_change *l_sc = &sdp->sd_statfs_local;
struct gfs2_holder gh;
struct gfs2_statfs_change *m_sc = &sdp->sd_statfs_master;
struct gfs2_statfs_change *l_sc = &sdp->sd_statfs_local;
struct gfs2_holder gh;
static int munge_ondisk(struct gfs2_sbd *sdp, unsigned int slot,
struct gfs2_unlinked_tag *ut)
{
static int munge_ondisk(struct gfs2_sbd *sdp, unsigned int slot,
struct gfs2_unlinked_tag *ut)
{
- struct gfs2_inode *ip = sdp->sd_ut_inode;
+ struct gfs2_inode *ip = get_v2ip(sdp->sd_ut_inode);
unsigned int block, offset;
uint64_t dblock;
int new = 0;
unsigned int block, offset;
uint64_t dblock;
int new = 0;
int gfs2_unlinked_init(struct gfs2_sbd *sdp)
{
int gfs2_unlinked_init(struct gfs2_sbd *sdp)
{
- struct gfs2_inode *ip = sdp->sd_ut_inode;
+ struct gfs2_inode *ip = get_v2ip(sdp->sd_ut_inode);
unsigned int blocks = ip->i_di.di_size >> sdp->sd_sb.sb_bsize_shift;
unsigned int x, slot = 0;
unsigned int found = 0;
unsigned int blocks = ip->i_di.di_size >> sdp->sd_sb.sb_bsize_shift;
unsigned int x, slot = 0;
unsigned int found = 0;