Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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>

authored by

Jan Kara and committed by
Christian Brauner
2811f2a8 0f46a9e2

+5 -17
+3 -8
fs/hugetlbfs/inode.c
··· 622 622 trace_hugetlbfs_evict_inode(inode); 623 623 remove_inode_hugepages(inode, 0, LLONG_MAX); 624 624 625 - /* 626 - * Get the resv_map from the address space embedded in the inode. 627 - * This is the address space which points to any resv_map allocated 628 - * at inode creation time. If this is a device special inode, 629 - * i_mapping may not point to the original address space. 630 - */ 631 - resv_map = (struct resv_map *)(&inode->i_data)->i_private_data; 625 + resv_map = HUGETLBFS_I(inode)->resv_map; 632 626 /* Only regular and link inodes have associated reserve maps */ 633 627 if (resv_map) 634 628 resv_map_release(&resv_map->refs); ··· 901 907 simple_inode_init_ts(inode); 902 908 inode->i_op = &hugetlbfs_dir_inode_operations; 903 909 inode->i_fop = &simple_dir_operations; 910 + HUGETLBFS_I(inode)->resv_map = NULL; 904 911 /* directory inodes start off with i_nlink == 2 (for "." entry) */ 905 912 inc_nlink(inode); 906 913 lockdep_annotate_inode_mutex_key(inode); ··· 945 950 &hugetlbfs_i_mmap_rwsem_key); 946 951 inode->i_mapping->a_ops = &hugetlbfs_aops; 947 952 simple_inode_init_ts(inode); 948 - inode->i_mapping->i_private_data = resv_map; 953 + info->resv_map = resv_map; 949 954 info->seals = F_SEAL_SEAL; 950 955 switch (mode & S_IFMT) { 951 956 default:
+1
include/linux/hugetlb.h
··· 518 518 519 519 struct hugetlbfs_inode_info { 520 520 struct inode vfs_inode; 521 + struct resv_map *resv_map; 521 522 unsigned int seals; 522 523 }; 523 524
+1 -9
mm/hugetlb.c
··· 1157 1157 1158 1158 static inline struct resv_map *inode_resv_map(struct inode *inode) 1159 1159 { 1160 - /* 1161 - * At inode evict time, i_mapping may not point to the original 1162 - * address space within the inode. This original address space 1163 - * contains the pointer to the resv_map. So, always use the 1164 - * address space embedded within the inode. 1165 - * The VERY common case is inode->mapping == &inode->i_data but, 1166 - * this may not be true for device special inodes. 1167 - */ 1168 - return (struct resv_map *)(&inode->i_data)->i_private_data; 1160 + return HUGETLBFS_I(inode)->resv_map; 1169 1161 } 1170 1162 1171 1163 static struct resv_map *vma_resv_map(struct vm_area_struct *vma)