Commit 568f4c96 authored by Steven Whitehouse's avatar Steven Whitehouse
Browse files

[GFS2] 80 Column audit of GFS2



Requested by:
Prarit Bhargava <prarit@redhat.com>

Signed-off-by: default avatarSteven Whitehouse <swhiteho@redhat.com>
parent 3a8fe9be
Loading
Loading
Loading
Loading
+7 −3
Original line number Diff line number Diff line
@@ -129,7 +129,8 @@ int gfs2_unstuff_dinode(struct gfs2_inode *ip, gfs2_unstuffer_t unstuffer,
	gfs2_buffer_clear_tail(dibh, sizeof(struct gfs2_dinode));

	if (ip->i_di.di_size) {
		*(uint64_t *)(dibh->b_data + sizeof(struct gfs2_dinode)) = cpu_to_be64(block);
		*(uint64_t *)(dibh->b_data + sizeof(struct gfs2_dinode)) =
			cpu_to_be64(block);
		ip->i_di.di_blocks++;
	}

@@ -241,7 +242,9 @@ static int build_height(struct gfs2_inode *ip, int height)
		gfs2_buffer_clear_tail(dibh, sizeof(struct gfs2_dinode));

		if (new_block) {
			*(uint64_t *)(dibh->b_data + sizeof(struct gfs2_dinode)) = cpu_to_be64(block);
			*(uint64_t *)(dibh->b_data +
				      sizeof(struct gfs2_dinode)) =
				      cpu_to_be64(block);
			ip->i_di.di_blocks++;
		}

@@ -313,7 +316,8 @@ static int build_height(struct gfs2_inode *ip, int height)
 *
 */

static void find_metapath(struct gfs2_inode *ip, uint64_t block, struct metapath *mp)
static void find_metapath(struct gfs2_inode *ip, uint64_t block,
			  struct metapath *mp)
{
	struct gfs2_sbd *sdp = ip->i_sbd;
	uint64_t b = block;
+20 −10
Original line number Diff line number Diff line
@@ -98,7 +98,8 @@ int gfs2_dir_get_buffer(struct gfs2_inode *ip, uint64_t block, int new,
		gfs2_metatype_set(bh, GFS2_METATYPE_JD, GFS2_FORMAT_JD);
		gfs2_buffer_clear_tail(bh, sizeof(struct gfs2_meta_header));
	} else {
		error = gfs2_meta_read(ip->i_gl, block, DIO_START | DIO_WAIT, &bh);
		error = gfs2_meta_read(ip->i_gl, block, DIO_START | DIO_WAIT,
				       &bh);
		if (error)
			return error;
		if (gfs2_metatype_check(ip->i_sbd, bh, GFS2_METATYPE_JD)) {
@@ -163,7 +164,8 @@ static int gfs2_dir_write_data(struct gfs2_inode *ip, const char *buf,

	if (gfs2_is_stuffed(ip) &&
	    offset + size <= sdp->sd_sb.sb_bsize - sizeof(struct gfs2_dinode))
		return gfs2_dir_write_stuffed(ip, buf, (unsigned int)offset, size);
		return gfs2_dir_write_stuffed(ip, buf, (unsigned int)offset,
					      size);

	if (gfs2_assert_warn(sdp, gfs2_is_jdata(ip)))
		return -EINVAL;
@@ -188,7 +190,8 @@ static int gfs2_dir_write_data(struct gfs2_inode *ip, const char *buf,

		if (!extlen) {
			new = 1;
			error = gfs2_block_map(ip, lblock, &new, &dblock, &extlen);
			error = gfs2_block_map(ip, lblock, &new, &dblock,
					       &extlen);
			if (error)
				goto fail;
			error = -EIO;
@@ -196,7 +199,9 @@ static int gfs2_dir_write_data(struct gfs2_inode *ip, const char *buf,
				goto fail;
		}

		error = gfs2_dir_get_buffer(ip, dblock, (amount == sdp->sd_jbsize) ? 1 : new, &bh);
		error = gfs2_dir_get_buffer(ip, dblock,
					    (amount == sdp->sd_jbsize) ?
					    1 : new, &bh);
		if (error)
			goto fail;

@@ -280,7 +285,8 @@ static int gfs2_dir_read_data(struct gfs2_inode *ip, char *buf,
		return 0;

	if (gfs2_is_stuffed(ip))
		return gfs2_dir_read_stuffed(ip, buf, (unsigned int)offset, size);
		return gfs2_dir_read_stuffed(ip, buf, (unsigned int)offset,
					     size);

	if (gfs2_assert_warn(sdp, gfs2_is_jdata(ip)))
		return -EINVAL;
@@ -299,7 +305,8 @@ static int gfs2_dir_read_data(struct gfs2_inode *ip, char *buf,

		if (!extlen) {
			new = 0;
			error = gfs2_block_map(ip, lblock, &new, &dblock, &extlen);
			error = gfs2_block_map(ip, lblock, &new, &dblock,
					       &extlen);
			if (error)
				goto fail;
		}
@@ -541,10 +548,12 @@ int gfs2_dirent_alloc(struct gfs2_inode *dip, struct buffer_head *bh,
					    GFS2_DIRENT_SIZE(cur_name_len));
				memset(new, 0, sizeof(struct gfs2_dirent));

				new->de_rec_len = cpu_to_be16(cur_rec_len - GFS2_DIRENT_SIZE(cur_name_len));
				new->de_rec_len = cpu_to_be16(cur_rec_len -
						GFS2_DIRENT_SIZE(cur_name_len));
				new->de_name_len = cpu_to_be16(name_len);

				dent->de_rec_len = cpu_to_be16(cur_rec_len - be16_to_cpu(new->de_rec_len));
				dent->de_rec_len = cpu_to_be16(cur_rec_len -
						be16_to_cpu(new->de_rec_len));

				*dent_out = new;
				return 0;
@@ -2281,7 +2290,8 @@ int gfs2_dir_exhash_dealloc(struct gfs2_inode *dip)
	error = gfs2_meta_inode_buffer(dip, &bh);
	if (!error) {
		gfs2_trans_add_bh(dip->i_gl, bh, 1);
		((struct gfs2_dinode *)bh->b_data)->di_mode = cpu_to_be32(S_IFREG);
		((struct gfs2_dinode *)bh->b_data)->di_mode =
						cpu_to_be32(S_IFREG);
		brelse(bh);
	}

+2 −2
Original line number Diff line number Diff line
@@ -354,7 +354,6 @@ static int ea_remove_unstuffed(struct gfs2_inode *ip, struct buffer_head *bh,
	return error;
}

/******************************************************************************/

static int gfs2_ea_repack_i(struct gfs2_inode *ip)
{
@@ -819,7 +818,8 @@ static int ea_init(struct gfs2_inode *ip, struct gfs2_ea_request *er)
static struct gfs2_ea_header *ea_split_ea(struct gfs2_ea_header *ea)
{
	uint32_t ea_size = GFS2_EA_SIZE(ea);
	struct gfs2_ea_header *new = (struct gfs2_ea_header *)((char *)ea + ea_size);
	struct gfs2_ea_header *new = (struct gfs2_ea_header *)((char *)ea +
				     ea_size);
	uint32_t new_size = GFS2_EA_REC_LEN(ea) - ea_size;
	int last = ea->ea_flags & GFS2_EAFLAG_LAST;

+6 −3
Original line number Diff line number Diff line
@@ -1034,8 +1034,10 @@ static void init_dinode(struct gfs2_inode *dip, struct gfs2_glock *gl,
		    gfs2_tune_get(sdp, gt_new_files_directio))
			di->di_flags |= cpu_to_be32(GFS2_DIF_DIRECTIO);
	} else if (S_ISDIR(mode)) {
		di->di_flags |= cpu_to_be32(dip->i_di.di_flags & GFS2_DIF_INHERIT_DIRECTIO);
		di->di_flags |= cpu_to_be32(dip->i_di.di_flags & GFS2_DIF_INHERIT_JDATA);
		di->di_flags |= cpu_to_be32(dip->i_di.di_flags &
					    GFS2_DIF_INHERIT_DIRECTIO);
		di->di_flags |= cpu_to_be32(dip->i_di.di_flags &
					    GFS2_DIF_INHERIT_JDATA);
	}

	di->__pad1 = 0;
@@ -1188,7 +1190,8 @@ static int link_dinode(struct gfs2_inode *dip, struct qstr *name,
 * Returns: An inode
 */

struct inode *gfs2_createi(struct gfs2_holder *ghs, struct qstr *name, unsigned int mode)
struct inode *gfs2_createi(struct gfs2_holder *ghs, struct qstr *name,
			   unsigned int mode)
{
	struct inode *inode;
	struct gfs2_inode *dip = get_gl2ip(ghs->gh_gl);
+2 −1
Original line number Diff line number Diff line
@@ -46,7 +46,8 @@ int gfs2_inode_dealloc(struct gfs2_sbd *sdp, struct gfs2_unlinked *ul);
int gfs2_change_nlink(struct gfs2_inode *ip, int diff);
int gfs2_lookupi(struct inode *dir, struct qstr *name, int is_root,
		 struct inode **ipp);
struct inode *gfs2_createi(struct gfs2_holder *ghs, struct qstr *name, unsigned int mode);
struct inode *gfs2_createi(struct gfs2_holder *ghs, struct qstr *name,
			   unsigned int mode);
int gfs2_unlinki(struct gfs2_inode *dip, struct qstr *name,
		 struct gfs2_inode *ip, struct gfs2_unlinked *ul);
int gfs2_rmdiri(struct gfs2_inode *dip, struct qstr *name,
Loading