From patchwork Sun Feb 27 06:30:01 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hugh Dickins X-Patchwork-Id: 12761539 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 83207C433EF for ; Sun, 27 Feb 2022 06:30:16 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id F03D88D001D; Sun, 27 Feb 2022 01:30:15 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id EB4168D0007; Sun, 27 Feb 2022 01:30:15 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id DA2918D001D; Sun, 27 Feb 2022 01:30:15 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (relay.hostedemail.com [64.99.140.26]) by kanga.kvack.org (Postfix) with ESMTP id C6CEB8D0007 for ; Sun, 27 Feb 2022 01:30:15 -0500 (EST) Received: from smtpin03.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 7D02AA4F for ; Sun, 27 Feb 2022 06:30:15 +0000 (UTC) X-FDA: 79187585190.03.1895CA9 Received: from mail-qt1-f182.google.com (mail-qt1-f182.google.com [209.85.160.182]) by imf02.hostedemail.com (Postfix) with ESMTP id 10DD580003 for ; Sun, 27 Feb 2022 06:30:14 +0000 (UTC) Received: by mail-qt1-f182.google.com with SMTP id t28so6342029qtc.7 for ; Sat, 26 Feb 2022 22:30:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=date:from:to:cc:subject:in-reply-to:message-id:references :mime-version; bh=u2DzgVMV1bW5JCC4SUZOIoJd+XZwoGYmc/Bv0aGkfSw=; b=q7fFprcg73fGah6aXTI4Zc02BldDyWEnvwvELxcwU+ts4pqoLwuR1wLeE6rXgGxRkK f9uSELTsD0C3Sz59NK+9ZwUM/WkJm4c4oOqWBA3Heu5XFTcRz7Vw7eaRrlKb5nO1gvEJ FCEA+Kk8QLDVLpeKlbHfEvUN1UyzQCKt4FaT801HLeN9J6CipN+aqZjEfVL0EtqKc1OU ipK71V2sWxF0vTy3xD/t4RD3lSJI/ST9j/0KZFuotG78k3vv9z4N4TZ5ncZbOuTYiky5 SWmgK79yMVFNQ/GdQuSMXWmAieHLU1hdO622f4i1LZsJk9u+KOcXj5Hsbz4CMZoNMgpG dQSw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:in-reply-to:message-id :references:mime-version; bh=u2DzgVMV1bW5JCC4SUZOIoJd+XZwoGYmc/Bv0aGkfSw=; b=2eXBc3BzbSTgKgqeUYalITGdY6twhL9b/p7X26YFTO7Pc3mnPmQg2kSXPksPZKNJkV 93KvkBeqjnwkCZjXg1jw3b9jZzYSINZtf7dyUb8mk5FcJKAMQx2p3yNJvGnK7yp2Tt7V mKUWqswFyA022sxswJ6TLQQbXohCxJ9y+I3HwZifpRB6K9cqaic6jMCwv1/MxMuA9bat Kot4fJ+ooYTPRrUshc85UtqlWZT3Hlu2I4W8Uge+c+r0yr00CIgOn43U52fFtUkvf/3E joryjsZBtnh1voPtmPRNKdj4KBPEtRUUhhBvnoskXoBmPGZLQVTvQ5hsChn35TxBynvS UB/w== X-Gm-Message-State: AOAM530mVn4VNHNDZ4MljzFW0RIZHidoa9y5FTb8rs6/7CYxclSwXY4+ cTloJI/HH0iBL9fyt9h7vcCq4w== X-Google-Smtp-Source: ABdhPJzKL487DZDKKdZUU1mzNVs8ZSqXW7BZIAVvlyjxrkZk0Cxm6btMJm0P4SIefrANKn/B+WjqmA== X-Received: by 2002:ac8:4e82:0:b0:2dd:e5a1:3b2a with SMTP id 2-20020ac84e82000000b002dde5a13b2amr12637058qtp.196.1645943414134; Sat, 26 Feb 2022 22:30:14 -0800 (PST) Received: from ripple.attlocal.net (172-10-233-147.lightspeed.sntcca.sbcglobal.net. [172.10.233.147]) by smtp.gmail.com with ESMTPSA id bq42-20020a05620a46aa00b006494fb49246sm3443689qkb.86.2022.02.26.22.30.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 26 Feb 2022 22:30:13 -0800 (PST) Date: Sat, 26 Feb 2022 22:30:01 -0800 (PST) From: Hugh Dickins X-X-Sender: hugh@ripple.anvils To: Andrew Morton cc: Xavier Roche , Jean Delvare , linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: [PATCH mmotm] tmpfs: three tweaks to creation time patch In-Reply-To: <20220211213628.GA1919658@xavier-xps> Message-ID: References: <20220211213628.GA1919658@xavier-xps> MIME-Version: 1.0 X-Rspam-User: X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: 10DD580003 X-Stat-Signature: o3apxhjmfm67a3jagyyhfty1g9d6tx59 Authentication-Results: imf02.hostedemail.com; dkim=pass header.d=google.com header.s=20210112 header.b=q7fFprcg; spf=pass (imf02.hostedemail.com: domain of hughd@google.com designates 209.85.160.182 as permitted sender) smtp.mailfrom=hughd@google.com; dmarc=pass (policy=reject) header.from=google.com X-HE-Tag: 1645943414-833168 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: Thank you to Xavier Roche for his tmpfs file creation time patch. Please apply these 3 tweaks on top (and fold in when sending to Linus): 1. Move vfs_inode back to being last element of shmem_inode_info. 2. Remove unnecessary parentheses from condition in shmem_getattr(). 3. Using shmem_getattr() on other file types than regular requires that shmem_is_huge() check type, to stop incorrect HPAGE_PMD_SIZE blksize. Signed-off-by: Hugh Dickins --- Cleanups and fix to tmpfs-support-for-file-creation-time.patch include/linux/shmem_fs.h | 2 +- mm/shmem.c | 7 +++---- 2 files changed, 4 insertions(+), 5 deletions(-) --- mmotm/include/linux/shmem_fs.h +++ linux/include/linux/shmem_fs.h @@ -24,8 +24,8 @@ struct shmem_inode_info { struct shared_policy policy; /* NUMA memory alloc policy */ struct simple_xattrs xattrs; /* list of xattrs */ atomic_t stop_eviction; /* hold when working on inode */ - struct inode vfs_inode; struct timespec64 i_crtime; /* file creation time */ + struct inode vfs_inode; }; struct shmem_sb_info { --- mmotm/mm/shmem.c +++ linux/mm/shmem.c @@ -476,6 +476,8 @@ bool shmem_is_huge(struct vm_area_struct { loff_t i_size; + if (!S_ISREG(inode->i_mode)) + return false; if (shmem_huge == SHMEM_HUGE_DENY) return false; if (vma && ((vma->vm_flags & VM_NOHUGEPAGE) || @@ -1061,7 +1063,7 @@ static int shmem_getattr(struct user_nam if (shmem_is_huge(NULL, inode, 0)) stat->blksize = HPAGE_PMD_SIZE; - if ((request_mask & STATX_BTIME)) { + if (request_mask & STATX_BTIME) { stat->result_mask |= STATX_BTIME; stat->btime.tv_sec = info->i_crtime.tv_sec; stat->btime.tv_nsec = info->i_crtime.tv_nsec; @@ -1860,9 +1862,6 @@ repeat: return 0; } - /* Never use a huge page for shmem_symlink() */ - if (S_ISLNK(inode->i_mode)) - goto alloc_nohuge; if (!shmem_is_huge(vma, inode, index)) goto alloc_nohuge;