xref: /linux/fs/udf/udf_i.h (revision 9a87ffc99ec8eb8d35eed7c4f816d75f5cc9662e)
1b2441318SGreg Kroah-Hartman /* SPDX-License-Identifier: GPL-2.0 */
215aebd28SChristoph Hellwig #ifndef _UDF_I_H
315aebd28SChristoph Hellwig #define _UDF_I_H
41da177e4SLinus Torvalds 
599600051SNamjae Jeon struct extent_position {
699600051SNamjae Jeon 	struct buffer_head *bh;
799600051SNamjae Jeon 	uint32_t offset;
899600051SNamjae Jeon 	struct kernel_lb_addr block;
999600051SNamjae Jeon };
1099600051SNamjae Jeon 
1199600051SNamjae Jeon struct udf_ext_cache {
1299600051SNamjae Jeon 	/* Extent position */
1399600051SNamjae Jeon 	struct extent_position epos;
1499600051SNamjae Jeon 	/* Start logical offset in bytes */
1599600051SNamjae Jeon 	loff_t lstart;
1699600051SNamjae Jeon };
1799600051SNamjae Jeon 
184d0fb621SAlessio Igor Bogani /*
194d0fb621SAlessio Igor Bogani  * The i_data_sem and i_mutex serve for protection of allocation information
204d0fb621SAlessio Igor Bogani  * of a regular files and symlinks. This includes all extents belonging to
214d0fb621SAlessio Igor Bogani  * the file/symlink, a fact whether data are in-inode or in external data
224d0fb621SAlessio Igor Bogani  * blocks, preallocation, goal block information... When extents are read,
234d0fb621SAlessio Igor Bogani  * i_mutex or i_data_sem must be held (for reading is enough in case of
244d0fb621SAlessio Igor Bogani  * i_data_sem). When extents are changed, i_data_sem must be held for writing
254d0fb621SAlessio Igor Bogani  * and also i_mutex must be held.
264d0fb621SAlessio Igor Bogani  *
274d0fb621SAlessio Igor Bogani  * For directories i_mutex is used for all the necessary protection.
284d0fb621SAlessio Igor Bogani  */
294d0fb621SAlessio Igor Bogani 
3015aebd28SChristoph Hellwig struct udf_inode_info {
31c3b9cecdSArnd Bergmann 	struct timespec64	i_crtime;
3215aebd28SChristoph Hellwig 	/* Physical address of inode */
335ca4e4beSPekka Enberg 	struct kernel_lb_addr		i_location;
3415aebd28SChristoph Hellwig 	__u64			i_unique;
3515aebd28SChristoph Hellwig 	__u32			i_lenEAttr;
3615aebd28SChristoph Hellwig 	__u32			i_lenAlloc;
3715aebd28SChristoph Hellwig 	__u64			i_lenExtents;
3815aebd28SChristoph Hellwig 	__u32			i_next_alloc_block;
3915aebd28SChristoph Hellwig 	__u32			i_next_alloc_goal;
40d5e2cf07SSteve Nickel 	__u32			i_checkpoint;
41c3367a1bSSteven J. Magnani 	__u32			i_extraPerms;
4215aebd28SChristoph Hellwig 	unsigned		i_alloc_type : 3;
43d652eefbSmarcin.slusarz@gmail.com 	unsigned		i_efe : 1;	/* extendedFileEntry */
44d652eefbSmarcin.slusarz@gmail.com 	unsigned		i_use : 1;	/* unallocSpaceEntry */
4515aebd28SChristoph Hellwig 	unsigned		i_strat4096 : 1;
46ab9a3a73SSteven J. Magnani 	unsigned		i_streamdir : 1;
47*fc8033a3SJan Kara 	unsigned		i_hidden : 1;	/* hidden system inode */
48*fc8033a3SJan Kara 	unsigned		reserved : 24;
4915aebd28SChristoph Hellwig 	__u8			*i_data;
50ab9a3a73SSteven J. Magnani 	struct kernel_lb_addr	i_locStreamdir;
51ab9a3a73SSteven J. Magnani 	__u64			i_lenStreams;
524d0fb621SAlessio Igor Bogani 	struct rw_semaphore	i_data_sem;
5399600051SNamjae Jeon 	struct udf_ext_cache cached_extent;
5499600051SNamjae Jeon 	/* Spinlock for protecting extent cache */
5599600051SNamjae Jeon 	spinlock_t i_extent_cache_lock;
5615aebd28SChristoph Hellwig 	struct inode vfs_inode;
5715aebd28SChristoph Hellwig };
5815aebd28SChristoph Hellwig 
UDF_I(struct inode * inode)591da177e4SLinus Torvalds static inline struct udf_inode_info *UDF_I(struct inode *inode)
601da177e4SLinus Torvalds {
61db6172c4SRasmus Villemoes 	return container_of(inode, struct udf_inode_info, vfs_inode);
621da177e4SLinus Torvalds }
631da177e4SLinus Torvalds 
6415aebd28SChristoph Hellwig #endif /* _UDF_I_H) */
65