From: Hugh Dickins <hughd@google.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: Xavier Roche <xavier.roche@algolia.com>,
Jean Delvare <jdelvare@suse.de>,
linux-kernel@vger.kernel.org, linux-mm@kvack.org
Subject: [PATCH mmotm] tmpfs: three tweaks to creation time patch
Date: Sat, 26 Feb 2022 22:30:01 -0800 (PST) [thread overview]
Message-ID: <b954973a-b8d1-cab8-63bd-6ea8063de3@google.com> (raw)
In-Reply-To: <20220211213628.GA1919658@xavier-xps>
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 <hughd@google.com>
---
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;
next prev parent reply other threads:[~2022-02-27 6:31 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-02-11 21:36 [PATCH v2] tmpfs: support for file creation time Xavier Roche
2022-02-27 6:30 ` Hugh Dickins [this message]
2022-02-28 8:43 ` [PATCH v3] " Xavier Roche
2022-03-02 19:43 ` Linus Torvalds
2022-03-02 19:59 ` Andrew Morton
2022-03-02 20:17 ` Hugh Dickins
2022-03-14 21:08 ` Xavier Roche
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=b954973a-b8d1-cab8-63bd-6ea8063de3@google.com \
--to=hughd@google.com \
--cc=akpm@linux-foundation.org \
--cc=jdelvare@suse.de \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=xavier.roche@algolia.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).