From: Sean Fu <fxinrong@gmail.com>
To: darrick.wong@oracle.com
Cc: linux-xfs@vger.kernel.org, linux-kernel@vger.kernel.org,
Sean Fu <fxinrong@gmail.com>
Subject: [PATCH] xfs: Use kmem_zalloc for bp->b_pages.
Date: Sat, 9 Mar 2019 23:36:36 +0800 [thread overview]
Message-ID: <20190309153636.14154-1-fxinrong@gmail.com> (raw)
Change the allocation of bp->b_pages to use kmem_zalloc instead of
kmem_alloc.
Remove unnecessary memset for bp->b_pages.
This reduces text size by 42 bytes.
Before:
text data bss dec hex filename
23335 588 8 23931 5d7b ./fs/xfs/xfs_buf.o
After:
text data bss dec hex filename
23293 588 8 23889 5d51 ./fs/xfs/xfs_buf.o
Signed-off-by: Sean Fu <fxinrong@gmail.com>
---
fs/xfs/xfs_buf.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/fs/xfs/xfs_buf.c b/fs/xfs/xfs_buf.c
index 4f5f2ff3f70f..be4f740b97c1 100644
--- a/fs/xfs/xfs_buf.c
+++ b/fs/xfs/xfs_buf.c
@@ -289,12 +289,11 @@ _xfs_buf_get_pages(
if (page_count <= XB_PAGES) {
bp->b_pages = bp->b_page_array;
} else {
- bp->b_pages = kmem_alloc(sizeof(struct page *) *
+ bp->b_pages = kmem_zalloc(sizeof(struct page *) *
page_count, KM_NOFS);
if (bp->b_pages == NULL)
return -ENOMEM;
}
- memset(bp->b_pages, 0, sizeof(struct page *) * page_count);
}
return 0;
}
--
2.16.4
next reply other threads:[~2019-03-09 15:37 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-03-09 15:36 Sean Fu [this message]
2019-03-09 17:32 ` [PATCH] xfs: Use kmem_zalloc for bp->b_pages Darrick J. Wong
2019-03-10 5:07 ` Sean Fu
2019-03-10 21:53 ` Dave Chinner
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=20190309153636.14154-1-fxinrong@gmail.com \
--to=fxinrong@gmail.com \
--cc=darrick.wong@oracle.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-xfs@vger.kernel.org \
/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;
as well as URLs for NNTP newsgroup(s).