blob: 2ef0e212f08a3d55ce25b8c6e34843a03fa5f88c [file] [log] [blame]
Greg Kroah-Hartmanb2441312017-11-01 15:07:57 +01001/* SPDX-License-Identifier: GPL-2.0 */
Christoph Hellwig15aebd22008-02-22 12:39:12 +01002#ifndef _UDF_I_H
3#define _UDF_I_H
Linus Torvalds1da177e2005-04-16 15:20:36 -07004
Namjae Jeon99600052013-01-19 11:17:14 +09005struct extent_position {
6 struct buffer_head *bh;
7 uint32_t offset;
8 struct kernel_lb_addr block;
9};
10
11struct udf_ext_cache {
12 /* Extent position */
13 struct extent_position epos;
14 /* Start logical offset in bytes */
15 loff_t lstart;
16};
17
Alessio Igor Bogani4d0fb622010-11-16 18:40:47 +010018/*
19 * The i_data_sem and i_mutex serve for protection of allocation information
20 * of a regular files and symlinks. This includes all extents belonging to
21 * the file/symlink, a fact whether data are in-inode or in external data
22 * blocks, preallocation, goal block information... When extents are read,
23 * i_mutex or i_data_sem must be held (for reading is enough in case of
24 * i_data_sem). When extents are changed, i_data_sem must be held for writing
25 * and also i_mutex must be held.
26 *
27 * For directories i_mutex is used for all the necessary protection.
28 */
29
Christoph Hellwig15aebd22008-02-22 12:39:12 +010030struct udf_inode_info {
Arnd Bergmannc3b9cec2018-06-20 10:15:13 +020031 struct timespec64 i_crtime;
Christoph Hellwig15aebd22008-02-22 12:39:12 +010032 /* Physical address of inode */
Pekka Enberg5ca4e4b2008-10-15 12:28:03 +020033 struct kernel_lb_addr i_location;
Christoph Hellwig15aebd22008-02-22 12:39:12 +010034 __u64 i_unique;
35 __u32 i_lenEAttr;
36 __u32 i_lenAlloc;
37 __u64 i_lenExtents;
38 __u32 i_next_alloc_block;
39 __u32 i_next_alloc_goal;
Steve Nickeld5e2cf02012-02-14 00:28:42 -050040 __u32 i_checkpoint;
Christoph Hellwig15aebd22008-02-22 12:39:12 +010041 unsigned i_alloc_type : 3;
marcin.slusarz@gmail.comd652eef2008-01-30 22:03:59 +010042 unsigned i_efe : 1; /* extendedFileEntry */
43 unsigned i_use : 1; /* unallocSpaceEntry */
Christoph Hellwig15aebd22008-02-22 12:39:12 +010044 unsigned i_strat4096 : 1;
45 unsigned reserved : 26;
46 union {
Pekka Enberg5ca4e4b2008-10-15 12:28:03 +020047 struct short_ad *i_sad;
48 struct long_ad *i_lad;
Christoph Hellwig15aebd22008-02-22 12:39:12 +010049 __u8 *i_data;
50 } i_ext;
Alessio Igor Bogani4d0fb622010-11-16 18:40:47 +010051 struct rw_semaphore i_data_sem;
Namjae Jeon99600052013-01-19 11:17:14 +090052 struct udf_ext_cache cached_extent;
53 /* Spinlock for protecting extent cache */
54 spinlock_t i_extent_cache_lock;
Christoph Hellwig15aebd22008-02-22 12:39:12 +010055 struct inode vfs_inode;
56};
57
Linus Torvalds1da177e2005-04-16 15:20:36 -070058static inline struct udf_inode_info *UDF_I(struct inode *inode)
59{
Rasmus Villemoesdb6172c2015-03-19 12:28:04 +010060 return container_of(inode, struct udf_inode_info, vfs_inode);
Linus Torvalds1da177e2005-04-16 15:20:36 -070061}
62
Christoph Hellwig15aebd22008-02-22 12:39:12 +010063#endif /* _UDF_I_H) */