Message ID | 20221207074043.1286731-5-yebin@huaweicloud.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp32355wrr; Tue, 6 Dec 2022 23:22:36 -0800 (PST) X-Google-Smtp-Source: AA0mqf6+ow+XI/CBz+rqSfW6oVc9ZsuYd63988QlfKQKokpoMR1Q0xsKXgmLBTN7bBzpaAdXNCPo X-Received: by 2002:a17:902:c386:b0:189:fae5:e938 with SMTP id g6-20020a170902c38600b00189fae5e938mr389923plg.54.1670397756435; Tue, 06 Dec 2022 23:22:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670397756; cv=none; d=google.com; s=arc-20160816; b=GJ/LouOJKyAeRHhJT3bSkhRz0p8LUwmgTuxaP35qV5sh+k/Erdy/Iqifu9eGeMfkG5 UtBrmU7xxwImh8oq7t6KhC03ES1nsVxpxA3bJ5R12bFOTJWoyYgkJC+H6bNyhtq9J1fk qur8NbA26U8/oAuyk0cT+PRoiYQ5o4uZxpmHYKHNYEOBpAyXxuL1GoI9PE6SWrdxodD8 QvaifiKI5fCO4K9ksFuFqAn5AGzrlplJv9+su8rujqWNe+SkYG7y7v98sUSTMYHLM8TB 6qTePcHxcIo2SQ4MveiSoe9RCldWGE4BdRNRlTmhhlHta/18hePuje1P1FIoR4hVlHE7 XKxA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=ONtWTKMORvYdzAjC8+0X6rztiOCNwF3ARriV3w+NUMM=; b=lFKS59oRl1sMNfqPnJ7xamKKqdUzPKqlXLDGRnylwkM0zQ1DPM7VFhTSCnFeap5X/7 BxTw2fp07/ZsNO13lEqQoxOE3Tdrp/95lr2m/sgxDFi+9oHjqZ74iNOHrm9WcKG+iYrs iLQJ2STdtCFsWxxSg8GHHfCEAqzJasXIHuxAlAzlHnOiQBnVWCemdEtS8pr1rIfUYhvE mVDJ4O7EmPzzqc11x7YBQSonxve2i6zcT+9Nv0bHjYoGPLc5qTjgI/BKD1IR1eilT+KT rSuMuPiwd0OwwM/QcbHzEuYhyp/p/4qRn5U6GrIoKaPp68ob9P3UZispnkWJs89i1vjD BMuA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id d18-20020a056a00199200b00541c0da3083si21269107pfl.302.2022.12.06.23.22.23; Tue, 06 Dec 2022 23:22:36 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-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; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229790AbiLGHUM (ORCPT <rfc822;b08248@gmail.com> + 99 others); Wed, 7 Dec 2022 02:20:12 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50580 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229728AbiLGHT4 (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Wed, 7 Dec 2022 02:19:56 -0500 Received: from dggsgout11.his.huawei.com (unknown [45.249.212.51]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 90E333204A; Tue, 6 Dec 2022 23:19:55 -0800 (PST) Received: from mail02.huawei.com (unknown [172.30.67.153]) by dggsgout11.his.huawei.com (SkyGuard) with ESMTP id 4NRpZY6TMvz4f3k6c; Wed, 7 Dec 2022 15:19:49 +0800 (CST) Received: from huaweicloud.com (unknown [10.175.127.227]) by APP4 (Coremail) with SMTP id gCh0CgBniteWPpBj6qE0Bw--.52253S8; Wed, 07 Dec 2022 15:19:52 +0800 (CST) From: Ye Bin <yebin@huaweicloud.com> To: tytso@mit.edu, adilger.kernel@dilger.ca, linux-ext4@vger.kernel.org Cc: linux-kernel@vger.kernel.org, jack@suse.cz, Ye Bin <yebin10@huawei.com> Subject: [PATCH v2 4/6] ext4: allocate extended attribute value in vmalloc area Date: Wed, 7 Dec 2022 15:40:41 +0800 Message-Id: <20221207074043.1286731-5-yebin@huaweicloud.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20221207074043.1286731-1-yebin@huaweicloud.com> References: <20221207074043.1286731-1-yebin@huaweicloud.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-CM-TRANSID: gCh0CgBniteWPpBj6qE0Bw--.52253S8 X-Coremail-Antispam: 1UD129KBjvJXoW7ArW3JF1DJr18Kw4kZry3XFb_yoW8JFy3pa 95K340kr43Wry7urWxCF4xZ3sFg3ZrKr4UGay3Xw40vFy5Xwn2gFy5tFWYvF1UZFWxtw4v qF1Dtr18Za13t3DanT9S1TB71UUUUUUqnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDU0xBIdaVrnRJUUUvEb4IE77IF4wAFF20E14v26rWj6s0DM7CY07I20VC2zVCF04k2 6cxKx2IYs7xG6rWj6s0DM7CIcVAFz4kK6r1j6r18M28IrcIa0xkI8VA2jI8067AKxVWUAV Cq3wA2048vs2IY020Ec7CjxVAFwI0_Xr0E3s1l8cAvFVAK0II2c7xJM28CjxkF64kEwVA0 rcxSw2x7M28EF7xvwVC0I7IYx2IY67AKxVW7JVWDJwA2z4x0Y4vE2Ix0cI8IcVCY1x0267 AKxVW8Jr0_Cr1UM28EF7xvwVC2z280aVAFwI0_GcCE3s1l84ACjcxK6I8E87Iv6xkF7I0E 14v26rxl6s0DM2AIxVAIcxkEcVAq07x20xvEncxIr21l5I8CrVACY4xI64kE6c02F40Ex7 xfMcIj6xIIjxv20xvE14v26r1j6r18McIj6I8E87Iv67AKxVWUJVW8JwAm72CE4IkC6x0Y z7v_Jr0_Gr1lF7xvr2IYc2Ij64vIr41l42xK82IYc2Ij64vIr41l4I8I3I0E4IkC6x0Yz7 v_Jr0_Gr1lx2IqxVAqx4xG67AKxVWUJVWUGwC20s026x8GjcxK67AKxVWUGVWUWwC2zVAF 1VAY17CE14v26r126r1DMIIYrxkI7VAKI48JMIIF0xvE2Ix0cI8IcVAFwI0_Jr0_JF4lIx AIcVC0I7IYx2IY6xkF7I0E14v26r4j6F4UMIIF0xvE42xK8VAvwI8IcIk0rVWUJVWUCwCI 42IY6I8E87Iv67AKxVWUJVW8JwCI42IY6I8E87Iv6xkF7I0E14v26r4j6r4UJbIYCTnIWI evJa73UjIFyTuYvjxUFgAwUUUUU X-CM-SenderInfo: p1hex046kxt4xhlfz01xgou0bp/ X-CFilter-Loop: Reflected X-Spam-Status: No, score=0.3 required=5.0 tests=BAYES_00,KHOP_HELO_FCRDNS, MAY_BE_FORGED,SPF_HELO_NONE,SPF_NONE autolearn=no 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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1751538997992668129?= X-GMAIL-MSGID: =?utf-8?q?1751538997992668129?= |
Series |
Fix two issue about ext4 extended attribute
|
|
Commit Message
Ye Bin
Dec. 7, 2022, 7:40 a.m. UTC
From: Ye Bin <yebin10@huawei.com> Now, extended attribute value maxium length is 64K. The memory requested here does not need continuous physical addresses, so it is appropriate to use kvmalloc to request memory. At the same time, it can also cope with the situation that the extended attribute will become longer in the future. Signed-off-by: Ye Bin <yebin10@huawei.com> --- fs/ext4/xattr.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
Comments
On Wed 07-12-22 15:40:41, Ye Bin wrote: > From: Ye Bin <yebin10@huawei.com> > > Now, extended attribute value maxium length is 64K. The memory requested here > does not need continuous physical addresses, so it is appropriate to use > kvmalloc to request memory. At the same time, it can also cope with the > situation that the extended attribute will become longer in the future. > > Signed-off-by: Ye Bin <yebin10@huawei.com> Looks good. Feel free to add: Reviewed-by: Jan Kara <jack@suse.cz> Thanks! Honza > --- > fs/ext4/xattr.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/fs/ext4/xattr.c b/fs/ext4/xattr.c > index 75287422c36c..efa623658c12 100644 > --- a/fs/ext4/xattr.c > +++ b/fs/ext4/xattr.c > @@ -2579,7 +2579,7 @@ static int ext4_xattr_move_to_block(handle_t *handle, struct inode *inode, > > is = kzalloc(sizeof(struct ext4_xattr_ibody_find), GFP_NOFS); > bs = kzalloc(sizeof(struct ext4_xattr_block_find), GFP_NOFS); > - buffer = kmalloc(value_size, GFP_NOFS); > + buffer = kvmalloc(value_size, GFP_NOFS); > b_entry_name = kmalloc(entry->e_name_len + 1, GFP_NOFS); > if (!is || !bs || !buffer || !b_entry_name) { > error = -ENOMEM; > @@ -2631,7 +2631,7 @@ static int ext4_xattr_move_to_block(handle_t *handle, struct inode *inode, > error = 0; > out: > kfree(b_entry_name); > - kfree(buffer); > + kvfree(buffer); > if (is) > brelse(is->iloc.bh); > if (bs) > -- > 2.31.1 >
diff --git a/fs/ext4/xattr.c b/fs/ext4/xattr.c index 75287422c36c..efa623658c12 100644 --- a/fs/ext4/xattr.c +++ b/fs/ext4/xattr.c @@ -2579,7 +2579,7 @@ static int ext4_xattr_move_to_block(handle_t *handle, struct inode *inode, is = kzalloc(sizeof(struct ext4_xattr_ibody_find), GFP_NOFS); bs = kzalloc(sizeof(struct ext4_xattr_block_find), GFP_NOFS); - buffer = kmalloc(value_size, GFP_NOFS); + buffer = kvmalloc(value_size, GFP_NOFS); b_entry_name = kmalloc(entry->e_name_len + 1, GFP_NOFS); if (!is || !bs || !buffer || !b_entry_name) { error = -ENOMEM; @@ -2631,7 +2631,7 @@ static int ext4_xattr_move_to_block(handle_t *handle, struct inode *inode, error = 0; out: kfree(b_entry_name); - kfree(buffer); + kvfree(buffer); if (is) brelse(is->iloc.bh); if (bs)