diff options
author | Steven Whitehouse <swhiteho@redhat.com> | 2006-04-18 10:09:15 -0400 |
---|---|---|
committer | Steven Whitehouse <swhiteho@redhat.com> | 2006-04-18 10:09:15 -0400 |
commit | fe1bdedc6c16adedc6fd3636185ea91596b1d6eb (patch) | |
tree | 4d68a40c1a2db670e71952003e5fb09a95123975 /fs/gfs2/dir.c | |
parent | 4d8012b60e0f0e0217e65f67da7d97276d1824e9 (diff) |
[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: Steven Whitehouse <swhiteho@redhat.com>
Diffstat (limited to 'fs/gfs2/dir.c')
-rw-r--r-- | fs/gfs2/dir.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/fs/gfs2/dir.c b/fs/gfs2/dir.c index fe6c5adc5df0..eb68cdd41d48 100644 --- a/fs/gfs2/dir.c +++ b/fs/gfs2/dir.c | |||
@@ -61,6 +61,7 @@ | |||
61 | #include <linux/sort.h> | 61 | #include <linux/sort.h> |
62 | #include <linux/gfs2_ondisk.h> | 62 | #include <linux/gfs2_ondisk.h> |
63 | #include <linux/crc32.h> | 63 | #include <linux/crc32.h> |
64 | #include <linux/vmalloc.h> | ||
64 | #include <asm/semaphore.h> | 65 | #include <asm/semaphore.h> |
65 | 66 | ||
66 | #include "gfs2.h" | 67 | #include "gfs2.h" |
@@ -1290,7 +1291,7 @@ static int gfs2_dir_read_leaf(struct inode *inode, u64 *offset, void *opaque, | |||
1290 | return 0; | 1291 | return 0; |
1291 | 1292 | ||
1292 | error = -ENOMEM; | 1293 | error = -ENOMEM; |
1293 | larr = kmalloc((leaves + entries) * sizeof(void*), GFP_KERNEL); | 1294 | larr = vmalloc((leaves + entries) * sizeof(void*)); |
1294 | if (!larr) | 1295 | if (!larr) |
1295 | goto out; | 1296 | goto out; |
1296 | darr = (const struct gfs2_dirent **)(larr + leaves); | 1297 | darr = (const struct gfs2_dirent **)(larr + leaves); |
@@ -1323,7 +1324,7 @@ static int gfs2_dir_read_leaf(struct inode *inode, u64 *offset, void *opaque, | |||
1323 | out_kfree: | 1324 | out_kfree: |
1324 | for(i = 0; i < leaf; i++) | 1325 | for(i = 0; i < leaf; i++) |
1325 | brelse(larr[i]); | 1326 | brelse(larr[i]); |
1326 | kfree(larr); | 1327 | vfree(larr); |
1327 | out: | 1328 | out: |
1328 | return error; | 1329 | return error; |
1329 | } | 1330 | } |