]> Pileus Git - ~andy/linux/commitdiff
[GFS2] Add gfs2_internal_read()
authorSteven Whitehouse <swhiteho@redhat.com>
Mon, 30 Jan 2006 18:34:10 +0000 (18:34 +0000)
committerSteven Whitehouse <swhiteho@redhat.com>
Mon, 30 Jan 2006 18:34:10 +0000 (18:34 +0000)
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:
fs/gfs2/incore.h
fs/gfs2/inode.c
fs/gfs2/inode.h
fs/gfs2/jdata.c
fs/gfs2/ops_export.c
fs/gfs2/ops_file.h
fs/gfs2/ops_fstype.c
fs/gfs2/ops_super.c
fs/gfs2/quota.c
fs/gfs2/rgrp.c
fs/gfs2/super.c
fs/gfs2/unlinked.c

index 3bc40ff5fdf95046ec5e3b9bab11ce45d249c059..d1954e2bb9084c69e262a69a31756f141625c61b 100644 (file)
@@ -98,10 +98,13 @@ struct gfs2_rgrpd {
 
 enum gfs2_state_bits {
        BH_Pinned = BH_PrivateStart,
+       BH_Escaped = BH_PrivateStart + 1,
 };
 
 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;
@@ -254,7 +257,7 @@ struct gfs2_inode {
        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;
 
@@ -511,17 +514,17 @@ struct gfs2_sbd {
 
        /* Inode Stuff */
 
-       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;
 
        /* Inum stuff */
 
@@ -615,6 +618,8 @@ struct gfs2_sbd {
        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;
index e4ba380b286a6cd91d4289280e3b5b25d14fda4d..4c193e38f8e4f02e8fff2e8bf6c78d24d149191c 100644 (file)
@@ -725,7 +725,7 @@ int gfs2_lookupi(struct gfs2_inode *dip, struct qstr *name, int is_root,
                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;
@@ -764,7 +764,7 @@ int gfs2_lookupi(struct gfs2_inode *dip, struct qstr *name, int is_root,
 
 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;
@@ -805,8 +805,8 @@ static int pick_formal_ino_1(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;
@@ -1460,7 +1460,7 @@ int gfs2_ok_to_move(struct gfs2_inode *this, struct gfs2_inode *to)
                        error = -EINVAL;
                        break;
                }
-               if (to == sdp->sd_root_dir) {
+               if (to == get_v2ip(sdp->sd_root_dir)) {
                        error = 0;
                        break;
                }
index 4df7da51f7159d98228f37a0f861bfc6cc9fe5d0..e42ae38d67781fe1be5d34538b0bb072511cd39c 100644 (file)
@@ -60,14 +60,23 @@ int gfs2_setattr_simple(struct gfs2_inode *ip, struct iattr *attr);
 
 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)
 {
+       struct gfs2_inode *ip;
        struct qstr qstr;
+       int err;
        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__ */
index 6caa93e46ce0ffa97dee6e700fc65454c2a5a6bd..e43eaf133f10e0ce9200500de568eab1e31f1afc 100644 (file)
 #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)
 {
index 0ae3a0af192d7085f1484542f6f07d28e0fd1915..335448d3be2193330efbc35a65c0b5fd99181c3c 100644 (file)
@@ -81,7 +81,7 @@ static int gfs2_encode_fh(struct dentry *dentry, __u32 *fh, int *len,
        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);
index 95123d7bbcdf41bcf0cd29ffb4f49bd0fe5b8b5e..3c237bfc143da3fe370005ff6d3b9012b855dfda 100644 (file)
 #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;
 
index c61a80c439a6d345f688a44e1297849af7ea8113..139cef8fff3a2b886e0e636e39189e9b1420a30e 100644 (file)
@@ -275,14 +275,38 @@ static int init_locking(struct gfs2_sbd *sdp, struct gfs2_holder *mount_gh,
        return error;
 }
 
+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;
+       struct inode *inode;
        int error = 0;
 
        if (undo) {
-               gfs2_inode_put(sdp->sd_master_dir);
+               iput(sdp->sd_master_dir);
                return 0;
        }
        
@@ -321,14 +345,35 @@ static int init_sb(struct gfs2_sbd *sdp, int silent, int undo)
 
        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;
+       }
 
- 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;
+out_rooti:
+       iput(sdp->sd_root_dir);
+       goto out;
 }
 
 static int init_journal(struct gfs2_sbd *sdp, int undo)
@@ -349,7 +394,7 @@ static int init_journal(struct gfs2_sbd *sdp, int undo)
                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 */
 
@@ -465,53 +510,44 @@ static int init_journal(struct gfs2_sbd *sdp, int undo)
                gfs2_glock_dq_uninit(&ji_gh);
 
  fail:
-       gfs2_inode_put(sdp->sd_jindex);
+       iput(sdp->sd_jindex);
 
        return error;
 }
 
-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)
 {
-       struct inode *inode;
-       struct dentry **dentry = &sdp->sd_vfs->s_root;
        int error = 0;
 
        if (undo)
-               goto fail_dput;
+               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);
-               return error;
+               goto fail_journal;
        }
 
+
        /* 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);
-               goto fail;
+               goto fail_inum;
        }
 
        /* Read in the resource index inode */
@@ -521,8 +557,8 @@ static int init_inodes(struct gfs2_sbd *sdp, int undo)
                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",
@@ -531,58 +567,31 @@ static int init_inodes(struct gfs2_sbd *sdp, int undo)
                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;
-       }
-
        return 0;
 
- 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:
+fail_rindex:
        gfs2_clear_rgrpd(sdp);
-       gfs2_inode_put(sdp->sd_rindex);
-
- fail_statfs:
-       gfs2_inode_put(sdp->sd_statfs_inode);
+       iput(sdp->sd_rindex);
 
- 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)
 {
-       struct gfs2_inode *pn = NULL;
+       struct inode *pn = NULL;
        char buf[30];
        int error = 0;
 
@@ -626,10 +635,10 @@ static int init_per_node(struct gfs2_sbd *sdp, int undo)
                goto fail_ut_i;
        }
 
-       gfs2_inode_put(pn);
+       iput(pn);
        pn = NULL;
 
-       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) {
@@ -637,7 +646,7 @@ static int init_per_node(struct gfs2_sbd *sdp, int undo)
                goto fail_qc_i;
        }
 
-       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) {
@@ -645,7 +654,7 @@ static int init_per_node(struct gfs2_sbd *sdp, int undo)
                goto fail_ir_gh;
        }
 
-       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) {
@@ -653,7 +662,7 @@ static int init_per_node(struct gfs2_sbd *sdp, int undo)
                goto fail_sc_gh;
        }
 
-       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) {
@@ -676,20 +685,20 @@ static int init_per_node(struct gfs2_sbd *sdp, int undo)
        gfs2_glock_dq_uninit(&sdp->sd_ir_gh);
 
  fail_qc_i:
-       gfs2_inode_put(sdp->sd_qc_inode);
+       iput(sdp->sd_qc_inode);
 
  fail_ut_i:
-       gfs2_inode_put(sdp->sd_ut_inode);
+       iput(sdp->sd_ut_inode);
 
  fail_sc_i:
-       gfs2_inode_put(sdp->sd_sc_inode);
+       iput(sdp->sd_sc_inode);
 
  fail_ir_i:
-       gfs2_inode_put(sdp->sd_ir_inode);
+       iput(sdp->sd_ir_inode);
 
  fail:
        if (pn)
-               gfs2_inode_put(pn);
+               iput(pn);
        return error;
 }
 
@@ -793,14 +802,10 @@ static int fill_super(struct super_block *sb, void *data, int silent)
        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)
-               goto fail_journals;
+               goto fail_sb;
 
        error = init_per_node(sdp, DO);
        if (error)
@@ -837,9 +842,6 @@ static int fill_super(struct super_block *sb, void *data, int silent)
  fail_inodes:
        init_inodes(sdp, UNDO);
 
- fail_journals:
-       init_journal(sdp, UNDO);
-
  fail_sb:
        init_sb(sdp, 0, UNDO);
 
index ca6a4d81bc265639b71806f3e1a55ab9cf22fa35..e06ef8dbd4d3bf58e1e412d3ea0cffd9cc629957 100644 (file)
@@ -97,13 +97,13 @@ static void gfs2_put_super(struct super_block *sb)
 
        /*  Release stuff  */
 
-       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);
@@ -115,10 +115,10 @@ static void gfs2_put_super(struct super_block *sb)
                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);
index 5fb5a5305e0e10dc5798185f1fd2634a84ea50f6..69e8f4e92e572f5e4f964cf6128497eaeaa3ec1c 100644 (file)
@@ -56,6 +56,7 @@
 #include "rgrp.h"
 #include "super.h"
 #include "trans.h"
+#include "ops_file.h"
 
 #define QUOTA_USER 1
 #define QUOTA_GROUP 0
@@ -241,7 +242,7 @@ static void slot_put(struct gfs2_quota_data *qd)
 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;
@@ -522,7 +523,7 @@ static int sort_qd(const void *a, const void *b)
 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;
 
@@ -563,12 +564,13 @@ static void do_qc(struct gfs2_quota_data *qd, int64_t change)
 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;
+       struct file_ra_state ra_state;
        struct gfs2_holder *ghs, i_gh;
        unsigned int qx, x;
        struct gfs2_quota_data *qd;
-       uint64_t offset;
+       loff_t offset;
        unsigned int nalloc = 0;
        struct gfs2_alloc *al = NULL;
        int error;
@@ -631,6 +633,7 @@ static int do_sync(unsigned int num_qd, struct gfs2_quota_data **qda)
                        goto out_gunlock;
        }
 
+       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;
@@ -642,7 +645,7 @@ static int do_sync(unsigned int num_qd, struct gfs2_quota_data **qda)
                   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;
@@ -703,8 +706,10 @@ static int do_glock(struct gfs2_quota_data *qd, int force_refresh,
        struct gfs2_holder i_gh;
        struct gfs2_quota q;
        char buf[sizeof(struct gfs2_quota)];
+       struct file_ra_state ra_state;
        int error;
 
+       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)
@@ -713,6 +718,7 @@ static int do_glock(struct gfs2_quota_data *qd, int force_refresh,
        gfs2_quota_lvb_in(&qd->qd_qb, qd->qd_gl->gl_lvb);
 
        if (force_refresh || qd->qd_qb.qb_magic != GFS2_MAGIC) {
+               loff_t pos;
                gfs2_glock_dq_uninit(q_gh);
                error = gfs2_glock_nq_init(qd->qd_gl,
                                          LM_ST_EXCLUSIVE, GL_NOCACHE,
@@ -720,16 +726,17 @@ static int do_glock(struct gfs2_quota_data *qd, int force_refresh,
                if (error)
                        return error;
 
-               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));
-
-               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;
@@ -1059,7 +1066,7 @@ int gfs2_quota_read(struct gfs2_sbd *sdp, int user, uint32_t id,
 
 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;
index 87c80bbce1cf291a15e38295b1e751aaa8348d3d..758cc565813a0aafb6fc51026e2713ee2a5badbf 100644 (file)
 #include <linux/spinlock.h>
 #include <linux/completion.h>
 #include <linux/buffer_head.h>
+#include <linux/fs.h>
 #include <asm/semaphore.h>
 
 #include "gfs2.h"
 #include "bits.h"
 #include "glock.h"
 #include "glops.h"
-#include "jdata.h"
 #include "lops.h"
 #include "meta_io.h"
 #include "quota.h"
 #include "rgrp.h"
 #include "super.h"
 #include "trans.h"
+#include "ops_file.h"
 
 /**
  * gfs2_rgrp_verify - Verify that a resource group is consistent
@@ -268,8 +269,10 @@ static int compute_bitstructs(struct gfs2_rgrpd *rgd)
 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 file_ra_state ra_state;
        uint64_t junk = ip->i_di.di_size;
        int error;
 
@@ -280,10 +283,10 @@ static int gfs2_ri_update(struct gfs2_inode *ip)
 
        clear_rgrpdi(sdp);
 
+       file_ra_state_init(&ra_state, inode->i_mapping);
        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;
@@ -350,7 +353,7 @@ static int gfs2_ri_update(struct gfs2_inode *ip)
 
 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;
 
index cab7ab5fb50641ae7aa355879f43e140a937ffe3..bae32ba0c481a35323ab8d34b2e65d0ba0740209 100644 (file)
@@ -271,7 +271,7 @@ int gfs2_do_upgrade(struct gfs2_sbd *sdp, struct gfs2_glock *sb_gl)
 
 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;
@@ -289,7 +289,7 @@ int gfs2_jindex_hold(struct gfs2_sbd *sdp, struct gfs2_holder *ji_gh)
 
                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;
@@ -437,6 +437,7 @@ int gfs2_jdesc_check(struct gfs2_jdesc *jd)
 
 int gfs2_lookup_master_dir(struct gfs2_sbd *sdp)
 {
+       struct inode *inode = NULL;
        struct gfs2_glock *gl;
        int error;
 
@@ -444,8 +445,8 @@ int gfs2_lookup_master_dir(struct gfs2_sbd *sdp)
                               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;
                gfs2_glock_put(gl);
        }
 
@@ -549,9 +550,9 @@ int gfs2_make_fs_ro(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_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;
@@ -598,7 +599,7 @@ int gfs2_statfs_init(struct gfs2_sbd *sdp)
 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;
@@ -624,8 +625,8 @@ void gfs2_statfs_change(struct gfs2_sbd *sdp, int64_t total, int64_t free,
 
 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;
index b8d836e3a5c09145f544ca82a241e315bc681126..405b91b0295d86befa9458bacb4cd5778187db3c 100644 (file)
@@ -25,7 +25,7 @@
 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;
@@ -312,7 +312,7 @@ int gfs2_unlinked_dealloc(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;