xref: /linux/fs/udf/udf_i.h (revision db6172c41194576ba2a27e64fa2a5576d11d6eb9)
115aebd28SChristoph Hellwig #ifndef _UDF_I_H
215aebd28SChristoph Hellwig #define _UDF_I_H
31da177e4SLinus Torvalds 
499600051SNamjae Jeon struct extent_position {
599600051SNamjae Jeon 	struct buffer_head *bh;
699600051SNamjae Jeon 	uint32_t offset;
799600051SNamjae Jeon 	struct kernel_lb_addr block;
899600051SNamjae Jeon };
999600051SNamjae Jeon 
1099600051SNamjae Jeon struct udf_ext_cache {
1199600051SNamjae Jeon 	/* Extent position */
1299600051SNamjae Jeon 	struct extent_position epos;
1399600051SNamjae Jeon 	/* Start logical offset in bytes */
1499600051SNamjae Jeon 	loff_t lstart;
1599600051SNamjae Jeon };
1699600051SNamjae Jeon 
174d0fb621SAlessio Igor Bogani /*
184d0fb621SAlessio Igor Bogani  * The i_data_sem and i_mutex serve for protection of allocation information
194d0fb621SAlessio Igor Bogani  * of a regular files and symlinks. This includes all extents belonging to
204d0fb621SAlessio Igor Bogani  * the file/symlink, a fact whether data are in-inode or in external data
214d0fb621SAlessio Igor Bogani  * blocks, preallocation, goal block information... When extents are read,
224d0fb621SAlessio Igor Bogani  * i_mutex or i_data_sem must be held (for reading is enough in case of
234d0fb621SAlessio Igor Bogani  * i_data_sem). When extents are changed, i_data_sem must be held for writing
244d0fb621SAlessio Igor Bogani  * and also i_mutex must be held.
254d0fb621SAlessio Igor Bogani  *
264d0fb621SAlessio Igor Bogani  * For directories i_mutex is used for all the necessary protection.
274d0fb621SAlessio Igor Bogani  */
284d0fb621SAlessio Igor Bogani 
2915aebd28SChristoph Hellwig struct udf_inode_info {
3015aebd28SChristoph Hellwig 	struct timespec		i_crtime;
3115aebd28SChristoph Hellwig 	/* Physical address of inode */
325ca4e4beSPekka Enberg 	struct kernel_lb_addr		i_location;
3315aebd28SChristoph Hellwig 	__u64			i_unique;
3415aebd28SChristoph Hellwig 	__u32			i_lenEAttr;
3515aebd28SChristoph Hellwig 	__u32			i_lenAlloc;
3615aebd28SChristoph Hellwig 	__u64			i_lenExtents;
3715aebd28SChristoph Hellwig 	__u32			i_next_alloc_block;
3815aebd28SChristoph Hellwig 	__u32			i_next_alloc_goal;
39d5e2cf07SSteve Nickel 	__u32			i_checkpoint;
4015aebd28SChristoph Hellwig 	unsigned		i_alloc_type : 3;
41d652eefbSmarcin.slusarz@gmail.com 	unsigned		i_efe : 1;	/* extendedFileEntry */
42d652eefbSmarcin.slusarz@gmail.com 	unsigned		i_use : 1;	/* unallocSpaceEntry */
4315aebd28SChristoph Hellwig 	unsigned		i_strat4096 : 1;
4415aebd28SChristoph Hellwig 	unsigned		reserved : 26;
4515aebd28SChristoph Hellwig 	union {
465ca4e4beSPekka Enberg 		struct short_ad	*i_sad;
475ca4e4beSPekka Enberg 		struct long_ad		*i_lad;
4815aebd28SChristoph Hellwig 		__u8		*i_data;
4915aebd28SChristoph Hellwig 	} i_ext;
504d0fb621SAlessio Igor Bogani 	struct rw_semaphore	i_data_sem;
5199600051SNamjae Jeon 	struct udf_ext_cache cached_extent;
5299600051SNamjae Jeon 	/* Spinlock for protecting extent cache */
5399600051SNamjae Jeon 	spinlock_t i_extent_cache_lock;
5415aebd28SChristoph Hellwig 	struct inode vfs_inode;
5515aebd28SChristoph Hellwig };
5615aebd28SChristoph Hellwig 
571da177e4SLinus Torvalds static inline struct udf_inode_info *UDF_I(struct inode *inode)
581da177e4SLinus Torvalds {
59*db6172c4SRasmus Villemoes 	return container_of(inode, struct udf_inode_info, vfs_inode);
601da177e4SLinus Torvalds }
611da177e4SLinus Torvalds 
6215aebd28SChristoph Hellwig #endif /* _UDF_I_H) */
63