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

Commit 9dbe9610 authored by Steven Whitehouse's avatar Steven Whitehouse
Browse files

GFS2: Add Orlov allocator



Just like ext3, this works on the root directory and any directory
with the +T flag set. Also, just like ext3, any subdirectory created
in one of the just mentioned cases will be allocated to a random
resource group (GFS2 equivalent of a block group).

If you are creating a set of directories, each of which will contain a
job running on a different node, then by setting +T on the parent
directory before creating the subdirectories, each will land up in a
different resource group, and thus resource group contention between
nodes will be kept to a minimum.

Signed-off-by: default avatarSteven Whitehouse <swhiteho@redhat.com>
parent c9aecf73
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -643,7 +643,7 @@ static int gfs2_write_begin(struct file *file, struct address_space *mapping,
			goto out_unlock;

		requested = data_blocks + ind_blocks;
		error = gfs2_inplace_reserve(ip, requested);
		error = gfs2_inplace_reserve(ip, requested, 0);
		if (error)
			goto out_qunlock;
	}
+1 −1
Original line number Diff line number Diff line
@@ -1178,7 +1178,7 @@ static int do_grow(struct inode *inode, u64 size)
		if (error)
			return error;

		error = gfs2_inplace_reserve(ip, 1);
		error = gfs2_inplace_reserve(ip, 1, 0);
		if (error)
			goto do_grow_qunlock;
		unstuff = 1;
+2 −2
Original line number Diff line number Diff line
@@ -432,7 +432,7 @@ static int gfs2_page_mkwrite(struct vm_area_struct *vma, struct vm_fault *vmf)
	if (ret)
		goto out_unlock;
	gfs2_write_calc_reserv(ip, PAGE_CACHE_SIZE, &data_blocks, &ind_blocks);
	ret = gfs2_inplace_reserve(ip, data_blocks + ind_blocks);
	ret = gfs2_inplace_reserve(ip, data_blocks + ind_blocks, 0);
	if (ret)
		goto out_quota_unlock;

@@ -825,7 +825,7 @@ static long gfs2_fallocate(struct file *file, int mode, loff_t offset,
retry:
		gfs2_write_calc_reserv(ip, bytes, &data_blocks, &ind_blocks);

		error = gfs2_inplace_reserve(ip, data_blocks + ind_blocks);
		error = gfs2_inplace_reserve(ip, data_blocks + ind_blocks, 0);
		if (error) {
			if (error == -ENOSPC && bytes > sdp->sd_sb.sb_bsize) {
				bytes >>= 1;
+11 −6
Original line number Diff line number Diff line
@@ -385,13 +385,13 @@ static void munge_mode_uid_gid(const struct gfs2_inode *dip,
		inode->i_gid = current_fsgid();
}

static int alloc_dinode(struct gfs2_inode *ip)
static int alloc_dinode(struct gfs2_inode *ip, u32 flags)
{
	struct gfs2_sbd *sdp = GFS2_SB(&ip->i_inode);
	int error;
	int dblocks = 1;

	error = gfs2_inplace_reserve(ip, RES_DINODE);
	error = gfs2_inplace_reserve(ip, RES_DINODE, flags);
	if (error)
		goto out;

@@ -560,7 +560,7 @@ static int link_dinode(struct gfs2_inode *dip, const struct qstr *name,
		if (error)
			goto fail_quota_locks;

		error = gfs2_inplace_reserve(dip, sdp->sd_max_dirres);
		error = gfs2_inplace_reserve(dip, sdp->sd_max_dirres, 0);
		if (error)
			goto fail_quota_locks;

@@ -650,6 +650,7 @@ static int gfs2_create_inode(struct inode *dir, struct dentry *dentry,
	struct gfs2_glock *io_gl;
	int error;
	struct buffer_head *bh = NULL;
	u32 aflags = 0;

	if (!name->len || name->len > GFS2_FNAMESIZE)
		return -ENAMETOOLONG;
@@ -685,7 +686,11 @@ static int gfs2_create_inode(struct inode *dir, struct dentry *dentry,
	munge_mode_uid_gid(dip, inode);
	ip->i_goal = dip->i_goal;

	error = alloc_dinode(ip);
	if ((GFS2_I(sdp->sd_root_dir->d_inode) == dip) ||
	    (dip->i_diskflags & GFS2_DIF_TOPDIR))
		aflags |= GFS2_AF_ORLOV;

	error = alloc_dinode(ip, aflags);
	if (error)
		goto fail_free_inode;

@@ -897,7 +902,7 @@ static int gfs2_link(struct dentry *old_dentry, struct inode *dir,
		if (error)
			goto out_gunlock;

		error = gfs2_inplace_reserve(dip, sdp->sd_max_dirres);
		error = gfs2_inplace_reserve(dip, sdp->sd_max_dirres, 0);
		if (error)
			goto out_gunlock_q;

@@ -1378,7 +1383,7 @@ static int gfs2_rename(struct inode *odir, struct dentry *odentry,
		if (error)
			goto out_gunlock;

		error = gfs2_inplace_reserve(ndip, sdp->sd_max_dirres);
		error = gfs2_inplace_reserve(ndip, sdp->sd_max_dirres, 0);
		if (error)
			goto out_gunlock_q;

+2 −2
Original line number Diff line number Diff line
@@ -816,7 +816,7 @@ static int do_sync(unsigned int num_qd, struct gfs2_quota_data **qda)
	blocks = num_qd * data_blocks + RES_DINODE + num_qd + 3;

	reserved = 1 + (nalloc * (data_blocks + ind_blocks));
	error = gfs2_inplace_reserve(ip, reserved);
	error = gfs2_inplace_reserve(ip, reserved, 0);
	if (error)
		goto out_alloc;

@@ -1605,7 +1605,7 @@ static int gfs2_set_dqblk(struct super_block *sb, struct kqid qid,
		gfs2_write_calc_reserv(ip, sizeof(struct gfs2_quota),
				       &data_blocks, &ind_blocks);
		blocks = 1 + data_blocks + ind_blocks;
		error = gfs2_inplace_reserve(ip, blocks);
		error = gfs2_inplace_reserve(ip, blocks, 0);
		if (error)
			goto out_i;
		blocks += gfs2_rg_blocks(ip, blocks);
Loading