udf_i.h 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. #ifndef _UDF_I_H
  3. #define _UDF_I_H
  4. struct extent_position {
  5. struct buffer_head *bh;
  6. uint32_t offset;
  7. struct kernel_lb_addr block;
  8. };
  9. struct udf_ext_cache {
  10. /* Extent position */
  11. struct extent_position epos;
  12. /* Start logical offset in bytes */
  13. loff_t lstart;
  14. };
  15. /*
  16. * The i_data_sem and i_mutex serve for protection of allocation information
  17. * of a regular files and symlinks. This includes all extents belonging to
  18. * the file/symlink, a fact whether data are in-inode or in external data
  19. * blocks, preallocation, goal block information... When extents are read,
  20. * i_mutex or i_data_sem must be held (for reading is enough in case of
  21. * i_data_sem). When extents are changed, i_data_sem must be held for writing
  22. * and also i_mutex must be held.
  23. *
  24. * For directories i_mutex is used for all the necessary protection.
  25. */
  26. struct udf_inode_info {
  27. struct timespec64 i_crtime;
  28. /* Physical address of inode */
  29. struct kernel_lb_addr i_location;
  30. __u64 i_unique;
  31. __u32 i_lenEAttr;
  32. __u32 i_lenAlloc;
  33. __u64 i_lenExtents;
  34. __u32 i_next_alloc_block;
  35. __u32 i_next_alloc_goal;
  36. __u32 i_checkpoint;
  37. __u32 i_extraPerms;
  38. unsigned i_alloc_type : 3;
  39. unsigned i_efe : 1; /* extendedFileEntry */
  40. unsigned i_use : 1; /* unallocSpaceEntry */
  41. unsigned i_strat4096 : 1;
  42. unsigned i_streamdir : 1;
  43. unsigned reserved : 25;
  44. __u8 *i_data;
  45. struct kernel_lb_addr i_locStreamdir;
  46. __u64 i_lenStreams;
  47. struct rw_semaphore i_data_sem;
  48. struct udf_ext_cache cached_extent;
  49. /* Spinlock for protecting extent cache */
  50. spinlock_t i_extent_cache_lock;
  51. struct inode vfs_inode;
  52. };
  53. static inline struct udf_inode_info *UDF_I(struct inode *inode)
  54. {
  55. return container_of(inode, struct udf_inode_info, vfs_inode);
  56. }
  57. #endif /* _UDF_I_H) */