From fcf10d38afd2d39d08bf76c48ff9c12345770678 Mon Sep 17 00:00:00 2001 From: Fabian Frederick Date: Wed, 26 Feb 2014 19:07:56 +0100 Subject: GFS2: replace kmalloc - __vmalloc / memset 0 Use kzalloc and __vmalloc __GFP_ZERO for clean sd_quota_bitmap allocation. Signed-off-by: Fabian Frederick Signed-off-by: Steven Whitehouse --- fs/gfs2/quota.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'fs/gfs2/quota.c') diff --git a/fs/gfs2/quota.c b/fs/gfs2/quota.c index 8bec0e3192dd..a5cccf694e3f 100644 --- a/fs/gfs2/quota.c +++ b/fs/gfs2/quota.c @@ -1242,14 +1242,13 @@ int gfs2_quota_init(struct gfs2_sbd *sdp) bm_size = DIV_ROUND_UP(sdp->sd_quota_slots, 8 * sizeof(unsigned long)); bm_size *= sizeof(unsigned long); error = -ENOMEM; - sdp->sd_quota_bitmap = kmalloc(bm_size, GFP_NOFS|__GFP_NOWARN); + sdp->sd_quota_bitmap = kzalloc(bm_size, GFP_NOFS | __GFP_NOWARN); if (sdp->sd_quota_bitmap == NULL) - sdp->sd_quota_bitmap = __vmalloc(bm_size, GFP_NOFS, PAGE_KERNEL); + sdp->sd_quota_bitmap = __vmalloc(bm_size, GFP_NOFS | + __GFP_ZERO, PAGE_KERNEL); if (!sdp->sd_quota_bitmap) return error; - memset(sdp->sd_quota_bitmap, 0, bm_size); - for (x = 0; x < blocks; x++) { struct buffer_head *bh; const struct gfs2_quota_change *qc; -- cgit v1.2.3 From fc554ed3d89d220b9d0c020e19aa52fb6bf1d673 Mon Sep 17 00:00:00 2001 From: Fabian Frederick Date: Wed, 5 Mar 2014 22:06:42 +0800 Subject: GFS2: global conversion to pr_foo() -All printk(KERN_foo converted to pr_foo(). -Messages updated to fit in 80 columns. -fs_macros converted as well. -fs_printk removed. Signed-off-by: Fabian Frederick Signed-off-by: Steven Whitehouse --- fs/gfs2/quota.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'fs/gfs2/quota.c') diff --git a/fs/gfs2/quota.c b/fs/gfs2/quota.c index a5cccf694e3f..6e25ee490e3b 100644 --- a/fs/gfs2/quota.c +++ b/fs/gfs2/quota.c @@ -1081,7 +1081,7 @@ static int print_message(struct gfs2_quota_data *qd, char *type) { struct gfs2_sbd *sdp = qd->qd_gl->gl_sbd; - printk(KERN_INFO "GFS2: fsid=%s: quota %s for %s %u\n", + pr_info("GFS2: fsid=%s: quota %s for %s %u\n", sdp->sd_fsname, type, (qd->qd_id.type == USRQUOTA) ? "user" : "group", from_kqid(&init_user_ns, qd->qd_id)); -- cgit v1.2.3 From d77d1b58aaf4456946b8502c67f16b52fda60303 Mon Sep 17 00:00:00 2001 From: Joe Perches Date: Thu, 6 Mar 2014 12:10:45 -0800 Subject: GFS2: Use pr_ more consistently Add pr_fmt, remove embedded "GFS2: " prefixes. This now consistently emits lower case "gfs2: " for each message. Other miscellanea around these changes: o Add missing newlines o Coalesce formats o Realign arguments Signed-off-by: Joe Perches Signed-off-by: Steven Whitehouse --- fs/gfs2/quota.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'fs/gfs2/quota.c') diff --git a/fs/gfs2/quota.c b/fs/gfs2/quota.c index 6e25ee490e3b..73ed92535c8a 100644 --- a/fs/gfs2/quota.c +++ b/fs/gfs2/quota.c @@ -36,6 +36,8 @@ * the quota file, so it is not being constantly read. */ +#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt + #include #include #include @@ -1081,10 +1083,10 @@ static int print_message(struct gfs2_quota_data *qd, char *type) { struct gfs2_sbd *sdp = qd->qd_gl->gl_sbd; - pr_info("GFS2: fsid=%s: quota %s for %s %u\n", - sdp->sd_fsname, type, - (qd->qd_id.type == USRQUOTA) ? "user" : "group", - from_kqid(&init_user_ns, qd->qd_id)); + pr_info("fsid=%s: quota %s for %s %u\n", + sdp->sd_fsname, type, + (qd->qd_id.type == USRQUOTA) ? "user" : "group", + from_kqid(&init_user_ns, qd->qd_id)); return 0; } -- cgit v1.2.3 From 8382e26b2c8ba3c4be552d887eed1969dc1a95b8 Mon Sep 17 00:00:00 2001 From: Joe Perches Date: Thu, 6 Mar 2014 12:10:46 -0800 Subject: GFS2: Use fs_ more often Convert a couple of uses of pr_ to fs_ Add and use fs_emerg. Signed-off-by: Joe Perches Signed-off-by: Steven Whitehouse --- fs/gfs2/quota.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'fs/gfs2/quota.c') diff --git a/fs/gfs2/quota.c b/fs/gfs2/quota.c index 73ed92535c8a..27f9435ddd20 100644 --- a/fs/gfs2/quota.c +++ b/fs/gfs2/quota.c @@ -1083,8 +1083,8 @@ static int print_message(struct gfs2_quota_data *qd, char *type) { struct gfs2_sbd *sdp = qd->qd_gl->gl_sbd; - pr_info("fsid=%s: quota %s for %s %u\n", - sdp->sd_fsname, type, + fs_info(sdp, "quota %s for %s %u\n", + type, (qd->qd_id.type == USRQUOTA) ? "user" : "group", from_kqid(&init_user_ns, qd->qd_id)); -- cgit v1.2.3 From e9fb7c73a43e0551e689b7024f1581af5fa36a03 Mon Sep 17 00:00:00 2001 From: Abhi Das Date: Mon, 31 Mar 2014 01:19:29 -0500 Subject: GFS2: Fix return value in slot_get() ENOSPC was being returned in slot_get inspite of successful execution of the function. This patch fixes this return code. Signed-off-by: Abhi Das Signed-off-by: Steven Whitehouse --- fs/gfs2/quota.c | 1 + 1 file changed, 1 insertion(+) (limited to 'fs/gfs2/quota.c') diff --git a/fs/gfs2/quota.c b/fs/gfs2/quota.c index 27f9435ddd20..c4effff7cf55 100644 --- a/fs/gfs2/quota.c +++ b/fs/gfs2/quota.c @@ -332,6 +332,7 @@ static int slot_get(struct gfs2_quota_data *qd) if (bit < sdp->sd_quota_slots) { set_bit(bit, sdp->sd_quota_bitmap); qd->qd_slot = bit; + error = 0; out: qd->qd_slot_count++; } -- cgit v1.2.3