Skip to content

Commit

Permalink
[GFS2] Add gfs2_internal_read()
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Steven Whitehouse committed Jan 30, 2006
1 parent fd2ee6b commit f42faf4
Show file tree
Hide file tree
Showing 12 changed files with 187 additions and 149 deletions.
29 changes: 17 additions & 12 deletions fs/gfs2/incore.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;

Expand Down Expand Up @@ -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 */

Expand Down Expand Up @@ -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;
Expand Down
10 changes: 5 additions & 5 deletions fs/gfs2/inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
}
Expand Down
15 changes: 12 additions & 3 deletions fs/gfs2/inode.h
Original file line number Diff line number Diff line change
Expand Up @@ -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__ */
Expand Down
7 changes: 7 additions & 0 deletions fs/gfs2/jdata.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,13 @@
#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)
{
Expand Down
2 changes: 1 addition & 1 deletion fs/gfs2/ops_export.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
4 changes: 4 additions & 0 deletions fs/gfs2/ops_file.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@
#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;

Expand Down
Loading

0 comments on commit f42faf4

Please sign in to comment.