Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f42faf4f authored by Steven Whitehouse's avatar Steven Whitehouse
Browse files

[GFS2] Add gfs2_internal_read()



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: default avatarSteven Whitehouse <swhiteho@redhat.com>
parent fd2ee6bb
Loading
Loading
Loading
Loading
+17 −12
Original line number Diff line number Diff line
@@ -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;
+5 −5
Original line number Diff line number Diff line
@@ -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;
		}
+12 −3
Original line number Diff line number Diff line
@@ -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__ */
+7 −0
Original line number Diff line number Diff line
@@ -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)
{
+1 −1
Original line number Diff line number Diff line
@@ -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);
Loading