aboutsummaryrefslogtreecommitdiffstats
path: root/fs/gfs2
diff options
context:
space:
mode:
authorSteven Whitehouse <swhiteho@redhat.com>2006-04-18 10:09:15 -0400
committerSteven Whitehouse <swhiteho@redhat.com>2006-04-18 10:09:15 -0400
commitfe1bdedc6c16adedc6fd3636185ea91596b1d6eb (patch)
tree4d68a40c1a2db670e71952003e5fb09a95123975 /fs/gfs2
parent4d8012b60e0f0e0217e65f67da7d97276d1824e9 (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')
-rw-r--r--fs/gfs2/dir.c5
-rw-r--r--fs/gfs2/glock.c3
-rw-r--r--fs/gfs2/glock.h1
-rw-r--r--fs/gfs2/incore.h2
-rw-r--r--fs/gfs2/meta_io.c2
-rw-r--r--fs/gfs2/ops_address.c4
-rw-r--r--fs/gfs2/ops_inode.c3
-rw-r--r--fs/gfs2/ops_super.c2
8 files changed, 12 insertions, 10 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,
1323out_kfree: 1324out_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);
1327out: 1328out:
1328 return error; 1329 return error;
1329} 1330}
diff --git a/fs/gfs2/glock.c b/fs/gfs2/glock.c
index 6a1b42cf4df4..4ed13787b7ec 100644
--- a/fs/gfs2/glock.c
+++ b/fs/gfs2/glock.c
@@ -461,6 +461,9 @@ static void handle_recurse(struct gfs2_holder *gh)
461 struct gfs2_holder *tmp_gh, *safe; 461 struct gfs2_holder *tmp_gh, *safe;
462 int found = 0; 462 int found = 0;
463 463
464 printk(KERN_INFO "recursion %016llx, %u\n", gl->gl_name.ln_number,
465 gl->gl_name.ln_type);
466
464 if (gfs2_assert_warn(sdp, gh->gh_owner)) 467 if (gfs2_assert_warn(sdp, gh->gh_owner))
465 return; 468 return;
466 469
diff --git a/fs/gfs2/glock.h b/fs/gfs2/glock.h
index 560029de8d07..b6646e7fed15 100644
--- a/fs/gfs2/glock.h
+++ b/fs/gfs2/glock.h
@@ -27,6 +27,7 @@
27#define GL_SYNC 0x00000800 27#define GL_SYNC 0x00000800
28#define GL_NOCANCEL 0x00001000 28#define GL_NOCANCEL 0x00001000
29#define GL_NEVER_RECURSE 0x00002000 29#define GL_NEVER_RECURSE 0x00002000
30#define GL_AOP 0x00004000
30 31
31#define GLR_TRYFAILED 13 32#define GLR_TRYFAILED 13
32#define GLR_CANCELED 14 33#define GLR_CANCELED 14
diff --git a/fs/gfs2/incore.h b/fs/gfs2/incore.h
index dfed83b37ab7..761f00153d43 100644
--- a/fs/gfs2/incore.h
+++ b/fs/gfs2/incore.h
@@ -156,7 +156,7 @@ struct gfs2_holder {
156 struct gfs2_glock *gh_gl; 156 struct gfs2_glock *gh_gl;
157 struct task_struct *gh_owner; 157 struct task_struct *gh_owner;
158 unsigned int gh_state; 158 unsigned int gh_state;
159 int gh_flags; 159 unsigned gh_flags;
160 160
161 int gh_error; 161 int gh_error;
162 unsigned long gh_iflags; 162 unsigned long gh_iflags;
diff --git a/fs/gfs2/meta_io.c b/fs/gfs2/meta_io.c
index 4a6aacf294d5..74cf28e77b47 100644
--- a/fs/gfs2/meta_io.c
+++ b/fs/gfs2/meta_io.c
@@ -881,7 +881,7 @@ void gfs2_meta_syncfs(struct gfs2_sbd *sdp)
881 gfs2_ail1_start(sdp, DIO_ALL); 881 gfs2_ail1_start(sdp, DIO_ALL);
882 if (gfs2_ail1_empty(sdp, DIO_ALL)) 882 if (gfs2_ail1_empty(sdp, DIO_ALL))
883 break; 883 break;
884 msleep(100); 884 msleep(10);
885 } 885 }
886} 886}
887 887
diff --git a/fs/gfs2/ops_address.c b/fs/gfs2/ops_address.c
index 3fd8c6ec256c..005c2522a879 100644
--- a/fs/gfs2/ops_address.c
+++ b/fs/gfs2/ops_address.c
@@ -216,7 +216,7 @@ static int gfs2_readpage(struct file *file, struct page *page)
216 int error; 216 int error;
217 217
218 if (file != &gfs2_internal_file_sentinal) { 218 if (file != &gfs2_internal_file_sentinal) {
219 gfs2_holder_init(ip->i_gl, LM_ST_SHARED, GL_ATIME, &gh); 219 gfs2_holder_init(ip->i_gl, LM_ST_SHARED, GL_ATIME|GL_AOP, &gh);
220 error = gfs2_glock_nq_m_atime(1, &gh); 220 error = gfs2_glock_nq_m_atime(1, &gh);
221 if (error) 221 if (error)
222 goto out_unlock; 222 goto out_unlock;
@@ -267,7 +267,7 @@ static int gfs2_prepare_write(struct file *file, struct page *page,
267 loff_t end = ((loff_t)page->index << PAGE_CACHE_SHIFT) + to; 267 loff_t end = ((loff_t)page->index << PAGE_CACHE_SHIFT) + to;
268 struct gfs2_alloc *al; 268 struct gfs2_alloc *al;
269 269
270 gfs2_holder_init(ip->i_gl, LM_ST_EXCLUSIVE, GL_ATIME, &ip->i_gh); 270 gfs2_holder_init(ip->i_gl, LM_ST_EXCLUSIVE, GL_ATIME|GL_AOP, &ip->i_gh);
271 error = gfs2_glock_nq_m_atime(1, &ip->i_gh); 271 error = gfs2_glock_nq_m_atime(1, &ip->i_gh);
272 if (error) 272 if (error)
273 goto out_uninit; 273 goto out_uninit;
diff --git a/fs/gfs2/ops_inode.c b/fs/gfs2/ops_inode.c
index 1e2b709711ae..62a12a59d91b 100644
--- a/fs/gfs2/ops_inode.c
+++ b/fs/gfs2/ops_inode.c
@@ -742,8 +742,7 @@ static int gfs2_rename(struct inode *odir, struct dentry *odentry,
742 if (error) 742 if (error)
743 goto out_gunlock_q; 743 goto out_gunlock_q;
744 744
745 error = gfs2_trans_begin(sdp, 745 error = gfs2_trans_begin(sdp, sdp->sd_max_dirres +
746 sdp->sd_max_dirres +
747 al->al_rgd->rd_ri.ri_length + 746 al->al_rgd->rd_ri.ri_length +
748 4 * RES_DINODE + 4 * RES_LEAF + 747 4 * RES_DINODE + 4 * RES_LEAF +
749 RES_UNLINKED + RES_STATFS + 748 RES_UNLINKED + RES_STATFS +
diff --git a/fs/gfs2/ops_super.c b/fs/gfs2/ops_super.c
index 80ce40c1dfb6..60bf2563c7b4 100644
--- a/fs/gfs2/ops_super.c
+++ b/fs/gfs2/ops_super.c
@@ -132,9 +132,7 @@ static void gfs2_put_super(struct super_block *sb)
132 /* At this point, we're through participating in the lockspace */ 132 /* At this point, we're through participating in the lockspace */
133 133
134 gfs2_sys_fs_del(sdp); 134 gfs2_sys_fs_del(sdp);
135
136 vfree(sdp); 135 vfree(sdp);
137
138 sb->s_fs_info = NULL; 136 sb->s_fs_info = NULL;
139} 137}
140 138