diff options
author | Steven Whitehouse <swhiteho@redhat.com> | 2012-06-11 14:49:47 +0200 |
---|---|---|
committer | Steven Whitehouse <swhiteho@redhat.com> | 2012-06-11 14:49:47 +0200 |
commit | 0fe2f1e929ecabf834f4af2ffd300fe70700f4b3 (patch) | |
tree | 4f885ec0bc860bef382f50b4261c01a1d589efda /fs/gfs2/glock.c | |
parent | GFS2: Use seq_vprintf for glocks debugfs file (diff) | |
download | linux-0fe2f1e929ecabf834f4af2ffd300fe70700f4b3.tar.xz linux-0fe2f1e929ecabf834f4af2ffd300fe70700f4b3.zip |
GFS2: Size seq_file buffer more carefully
This places a limit on the buffer size for archs with larger
PAGE_SIZE.
Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
Reported-by: Eric Dumazet <eric.dumazet@gmail.com>
Diffstat (limited to 'fs/gfs2/glock.c')
-rw-r--r-- | fs/gfs2/glock.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/fs/gfs2/glock.c b/fs/gfs2/glock.c index 4d5d63d9d2c0..1ed81f40da0d 100644 --- a/fs/gfs2/glock.c +++ b/fs/gfs2/glock.c @@ -1977,6 +1977,8 @@ static const struct seq_operations gfs2_sbstats_seq_ops = { .show = gfs2_sbstats_seq_show, }; +#define GFS2_SEQ_GOODSIZE min(PAGE_SIZE << PAGE_ALLOC_COSTLY_ORDER, 65536UL) + static int gfs2_glocks_open(struct inode *inode, struct file *file) { int ret = seq_open_private(file, &gfs2_glock_seq_ops, @@ -1985,9 +1987,9 @@ static int gfs2_glocks_open(struct inode *inode, struct file *file) struct seq_file *seq = file->private_data; struct gfs2_glock_iter *gi = seq->private; gi->sdp = inode->i_private; - seq->buf = kmalloc(8*PAGE_SIZE, GFP_KERNEL | __GFP_NOWARN); + seq->buf = kmalloc(GFS2_SEQ_GOODSIZE, GFP_KERNEL | __GFP_NOWARN); if (seq->buf) - seq->size = 8*PAGE_SIZE; + seq->size = GFS2_SEQ_GOODSIZE; } return ret; } @@ -2000,9 +2002,9 @@ static int gfs2_glstats_open(struct inode *inode, struct file *file) struct seq_file *seq = file->private_data; struct gfs2_glock_iter *gi = seq->private; gi->sdp = inode->i_private; - seq->buf = kmalloc(8*PAGE_SIZE, GFP_KERNEL | __GFP_NOWARN); + seq->buf = kmalloc(GFS2_SEQ_GOODSIZE, GFP_KERNEL | __GFP_NOWARN); if (seq->buf) - seq->size = 8*PAGE_SIZE; + seq->size = GFS2_SEQ_GOODSIZE; } return ret; } |