From patchwork Tue Dec 6 01:58:04 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ye Bin X-Patchwork-Id: 30056 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp2574177wrr; Mon, 5 Dec 2022 17:38:57 -0800 (PST) X-Google-Smtp-Source: AA0mqf4CKViw88549peItbxOn+QvBAyv/6wUR1JNiyMusPt+iMwol2vyLB92gOmvkcDTrYlMTt5W X-Received: by 2002:a63:470e:0:b0:440:69bc:c972 with SMTP id u14-20020a63470e000000b0044069bcc972mr57387024pga.86.1670290737372; Mon, 05 Dec 2022 17:38:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670290737; cv=none; d=google.com; s=arc-20160816; b=MIFO+JzQRm/rWhO3hxwCfTVZ/T6fXteQoEdP3A98xIJ1+4UQVTKN37fI5puRL9oEFO Sw52FHfRqwLc6Auc0glLus26YbvGSo9EgqbGa/HYy5emXKdA9tAObFv3ilz0qelF8T+l xE3ZAaeJThS4Dn1g513b+qGx+kArJ1egCBpjFcSSo/7I0ywS52x/7XlngOVoH8fOFsWS 8iQ7x96HhGcYm7Vb0mIfAX4g3+NaoJWTzqUlJzNh7Wz2wqX0GeWwj19/gxKFoyS8kZsT CuggSc1n1R8NY6vntoYKP03VwqAbDlTjwoSH+xoRk7rX8TMPNf6gUPhl2S/aTekW6sCY fz8g== 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=TWpKIgkwmAGa3zPrX3g2HE1BSt8x45EBVm09+iXEYVc=; b=Lnr62On/Mli5XHthPQ03YhblA84T/2OV61xIDWvlkBWOlLHtdFk8CggHmUE4byn4m2 eQ30IUgnvo1QxT+qbNCy/3IH14VfwVqOsSFvWqwnrU5sNdjn0YhHOnJ8rA84yc6quG3n w4qalGxJjrc+5UOJsfvrzTTgRup0i5d2py4caQSbfNyRoniYLtjyK3OoZApHiYAKu9fT ZdtbjUbODQ/6wvr87j9nT83ZkuCuE2bX8MP1BFen7P4NQC5F2S67rNZKkGFyeMo9ZYvu Npt9zpCo3jE1Zadlb6I469pfsby186mPxQ6hPn4YjBA6jxDffEJw3s2A02sQ3+Ucl9+A Xdhg== 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 u62-20020a638541000000b00478b6aa0363si5089256pgd.218.2022.12.05.17.38.43; Mon, 05 Dec 2022 17:38:57 -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 S233467AbiLFBh2 (ORCPT + 99 others); Mon, 5 Dec 2022 20:37:28 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48208 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232976AbiLFBhQ (ORCPT ); Mon, 5 Dec 2022 20:37:16 -0500 Received: from dggsgout11.his.huawei.com (dggsgout11.his.huawei.com [45.249.212.51]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 369CE20BD7; Mon, 5 Dec 2022 17:37:15 -0800 (PST) Received: from mail02.huawei.com (unknown [172.30.67.153]) by dggsgout11.his.huawei.com (SkyGuard) with ESMTP id 4NR31d52zlz4f3k62; Tue, 6 Dec 2022 09:37:09 +0800 (CST) Received: from huaweicloud.com (unknown [10.175.127.227]) by APP4 (Coremail) with SMTP id gCh0CgDH69jFnI5jZpTsBg--.65169S8; Tue, 06 Dec 2022 09:37:12 +0800 (CST) From: Ye Bin To: tytso@mit.edu, adilger.kernel@dilger.ca, linux-ext4@vger.kernel.org Cc: linux-kernel@vger.kernel.org, jack@suse.cz, Ye Bin Subject: [PATCH -next 4/6] ext4: allocate extended attribute value in vmalloc area Date: Tue, 6 Dec 2022 09:58:04 +0800 Message-Id: <20221206015806.3420321-5-yebin@huaweicloud.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20221206015806.3420321-1-yebin@huaweicloud.com> References: <20221206015806.3420321-1-yebin@huaweicloud.com> MIME-Version: 1.0 X-CM-TRANSID: gCh0CgDH69jFnI5jZpTsBg--.65169S8 X-Coremail-Antispam: 1UD129KBjvJXoW7ArW3JF1fWFWxury7KryUWrg_yoW8JFyfpa 95K340kr43Wry7urWxCF4xZ3sFg3ZFgr47Gay3Xw40vFy5Xwn2gFyYyFWYvF15ZFWftw4v qF1Dtr18Za13t3DanT9S1TB71UUUUUUqnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDU0xBIdaVrnRJUUUvEb4IE77IF4wAFF20E14v26rWj6s0DM7CY07I20VC2zVCF04k2 6cxKx2IYs7xG6rWj6s0DM7CIcVAFz4kK6r1j6r18M28IrcIa0xkI8VA2jI8067AKxVWUAV Cq3wA2048vs2IY020Ec7CjxVAFwI0_Xr0E3s1l8cAvFVAK0II2c7xJM28CjxkF64kEwVA0 rcxSw2x7M28EF7xvwVC0I7IYx2IY67AKxVWDJVCq3wA2z4x0Y4vE2Ix0cI8IcVCY1x0267 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=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_PASS 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-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1751426780174721291?= X-GMAIL-MSGID: =?utf-8?q?1751426780174721291?= From: Ye Bin 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 extension attribute will become longer in the future. Signed-off-by: Ye Bin --- 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)