Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp733604rwb; Wed, 9 Nov 2022 08:04:04 -0800 (PST) X-Google-Smtp-Source: AMsMyM4J4DGJ5uG6rn50R8ye3sYzqeBnTwjJJuEsZcjDXHMh8Rfcu/9vbYXrvhYlYR6RSf8oGzfI X-Received: by 2002:a63:38e:0:b0:46f:f400:d1fd with SMTP id 136-20020a63038e000000b0046ff400d1fdmr37753311pgd.153.1668009844064; Wed, 09 Nov 2022 08:04:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668009844; cv=none; d=google.com; s=arc-20160816; b=oIoFRIfkTpfFlhKzL/VQ8D+/7zE3HKcyBfRjb3aKHV3NWAUbFV0nDmOc7Eh3VeJYOF J3slMjG+wNGcQPsC5rG6dka6ludBynOs3khtNEsGH2n6YKVty0dgyeQda3qTXB0J5NfS PsCSSczGy/+cy2U0Q54sun49wotEmnWmpn7/e6TT293997emV2L+lgqu6/+E7dGbBs+f dYGM5WyVFxu0ZfnzNhdFD18e7P9kc4NSCLppTnp5xq4UnmGPK3+nkSq5LQe3c4wMV74W l6EBnidbn82DASDRdoYa1/8d0hHAEsGDQoZr29KZYnvGxFSqjUJt4U+ajFqpEhVVRBp+ 9d8w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature :dkim-signature; bh=Mt4TWki8fvDSxvMZJOt0dqQ+aslhgxwy50UaI9c8P9o=; b=pxOuJOGJL3kZC3jOs2Dv+STRd7wxZ3BGylLbl3heRXEXlcJLgGwYVMzXe3Uxq8HAYP 2KM1UETX2NKxxkchc7vi/fiF08aCZ8N8tHtFoAykYvNIBNJ6tfdXD1DMwH+Z8x57fo56 2L2CQFKDb0ubJ2rRTbRO5De8dc5J7Hfc7aUhwRs9fgO5tXYCaLDkiuzcgodkveuzzyKW 9SFL+Jay3tVl0vzdGQST6qUYEsE+Hk7Ze54XeMzAYTRnZOcufHngQ/5Tx7FS/G0FWxyc BxXHP6+AMO1TcD74qZU+pj790HoeFKAQZSrMDReuTl6Jis7+yDYScLJo2sXKXmvlpQBs WgQw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b=PISaHOhJ; dkim=neutral (no key) header.i=@suse.cz header.b=jQHaAO7G; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id o185-20020a625ac2000000b00562f2ff1579si15599448pfb.60.2022.11.09.08.03.46; Wed, 09 Nov 2022 08:04:04 -0800 (PST) Received-SPF: pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b=PISaHOhJ; dkim=neutral (no key) header.i=@suse.cz header.b=jQHaAO7G; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229787AbiKIPuE (ORCPT + 99 others); Wed, 9 Nov 2022 10:50:04 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41520 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230221AbiKIPuD (ORCPT ); Wed, 9 Nov 2022 10:50:03 -0500 Received: from smtp-out2.suse.de (smtp-out2.suse.de [IPv6:2001:67c:2178:6::1d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BEF5415821 for ; Wed, 9 Nov 2022 07:50:01 -0800 (PST) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 76BAD1FB6E; Wed, 9 Nov 2022 15:50:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1668009000; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=Mt4TWki8fvDSxvMZJOt0dqQ+aslhgxwy50UaI9c8P9o=; b=PISaHOhJPopKgRe1dsUKo3jAJNtk6e2ZdQhpojPESxvzOh/XywNeYldp64TRm10VQM6kOX Ix1f9DaojfV2LtgLFv2cjFo0JrkiVprG6/3wQRxxZofbJPEAu9r5bAepdIKD39E+ICCC0o EvVtGJUHSDSgcaA4RRA6ubdYe17msTU= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1668009000; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=Mt4TWki8fvDSxvMZJOt0dqQ+aslhgxwy50UaI9c8P9o=; b=jQHaAO7GIQwVHWLMLp1KowI6QQph/KY30asd7WfXOZq8tnYwXYb9gNvS1CCxrVzFrp6pRR S5tKTotS3txkmxBQ== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 68A351331F; Wed, 9 Nov 2022 15:50:00 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id aPd8GSjMa2PhWQAAMHmgww (envelope-from ); Wed, 09 Nov 2022 15:50:00 +0000 Received: by quack3.suse.cz (Postfix, from userid 1000) id EC180A0704; Wed, 9 Nov 2022 16:49:59 +0100 (CET) Date: Wed, 9 Nov 2022 16:49:59 +0100 From: Jan Kara To: JunChao Sun Cc: linux-ext4@vger.kernel.org, tytso@mit.edu, adilger.kernel@dilger.ca, jack@suse.cz Subject: Re: [PATCH] ext4: replace kmem_cache_create with KMEM_CACHE Message-ID: <20221109154959.r7at3nrsq6ydaypg@quack3> References: <20221109153822.80250-1-sunjunchao2870@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20221109153822.80250-1-sunjunchao2870@gmail.com> X-Spam-Status: No, score=-3.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_SOFTFAIL autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org On Wed 09-11-22 07:38:22, JunChao Sun wrote: > Replace kmem_cache_create with KMEM_CACHE macro that > guaranteed struct alignment > > Signed-off-by: JunChao Sun Yeah, nice cleanups. Feel free to add: Reviewed-by: Jan Kara Honza > --- > fs/ext4/extents_status.c | 8 ++------ > fs/ext4/readpage.c | 5 ++--- > 2 files changed, 4 insertions(+), 9 deletions(-) > > diff --git a/fs/ext4/extents_status.c b/fs/ext4/extents_status.c > index cd0a861853e3..97eccc0028a1 100644 > --- a/fs/ext4/extents_status.c > +++ b/fs/ext4/extents_status.c > @@ -155,9 +155,7 @@ static void __revise_pending(struct inode *inode, ext4_lblk_t lblk, > > int __init ext4_init_es(void) > { > - ext4_es_cachep = kmem_cache_create("ext4_extent_status", > - sizeof(struct extent_status), > - 0, (SLAB_RECLAIM_ACCOUNT), NULL); > + ext4_es_cachep = KMEM_CACHE(extent_status, SLAB_RECLAIM_ACCOUNT); > if (ext4_es_cachep == NULL) > return -ENOMEM; > return 0; > @@ -1807,9 +1805,7 @@ static void ext4_print_pending_tree(struct inode *inode) > > int __init ext4_init_pending(void) > { > - ext4_pending_cachep = kmem_cache_create("ext4_pending_reservation", > - sizeof(struct pending_reservation), > - 0, (SLAB_RECLAIM_ACCOUNT), NULL); > + ext4_pending_cachep = KMEM_CACHE(pending_reservation, SLAB_RECLAIM_ACCOUNT); > if (ext4_pending_cachep == NULL) > return -ENOMEM; > return 0; > diff --git a/fs/ext4/readpage.c b/fs/ext4/readpage.c > index 3d21eae267fc..773176e7f9f5 100644 > --- a/fs/ext4/readpage.c > +++ b/fs/ext4/readpage.c > @@ -410,9 +410,8 @@ int ext4_mpage_readpages(struct inode *inode, > > int __init ext4_init_post_read_processing(void) > { > - bio_post_read_ctx_cache = > - kmem_cache_create("ext4_bio_post_read_ctx", > - sizeof(struct bio_post_read_ctx), 0, 0, NULL); > + bio_post_read_ctx_cache = KMEM_CACHE(bio_post_read_ctx, SLAB_RECLAIM_ACCOUNT); > + > if (!bio_post_read_ctx_cache) > goto fail; > bio_post_read_ctx_pool = > -- > 2.17.1 > -- Jan Kara SUSE Labs, CR