diff options
author | Miaohe Lin <linmiaohe@huawei.com> | 2021-02-24 12:09:22 -0800 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2021-02-24 13:38:34 -0800 |
commit | c457cd96f18c7137287700c409d2ae16c6395256 (patch) | |
tree | 74773ceb5fb7d8d599ff97aa9bd2bb89bd2d2881 /mm/z3fold.c | |
parent | 70ad3196a68b0857b49811da7a94ad4f5a8e75bb (diff) | |
download | lwn-c457cd96f18c7137287700c409d2ae16c6395256.tar.gz lwn-c457cd96f18c7137287700c409d2ae16c6395256.zip |
z3fold: simplify the zhdr initialization code in init_z3fold_page()
We can simplify the zhdr initialization by memset() the zhdr first
instead of set struct member to zero one by one. This would also make
code more compact and clear.
Link: https://lkml.kernel.org/r/20210120085851.16159-1-linmiaohe@huawei.com
Signed-off-by: Miaohe Lin <linmiaohe@huawei.com>
Cc: Vitaly Wool <vitaly.wool@konsulko.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'mm/z3fold.c')
-rw-r--r-- | mm/z3fold.c | 8 |
1 files changed, 1 insertions, 7 deletions
diff --git a/mm/z3fold.c b/mm/z3fold.c index 8e53cdf4d190..c1ccf6bb0ffb 100644 --- a/mm/z3fold.c +++ b/mm/z3fold.c @@ -413,16 +413,10 @@ static struct z3fold_header *init_z3fold_page(struct page *page, bool headless, if (!slots) return NULL; + memset(zhdr, 0, sizeof(*zhdr)); spin_lock_init(&zhdr->page_lock); kref_init(&zhdr->refcount); - zhdr->first_chunks = 0; - zhdr->middle_chunks = 0; - zhdr->last_chunks = 0; - zhdr->first_num = 0; - zhdr->start_middle = 0; zhdr->cpu = -1; - zhdr->foreign_handles = 0; - zhdr->mapped_count = 0; zhdr->slots = slots; zhdr->pool = pool; INIT_LIST_HEAD(&zhdr->buddy); |