mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-05-16 04:21:09 -04:00
hugetlbfs: Stop using i_private_data
Instead of using i_private_data for resv_map pointer add the pointer into hugetlbfs private part of the inode. Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Jan Kara <jack@suse.cz> Link: https://patch.msgid.link/20260326095354.16340-66-jack@suse.cz Signed-off-by: Christian Brauner <brauner@kernel.org>
This commit is contained in:
committed by
Christian Brauner
parent
0f46a9e274
commit
2811f2a82f
@@ -622,13 +622,7 @@ static void hugetlbfs_evict_inode(struct inode *inode)
|
||||
trace_hugetlbfs_evict_inode(inode);
|
||||
remove_inode_hugepages(inode, 0, LLONG_MAX);
|
||||
|
||||
/*
|
||||
* Get the resv_map from the address space embedded in the inode.
|
||||
* This is the address space which points to any resv_map allocated
|
||||
* at inode creation time. If this is a device special inode,
|
||||
* i_mapping may not point to the original address space.
|
||||
*/
|
||||
resv_map = (struct resv_map *)(&inode->i_data)->i_private_data;
|
||||
resv_map = HUGETLBFS_I(inode)->resv_map;
|
||||
/* Only regular and link inodes have associated reserve maps */
|
||||
if (resv_map)
|
||||
resv_map_release(&resv_map->refs);
|
||||
@@ -907,6 +901,7 @@ static struct inode *hugetlbfs_get_root(struct super_block *sb,
|
||||
simple_inode_init_ts(inode);
|
||||
inode->i_op = &hugetlbfs_dir_inode_operations;
|
||||
inode->i_fop = &simple_dir_operations;
|
||||
HUGETLBFS_I(inode)->resv_map = NULL;
|
||||
/* directory inodes start off with i_nlink == 2 (for "." entry) */
|
||||
inc_nlink(inode);
|
||||
lockdep_annotate_inode_mutex_key(inode);
|
||||
@@ -950,7 +945,7 @@ static struct inode *hugetlbfs_get_inode(struct super_block *sb,
|
||||
&hugetlbfs_i_mmap_rwsem_key);
|
||||
inode->i_mapping->a_ops = &hugetlbfs_aops;
|
||||
simple_inode_init_ts(inode);
|
||||
inode->i_mapping->i_private_data = resv_map;
|
||||
info->resv_map = resv_map;
|
||||
info->seals = F_SEAL_SEAL;
|
||||
switch (mode & S_IFMT) {
|
||||
default:
|
||||
|
||||
@@ -518,6 +518,7 @@ static inline struct hugetlbfs_sb_info *HUGETLBFS_SB(struct super_block *sb)
|
||||
|
||||
struct hugetlbfs_inode_info {
|
||||
struct inode vfs_inode;
|
||||
struct resv_map *resv_map;
|
||||
unsigned int seals;
|
||||
};
|
||||
|
||||
|
||||
10
mm/hugetlb.c
10
mm/hugetlb.c
@@ -1157,15 +1157,7 @@ void resv_map_release(struct kref *ref)
|
||||
|
||||
static inline struct resv_map *inode_resv_map(struct inode *inode)
|
||||
{
|
||||
/*
|
||||
* At inode evict time, i_mapping may not point to the original
|
||||
* address space within the inode. This original address space
|
||||
* contains the pointer to the resv_map. So, always use the
|
||||
* address space embedded within the inode.
|
||||
* The VERY common case is inode->mapping == &inode->i_data but,
|
||||
* this may not be true for device special inodes.
|
||||
*/
|
||||
return (struct resv_map *)(&inode->i_data)->i_private_data;
|
||||
return HUGETLBFS_I(inode)->resv_map;
|
||||
}
|
||||
|
||||
static struct resv_map *vma_resv_map(struct vm_area_struct *vma)
|
||||
|
||||
Reference in New Issue
Block a user