Instead of using i_private_data for resv_map pointer add the pointer into hugetlbfs private part of the inode. Signed-off-by: Jan Kara --- fs/hugetlbfs/inode.c | 10 ++-------- include/linux/hugetlb.h | 1 + mm/hugetlb.c | 10 +--------- 3 files changed, 4 insertions(+), 17 deletions(-) diff --git a/fs/hugetlbfs/inode.c b/fs/hugetlbfs/inode.c index 3f70c47981de..0496f2e6d177 100644 --- a/fs/hugetlbfs/inode.c +++ b/fs/hugetlbfs/inode.c @@ -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); @@ -950,7 +944,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: diff --git a/include/linux/hugetlb.h b/include/linux/hugetlb.h index 65910437be1c..fc5462fe943f 100644 --- a/include/linux/hugetlb.h +++ b/include/linux/hugetlb.h @@ -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; }; diff --git a/mm/hugetlb.c b/mm/hugetlb.c index 0beb6e22bc26..7ab5c724a711 100644 --- a/mm/hugetlb.c +++ b/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) -- 2.51.0