mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Joe Perches <joe@perches.com>
To: Jan Harkes <jaharkes@cs.cmu.edu>,
	coda@cs.cmu.edu, Jiri Kosina <trivial@kernel.org>
Cc: Alex Elder <aelder@sgi.com>,
	xfs-masters@oss.sgi.com, codalist@TELEMANN.coda.cs.cmu.edu,
	linux-kernel@vger.kernel.org, reiserfs-devel@vger.kernel.org,
	xfs@oss.sgi.com
Subject: [TRIVIAL PATCH next 13/15] fs: Convert vmalloc/memset to vzalloc
Date: Sat, 28 May 2011 10:36:33 -0700	[thread overview]
Message-ID: <4561db676a209fff984a75ade2f552ddbfabb95b.1306603968.git.joe@perches.com> (raw)
In-Reply-To: <cover.1306603968.git.joe@perches.com>

Signed-off-by: Joe Perches <joe@perches.com>
---
 fs/coda/coda_linux.h    |    5 ++---
 fs/reiserfs/journal.c   |    9 +++------
 fs/reiserfs/resize.c    |    4 +---
 fs/xfs/linux-2.6/kmem.h |    7 +------
 4 files changed, 7 insertions(+), 18 deletions(-)

diff --git a/fs/coda/coda_linux.h b/fs/coda/coda_linux.h
index 9b0c532..7807025 100644
--- a/fs/coda/coda_linux.h
+++ b/fs/coda/coda_linux.h
@@ -59,12 +59,11 @@ void coda_sysctl_clean(void);
 
 #define CODA_ALLOC(ptr, cast, size) do { \
     if (size < PAGE_SIZE) \
-        ptr = kmalloc((unsigned long) size, GFP_KERNEL); \
+        ptr = kzalloc((unsigned long) size, GFP_KERNEL); \
     else \
-        ptr = (cast)vmalloc((unsigned long) size); \
+        ptr = (cast)vzalloc((unsigned long) size); \
     if (!ptr) \
         printk("kernel malloc returns 0 at %s:%d\n", __FILE__, __LINE__); \
-    else memset( ptr, 0, size ); \
 } while (0)
 
 
diff --git a/fs/reiserfs/journal.c b/fs/reiserfs/journal.c
index c5e82ec..40d8b0a 100644
--- a/fs/reiserfs/journal.c
+++ b/fs/reiserfs/journal.c
@@ -291,14 +291,13 @@ int reiserfs_allocate_list_bitmaps(struct super_block *sb,
 	for (i = 0; i < JOURNAL_NUM_BITMAPS; i++) {
 		jb = jb_array + i;
 		jb->journal_list = NULL;
-		jb->bitmaps = vmalloc(mem);
+		jb->bitmaps = vzalloc(mem);
 		if (!jb->bitmaps) {
 			reiserfs_warning(sb, "clm-2000", "unable to "
 					 "allocate bitmaps for journal lists");
 			failed = 1;
 			break;
 		}
-		memset(jb->bitmaps, 0, mem);
 	}
 	if (failed) {
 		free_list_bitmaps(sb, jb_array);
@@ -353,11 +352,10 @@ static struct reiserfs_journal_cnode *allocate_cnodes(int num_cnodes)
 	if (num_cnodes <= 0) {
 		return NULL;
 	}
-	head = vmalloc(num_cnodes * sizeof(struct reiserfs_journal_cnode));
+	head = vzalloc(num_cnodes * sizeof(struct reiserfs_journal_cnode));
 	if (!head) {
 		return NULL;
 	}
-	memset(head, 0, num_cnodes * sizeof(struct reiserfs_journal_cnode));
 	head[0].prev = NULL;
 	head[0].next = head + 1;
 	for (i = 1; i < num_cnodes; i++) {
@@ -2695,14 +2693,13 @@ int journal_init(struct super_block *sb, const char *j_dev_name,
 	 * dependency inversion warnings.
 	 */
 	reiserfs_write_unlock(sb);
-	journal = SB_JOURNAL(sb) = vmalloc(sizeof(struct reiserfs_journal));
+	journal = SB_JOURNAL(sb) = vzalloc(sizeof(struct reiserfs_journal));
 	if (!journal) {
 		reiserfs_warning(sb, "journal-1256",
 				 "unable to get memory for journal structure");
 		reiserfs_write_lock(sb);
 		return 1;
 	}
-	memset(journal, 0, sizeof(struct reiserfs_journal));
 	INIT_LIST_HEAD(&journal->j_bitmap_nodes);
 	INIT_LIST_HEAD(&journal->j_prealloc_list);
 	INIT_LIST_HEAD(&journal->j_working_list);
diff --git a/fs/reiserfs/resize.c b/fs/reiserfs/resize.c
index b3a94d2..cfb5196 100644
--- a/fs/reiserfs/resize.c
+++ b/fs/reiserfs/resize.c
@@ -111,15 +111,13 @@ int reiserfs_resize(struct super_block *s, unsigned long block_count_new)
 		/* allocate additional bitmap blocks, reallocate array of bitmap
 		 * block pointers */
 		bitmap =
-		    vmalloc(sizeof(struct reiserfs_bitmap_info) * bmap_nr_new);
+		    vzalloc(sizeof(struct reiserfs_bitmap_info) * bmap_nr_new);
 		if (!bitmap) {
 			/* Journal bitmaps are still supersized, but the memory isn't
 			 * leaked, so I guess it's ok */
 			printk("reiserfs_resize: unable to allocate memory.\n");
 			return -ENOMEM;
 		}
-		memset(bitmap, 0,
-		       sizeof(struct reiserfs_bitmap_info) * bmap_nr_new);
 		for (i = 0; i < bmap_nr; i++)
 			bitmap[i] = old_bitmap[i];
 
diff --git a/fs/xfs/linux-2.6/kmem.h b/fs/xfs/linux-2.6/kmem.h
index f7c8f7a..292eff1 100644
--- a/fs/xfs/linux-2.6/kmem.h
+++ b/fs/xfs/linux-2.6/kmem.h
@@ -61,12 +61,7 @@ extern void  kmem_free(const void *);
 
 static inline void *kmem_zalloc_large(size_t size)
 {
-	void *ptr;
-
-	ptr = vmalloc(size);
-	if (ptr)
-		memset(ptr, 0, size);
-	return ptr;
+	return vzalloc(size);
 }
 static inline void kmem_free_large(void *ptr)
 {
-- 
1.7.5.rc3.dirty


  parent reply	other threads:[~2011-05-28 17:38 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-05-28 17:36 [TRIVIAL PATCH next 00/15] treewide: " Joe Perches
2011-05-28 17:36 ` [TRIVIAL PATCH next 01/15] s390: " Joe Perches
2011-05-28 17:36 ` [TRIVIAL PATCH next 02/15] x86: " Joe Perches
2011-05-29 19:25   ` [tip:x86/cleanups] x86: Convert vmalloc()+memset() to vzalloc() tip-bot for Joe Perches
2011-05-28 17:36 ` [TRIVIAL PATCH next 03/15] atm: Convert vmalloc/memset to vzalloc Joe Perches
2011-05-28 17:36 ` [TRIVIAL PATCH next 04/15] drbd: " Joe Perches
2011-05-28 17:36 ` [TRIVIAL PATCH next 05/15] char: " Joe Perches
2011-05-28 17:36 ` [TRIVIAL PATCH next 06/15] isdn: " Joe Perches
2011-05-28 17:36 ` [TRIVIAL PATCH next 07/15] md: " Joe Perches
2011-05-28 17:36 ` [TRIVIAL PATCH next 08/15] media: " Joe Perches
2011-05-28 17:36 ` [TRIVIAL PATCH next 09/15] mtd: " Joe Perches
2011-06-01  8:20   ` Artem Bityutskiy
2011-05-28 17:36 ` [TRIVIAL PATCH next 10/15] scsi: " Joe Perches
2011-05-28 17:36 ` [TRIVIAL PATCH next 11/15] staging: " Joe Perches
2011-05-28 17:36 ` [TRIVIAL PATCH next 12/15] video: " Joe Perches
2011-05-28 17:48   ` Heiko Stübner
2011-05-28 18:13     ` [TRIVIAL PATCH V2 " Joe Perches
2011-05-31 14:28       ` Konrad Rzeszutek Wilk
2011-06-02  8:26       ` Paul Mundt
2011-05-30 11:40   ` [TRIVIAL PATCH " Mel Gorman
2011-05-28 17:36 ` Joe Perches [this message]
2011-05-31 18:20   ` [TRIVIAL PATCH next 13/15] fs: " Alex Elder
2011-05-28 17:36 ` [TRIVIAL PATCH next 14/15] mm: " Joe Perches
2011-05-31 19:47   ` Paul Menage
2011-05-28 17:36 ` [TRIVIAL PATCH next 15/15] net: " Joe Perches
2011-06-02 14:49   ` Pablo Neira Ayuso
2011-06-02 21:39     ` David Miller
2011-06-03  1:35       ` Joe Perches
2011-06-03  9:39       ` Pablo Neira Ayuso

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4561db676a209fff984a75ade2f552ddbfabb95b.1306603968.git.joe@perches.com \
    --to=joe@perches.com \
    --cc=aelder@sgi.com \
    --cc=coda@cs.cmu.edu \
    --cc=codalist@TELEMANN.coda.cs.cmu.edu \
    --cc=jaharkes@cs.cmu.edu \
    --cc=linux-kernel@vger.kernel.org \
    --cc=reiserfs-devel@vger.kernel.org \
    --cc=trivial@kernel.org \
    --cc=xfs-masters@oss.sgi.com \
    --cc=xfs@oss.sgi.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®