73 #include <vm/seg_vn.h>
74 #include <vm/rm.h>
75 #include <vm/page.h>
76 #include <sys/swap.h>
77
78
79 #include <fs/fs_subr.h>
80
81
82 #include <sys/fs/udf_volume.h>
83 #include <sys/fs/udf_inode.h>
84
85 extern struct vnodeops *udf_vnodeops;
86
87 kmutex_t ud_sync_busy;
88 /*
89 * udf_vfs list manipulation routines
90 */
91 kmutex_t udf_vfs_mutex;
92 struct udf_vfs *udf_vfs_instances;
93 #ifndef __lint
94 _NOTE(MUTEX_PROTECTS_DATA(udf_vfs_mutex, udf_vfs_instances))
95 #endif
96
97 union ihead ud_ihead[UD_HASH_SZ];
98 kmutex_t ud_icache_lock;
99
100 #define UD_BEGIN 0x0
101 #define UD_END 0x1
102 #define UD_UNKN 0x2
103 struct ud_inode *udf_ifreeh, *udf_ifreet;
104 kmutex_t udf_ifree_lock;
105 #ifndef __lint
106 _NOTE(MUTEX_PROTECTS_DATA(udf_ifree_lock, udf_ifreeh))
107 _NOTE(MUTEX_PROTECTS_DATA(udf_ifree_lock, udf_ifreet))
108 #endif
109
110 kmutex_t ud_nino_lock;
111 int32_t ud_max_inodes = 512;
112 int32_t ud_cur_inodes = 0;
113 #ifndef __lint
114 _NOTE(MUTEX_PROTECTS_DATA(ud_nino_lock, ud_cur_inodes))
115 #endif
116
117 uid_t ud_default_uid = 0;
118 gid_t ud_default_gid = 3;
119
120 int32_t ud_updat_ext4(struct ud_inode *, struct file_entry *);
121 int32_t ud_updat_ext4096(struct ud_inode *, struct file_entry *);
122 void ud_make_sad(struct icb_ext *, struct short_ad *, int32_t);
123 void ud_make_lad(struct icb_ext *, struct long_ad *, int32_t);
124 void ud_trunc_ext4(struct ud_inode *, u_offset_t);
125 void ud_trunc_ext4096(struct ud_inode *, u_offset_t);
126 void ud_add_to_free_list(struct ud_inode *, uint32_t);
127 void ud_remove_from_free_list(struct ud_inode *, uint32_t);
128
129
130 #ifdef DEBUG
131 struct ud_inode *
132 ud_search_icache(struct vfs *vfsp, uint16_t prn, uint32_t ploc)
133 {
134 int32_t hno;
135 union ihead *ih;
2150 udf_ifreeh->i_freeb = NULL;
2151 }
2152 } else {
2153 ip->i_freeb->i_freef = ip->i_freef;
2154 if (ip->i_freef) {
2155 ip->i_freef->i_freeb = ip->i_freeb;
2156 } else {
2157 udf_ifreet = ip->i_freeb;
2158 }
2159 }
2160 ip->i_freef = NULL;
2161 ip->i_freeb = NULL;
2162 }
2163
2164 void
2165 ud_init_inodes(void)
2166 {
2167 union ihead *ih = ud_ihead;
2168 int index;
2169
2170 #ifndef __lint
2171 _NOTE(NO_COMPETING_THREADS_NOW);
2172 #endif
2173 for (index = 0; index < UD_HASH_SZ; index++, ih++) {
2174 ih->ih_head[0] = ih;
2175 ih->ih_head[1] = ih;
2176 }
2177 mutex_init(&ud_icache_lock, NULL, MUTEX_DEFAULT, NULL);
2178 mutex_init(&ud_nino_lock, NULL, MUTEX_DEFAULT, NULL);
2179
2180 udf_ifreeh = NULL;
2181 udf_ifreet = NULL;
2182 mutex_init(&udf_ifree_lock, NULL, MUTEX_DEFAULT, NULL);
2183
2184 mutex_init(&ud_sync_busy, NULL, MUTEX_DEFAULT, NULL);
2185 udf_vfs_instances = NULL;
2186 mutex_init(&udf_vfs_mutex, NULL, MUTEX_DEFAULT, NULL);
2187
2188 #ifndef __lint
2189 _NOTE(COMPETING_THREADS_NOW);
2190 #endif
2191 }
|
73 #include <vm/seg_vn.h>
74 #include <vm/rm.h>
75 #include <vm/page.h>
76 #include <sys/swap.h>
77
78
79 #include <fs/fs_subr.h>
80
81
82 #include <sys/fs/udf_volume.h>
83 #include <sys/fs/udf_inode.h>
84
85 extern struct vnodeops *udf_vnodeops;
86
87 kmutex_t ud_sync_busy;
88 /*
89 * udf_vfs list manipulation routines
90 */
91 kmutex_t udf_vfs_mutex;
92 struct udf_vfs *udf_vfs_instances;
93
94 union ihead ud_ihead[UD_HASH_SZ];
95 kmutex_t ud_icache_lock;
96
97 #define UD_BEGIN 0x0
98 #define UD_END 0x1
99 #define UD_UNKN 0x2
100 struct ud_inode *udf_ifreeh, *udf_ifreet;
101 kmutex_t udf_ifree_lock;
102
103 kmutex_t ud_nino_lock;
104 int32_t ud_max_inodes = 512;
105 int32_t ud_cur_inodes = 0;
106
107 uid_t ud_default_uid = 0;
108 gid_t ud_default_gid = 3;
109
110 int32_t ud_updat_ext4(struct ud_inode *, struct file_entry *);
111 int32_t ud_updat_ext4096(struct ud_inode *, struct file_entry *);
112 void ud_make_sad(struct icb_ext *, struct short_ad *, int32_t);
113 void ud_make_lad(struct icb_ext *, struct long_ad *, int32_t);
114 void ud_trunc_ext4(struct ud_inode *, u_offset_t);
115 void ud_trunc_ext4096(struct ud_inode *, u_offset_t);
116 void ud_add_to_free_list(struct ud_inode *, uint32_t);
117 void ud_remove_from_free_list(struct ud_inode *, uint32_t);
118
119
120 #ifdef DEBUG
121 struct ud_inode *
122 ud_search_icache(struct vfs *vfsp, uint16_t prn, uint32_t ploc)
123 {
124 int32_t hno;
125 union ihead *ih;
2140 udf_ifreeh->i_freeb = NULL;
2141 }
2142 } else {
2143 ip->i_freeb->i_freef = ip->i_freef;
2144 if (ip->i_freef) {
2145 ip->i_freef->i_freeb = ip->i_freeb;
2146 } else {
2147 udf_ifreet = ip->i_freeb;
2148 }
2149 }
2150 ip->i_freef = NULL;
2151 ip->i_freeb = NULL;
2152 }
2153
2154 void
2155 ud_init_inodes(void)
2156 {
2157 union ihead *ih = ud_ihead;
2158 int index;
2159
2160 for (index = 0; index < UD_HASH_SZ; index++, ih++) {
2161 ih->ih_head[0] = ih;
2162 ih->ih_head[1] = ih;
2163 }
2164 mutex_init(&ud_icache_lock, NULL, MUTEX_DEFAULT, NULL);
2165 mutex_init(&ud_nino_lock, NULL, MUTEX_DEFAULT, NULL);
2166
2167 udf_ifreeh = NULL;
2168 udf_ifreet = NULL;
2169 mutex_init(&udf_ifree_lock, NULL, MUTEX_DEFAULT, NULL);
2170
2171 mutex_init(&ud_sync_busy, NULL, MUTEX_DEFAULT, NULL);
2172 udf_vfs_instances = NULL;
2173 mutex_init(&udf_vfs_mutex, NULL, MUTEX_DEFAULT, NULL);
2174 }
|