diff --git a/fs/hugetlbfs/inode.c b/fs/hugetlbfs/inode.c index 018d041281412f152529945209eb798d4a4d8ed9..c1268dcc8bb31ef912edbab161292773020e077f 100644 --- a/fs/hugetlbfs/inode.c +++ b/fs/hugetlbfs/inode.c @@ -482,15 +482,11 @@ static void hugetlbfs_evict_inode(struct inode *inode) { struct resv_map *resv_map; - struct hugetlbfs_inode_info *info = HUGETLBFS_I(inode); - remove_inode_hugepages(inode, 0, LLONG_MAX); - resv_map = info->resv_map; + resv_map = (struct resv_map *)inode->i_mapping->private_data; /* root inode doesn't have the resv_map, so we should check it */ - if (resv_map) { + if (resv_map) resv_map_release(&resv_map->refs); - info->resv_map = NULL; - } clear_inode(inode); } @@ -759,7 +755,7 @@ static struct inode *hugetlbfs_get_inode(struct super_block *sb, &hugetlbfs_i_mmap_rwsem_key); inode->i_mapping->a_ops = &hugetlbfs_aops; inode->i_atime = inode->i_mtime = inode->i_ctime = current_time(inode); - info->resv_map = resv_map; + inode->i_mapping->private_data = resv_map; info->seals = F_SEAL_SEAL; switch (mode & S_IFMT) { default: @@ -1027,7 +1023,6 @@ static struct inode *hugetlbfs_alloc_inode(struct super_block *sb) * private inode. This simplifies hugetlbfs_destroy_inode. */ mpol_shared_policy_init(&p->policy, NULL); - p->resv_map = NULL; return &p->vfs_inode; } @@ -1042,7 +1037,6 @@ static void hugetlbfs_destroy_inode(struct inode *inode) { hugetlbfs_inc_free_inodes(HUGETLBFS_SB(inode->i_sb)); mpol_free_shared_policy(&HUGETLBFS_I(inode)->policy); - HUGETLBFS_I(inode)->resv_map = NULL; call_rcu(&inode->i_rcu, hugetlbfs_i_callback); } diff --git a/include/linux/hugetlb.h b/include/linux/hugetlb.h index 03cb471f257331ad78360d31f4ca7b5e136140ed..d34112fb3d52640d0ce7465f1927f2765810a7f7 100644 --- a/include/linux/hugetlb.h +++ b/include/linux/hugetlb.h @@ -289,7 +289,6 @@ struct hugetlbfs_inode_info { struct shared_policy policy; struct inode vfs_inode; unsigned int seals; - struct resv_map *resv_map; }; static inline struct hugetlbfs_inode_info *HUGETLBFS_I(struct inode *inode) diff --git a/mm/hugetlb.c b/mm/hugetlb.c index 712061ae3911738b8c8f27e9396aa6e982465c50..e995864fe0266ccd9762fdf9341afc47b97daae8 100644 --- a/mm/hugetlb.c +++ b/mm/hugetlb.c @@ -739,7 +739,7 @@ void resv_map_release(struct kref *ref) static inline struct resv_map *inode_resv_map(struct inode *inode) { - return HUGETLBFS_I(inode)->resv_map; + return inode->i_mapping->private_data; } static struct resv_map *vma_resv_map(struct vm_area_struct *vma)