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

[GFS2] Use vmalloc() in dir code



When allocating memory to sort directory entries, use vmalloc()
rather than kmalloc() since for larger directories, the required
size can easily be graeter than the 128k maximum of kmalloc().

Also adding the first steps towards getting the AOP_TRUNCATED_PAGE
return code get in the glock code by flagging all places where we
request a glock and we are holding a page lock.

Signed-off-by: default avatarSteven Whitehouse <swhiteho@redhat.com>
parent 4d8012b6
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -61,6 +61,7 @@
#include <linux/sort.h>
#include <linux/gfs2_ondisk.h>
#include <linux/crc32.h>
#include <linux/vmalloc.h>
#include <asm/semaphore.h>

#include "gfs2.h"
@@ -1290,7 +1291,7 @@ static int gfs2_dir_read_leaf(struct inode *inode, u64 *offset, void *opaque,
		return 0;

	error = -ENOMEM;
	larr = kmalloc((leaves + entries) * sizeof(void*), GFP_KERNEL);
	larr = vmalloc((leaves + entries) * sizeof(void*));
	if (!larr)
		goto out;
	darr = (const struct gfs2_dirent **)(larr + leaves);
@@ -1323,7 +1324,7 @@ static int gfs2_dir_read_leaf(struct inode *inode, u64 *offset, void *opaque,
out_kfree:
	for(i = 0; i < leaf; i++)
		brelse(larr[i]);
	kfree(larr);
	vfree(larr);
out:
	return error;
}
+3 −0
Original line number Diff line number Diff line
@@ -461,6 +461,9 @@ static void handle_recurse(struct gfs2_holder *gh)
	struct gfs2_holder *tmp_gh, *safe;
	int found = 0;

	printk(KERN_INFO "recursion %016llx, %u\n", gl->gl_name.ln_number,
		gl->gl_name.ln_type);

	if (gfs2_assert_warn(sdp, gh->gh_owner))
		return;

+1 −0
Original line number Diff line number Diff line
@@ -27,6 +27,7 @@
#define GL_SYNC			0x00000800
#define GL_NOCANCEL		0x00001000
#define GL_NEVER_RECURSE	0x00002000
#define GL_AOP			0x00004000

#define GLR_TRYFAILED		13
#define GLR_CANCELED		14
+1 −1
Original line number Diff line number Diff line
@@ -156,7 +156,7 @@ struct gfs2_holder {
	struct gfs2_glock *gh_gl;
	struct task_struct *gh_owner;
	unsigned int gh_state;
	int gh_flags;
	unsigned gh_flags;

	int gh_error;
	unsigned long gh_iflags;
+1 −1
Original line number Diff line number Diff line
@@ -881,7 +881,7 @@ void gfs2_meta_syncfs(struct gfs2_sbd *sdp)
		gfs2_ail1_start(sdp, DIO_ALL);
		if (gfs2_ail1_empty(sdp, DIO_ALL))
			break;
		msleep(100);
		msleep(10);
	}
}
Loading