Re: [PATCH v3 26/30] mm: shmem: use SHMEM_F_* flags instead of VM_* flags
From: Vipin Sharma <hidden>
Date: 2025-08-11 23:11:13
Also in:
linux-api, linux-fsdevel, linux-mm, lkml
On 2025-08-07 01:44:32, Pasha Tatashin wrote:
quoted hunk ↗ jump to hunk
From: Pratyush Yadav <redacted>@@ -3123,7 +3123,9 @@ static struct inode *__shmem_get_inode(struct mnt_idmap *idmap, spin_lock_init(&info->lock); atomic_set(&info->stop_eviction, 0); info->seals = F_SEAL_SEAL; - info->flags = flags & VM_NORESERVE; + info->flags = 0;
This is not needed as the 'info' is being set to 0 just above spin_lock_init.
+ if (flags & VM_NORESERVE) + info->flags |= SHMEM_F_NORESERVE;
As info->flags will be 0, this can be just direct assignment '='.
quoted hunk ↗ jump to hunk
info->i_crtime = inode_get_mtime(inode); info->fsflags = (dir == NULL) ? 0 : SHMEM_I(dir)->fsflags & SHMEM_FL_INHERITED;@@ -5862,8 +5864,10 @@ static inline struct inode *shmem_get_inode(struct mnt_idmap *idmap, /* common code */ static struct file *__shmem_file_setup(struct vfsmount *mnt, const char *name, - loff_t size, unsigned long flags, unsigned int i_flags) + loff_t size, unsigned long vm_flags, + unsigned int i_flags)
Nit: Might be just my editor, but this alignment seems off.
quoted hunk ↗ jump to hunk
{ + unsigned long flags = (vm_flags & VM_NORESERVE) ? SHMEM_F_NORESERVE : 0; struct inode *inode; struct file *res;@@ -5880,7 +5884,7 @@ static struct file *__shmem_file_setup(struct vfsmount *mnt, const char *name, return ERR_PTR(-ENOMEM); inode = shmem_get_inode(&nop_mnt_idmap, mnt->mnt_sb, NULL, - S_IFREG | S_IRWXUGO, 0, flags); + S_IFREG | S_IRWXUGO, 0, vm_flags); if (IS_ERR(inode)) { shmem_unacct_size(flags, size); return ERR_CAST(inode);-- 2.50.1.565.gc32cd1483b-goog