Christoph Hellwig | 15aebd2 | 2008-02-22 12:39:12 +0100 | [diff] [blame] | 1 | #ifndef _UDF_I_H |
| 2 | #define _UDF_I_H |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3 | |
Namjae Jeon | 9960005 | 2013-01-19 11:17:14 +0900 | [diff] [blame] | 4 | struct extent_position { |
| 5 | struct buffer_head *bh; |
| 6 | uint32_t offset; |
| 7 | struct kernel_lb_addr block; |
| 8 | }; |
| 9 | |
| 10 | struct udf_ext_cache { |
| 11 | /* Extent position */ |
| 12 | struct extent_position epos; |
| 13 | /* Start logical offset in bytes */ |
| 14 | loff_t lstart; |
| 15 | }; |
| 16 | |
Alessio Igor Bogani | 4d0fb62 | 2010-11-16 18:40:47 +0100 | [diff] [blame] | 17 | /* |
| 18 | * The i_data_sem and i_mutex serve for protection of allocation information |
| 19 | * of a regular files and symlinks. This includes all extents belonging to |
| 20 | * the file/symlink, a fact whether data are in-inode or in external data |
| 21 | * blocks, preallocation, goal block information... When extents are read, |
| 22 | * i_mutex or i_data_sem must be held (for reading is enough in case of |
| 23 | * i_data_sem). When extents are changed, i_data_sem must be held for writing |
| 24 | * and also i_mutex must be held. |
| 25 | * |
| 26 | * For directories i_mutex is used for all the necessary protection. |
| 27 | */ |
| 28 | |
Christoph Hellwig | 15aebd2 | 2008-02-22 12:39:12 +0100 | [diff] [blame] | 29 | struct udf_inode_info { |
| 30 | struct timespec i_crtime; |
| 31 | /* Physical address of inode */ |
Pekka Enberg | 5ca4e4b | 2008-10-15 12:28:03 +0200 | [diff] [blame] | 32 | struct kernel_lb_addr i_location; |
Christoph Hellwig | 15aebd2 | 2008-02-22 12:39:12 +0100 | [diff] [blame] | 33 | __u64 i_unique; |
| 34 | __u32 i_lenEAttr; |
| 35 | __u32 i_lenAlloc; |
| 36 | __u64 i_lenExtents; |
| 37 | __u32 i_next_alloc_block; |
| 38 | __u32 i_next_alloc_goal; |
Steve Nickel | d5e2cf0 | 2012-02-14 00:28:42 -0500 | [diff] [blame] | 39 | __u32 i_checkpoint; |
Christoph Hellwig | 15aebd2 | 2008-02-22 12:39:12 +0100 | [diff] [blame] | 40 | unsigned i_alloc_type : 3; |
marcin.slusarz@gmail.com | d652eef | 2008-01-30 22:03:59 +0100 | [diff] [blame] | 41 | unsigned i_efe : 1; /* extendedFileEntry */ |
| 42 | unsigned i_use : 1; /* unallocSpaceEntry */ |
Christoph Hellwig | 15aebd2 | 2008-02-22 12:39:12 +0100 | [diff] [blame] | 43 | unsigned i_strat4096 : 1; |
| 44 | unsigned reserved : 26; |
| 45 | union { |
Pekka Enberg | 5ca4e4b | 2008-10-15 12:28:03 +0200 | [diff] [blame] | 46 | struct short_ad *i_sad; |
| 47 | struct long_ad *i_lad; |
Christoph Hellwig | 15aebd2 | 2008-02-22 12:39:12 +0100 | [diff] [blame] | 48 | __u8 *i_data; |
| 49 | } i_ext; |
Alessio Igor Bogani | 4d0fb62 | 2010-11-16 18:40:47 +0100 | [diff] [blame] | 50 | struct rw_semaphore i_data_sem; |
Namjae Jeon | 9960005 | 2013-01-19 11:17:14 +0900 | [diff] [blame] | 51 | struct udf_ext_cache cached_extent; |
| 52 | /* Spinlock for protecting extent cache */ |
| 53 | spinlock_t i_extent_cache_lock; |
Christoph Hellwig | 15aebd2 | 2008-02-22 12:39:12 +0100 | [diff] [blame] | 54 | struct inode vfs_inode; |
| 55 | }; |
| 56 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 57 | static inline struct udf_inode_info *UDF_I(struct inode *inode) |
| 58 | { |
Rasmus Villemoes | db6172c | 2015-03-19 12:28:04 +0100 | [diff] [blame] | 59 | return container_of(inode, struct udf_inode_info, vfs_inode); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 60 | } |
| 61 | |
Christoph Hellwig | 15aebd2 | 2008-02-22 12:39:12 +0100 | [diff] [blame] | 62 | #endif /* _UDF_I_H) */ |