zfs_znode.h (248571) | zfs_znode.h (251631) |
---|---|
1/* 2 * CDDL HEADER START 3 * 4 * The contents of this file are subject to the terms of the 5 * Common Development and Distribution License (the "License"). 6 * You may not use this file except in compliance with the License. 7 * 8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE --- 121 unchanged lines hidden (view full) --- 130#define ZFS_ROOT_OBJ "ROOT" 131#define ZPL_VERSION_STR "VERSION" 132#define ZFS_FUID_TABLES "FUID" 133#define ZFS_SHARES_DIR "SHARES" 134#define ZFS_SA_ATTRS "SA_ATTRS" 135 136#define ZFS_MAX_BLOCKSIZE (SPA_MAXBLOCKSIZE) 137 | 1/* 2 * CDDL HEADER START 3 * 4 * The contents of this file are subject to the terms of the 5 * Common Development and Distribution License (the "License"). 6 * You may not use this file except in compliance with the License. 7 * 8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE --- 121 unchanged lines hidden (view full) --- 130#define ZFS_ROOT_OBJ "ROOT" 131#define ZPL_VERSION_STR "VERSION" 132#define ZFS_FUID_TABLES "FUID" 133#define ZFS_SHARES_DIR "SHARES" 134#define ZFS_SA_ATTRS "SA_ATTRS" 135 136#define ZFS_MAX_BLOCKSIZE (SPA_MAXBLOCKSIZE) 137 |
138/* Path component length */ | |
139/* | 138/* |
139 * Path component length 140 * |
|
140 * The generic fs code uses MAXNAMELEN to represent 141 * what the largest component length is. Unfortunately, 142 * this length includes the terminating NULL. ZFS needs 143 * to tell the users via pathconf() and statvfs() what the 144 * true maximum length of a component is, excluding the NULL. 145 */ 146#define ZFS_MAXNAMELEN (MAXNAMELEN - 1) 147 --- 99 unchanged lines hidden (view full) --- 247 ASSERT(zp == NULL || zp->z_vnode == NULL || zp->z_vnode == vp); 248 return (zp); 249} 250#else 251#define ZTOV(ZP) ((ZP)->z_vnode) 252#define VTOZ(VP) ((znode_t *)(VP)->v_data) 253#endif 254 | 141 * The generic fs code uses MAXNAMELEN to represent 142 * what the largest component length is. Unfortunately, 143 * this length includes the terminating NULL. ZFS needs 144 * to tell the users via pathconf() and statvfs() what the 145 * true maximum length of a component is, excluding the NULL. 146 */ 147#define ZFS_MAXNAMELEN (MAXNAMELEN - 1) 148 --- 99 unchanged lines hidden (view full) --- 248 ASSERT(zp == NULL || zp->z_vnode == NULL || zp->z_vnode == vp); 249 return (zp); 250} 251#else 252#define ZTOV(ZP) ((ZP)->z_vnode) 253#define VTOZ(VP) ((znode_t *)(VP)->v_data) 254#endif 255 |
255/* 256 * ZFS_ENTER() is called on entry to each ZFS vnode and vfs operation. 257 * ZFS_ENTER_NOERROR() is called when we can't return EIO. 258 * ZFS_EXIT() must be called before exitting the vop. 259 * ZFS_VERIFY_ZP() verifies the znode is valid. 260 */ | 256/* Called on entry to each ZFS vnode and vfs operation */ |
261#define ZFS_ENTER(zfsvfs) \ 262 { \ 263 rrw_enter_read(&(zfsvfs)->z_teardown_lock, FTAG); \ 264 if ((zfsvfs)->z_unmounted) { \ 265 ZFS_EXIT(zfsvfs); \ 266 return (EIO); \ 267 } \ 268 } 269 | 257#define ZFS_ENTER(zfsvfs) \ 258 { \ 259 rrw_enter_read(&(zfsvfs)->z_teardown_lock, FTAG); \ 260 if ((zfsvfs)->z_unmounted) { \ 261 ZFS_EXIT(zfsvfs); \ 262 return (EIO); \ 263 } \ 264 } 265 |
266/* Called on entry to each ZFS vnode and vfs operation that can not return EIO */ |
|
270#define ZFS_ENTER_NOERROR(zfsvfs) \ 271 rrw_enter(&(zfsvfs)->z_teardown_lock, RW_READER, FTAG) 272 | 267#define ZFS_ENTER_NOERROR(zfsvfs) \ 268 rrw_enter(&(zfsvfs)->z_teardown_lock, RW_READER, FTAG) 269 |
270/* Must be called before exiting the vop */ |
|
273#define ZFS_EXIT(zfsvfs) rrw_exit(&(zfsvfs)->z_teardown_lock, FTAG) 274 | 271#define ZFS_EXIT(zfsvfs) rrw_exit(&(zfsvfs)->z_teardown_lock, FTAG) 272 |
273/* Verifies the znode is valid */ |
|
275#define ZFS_VERIFY_ZP(zp) \ 276 if ((zp)->z_sa_hdl == NULL) { \ 277 ZFS_EXIT((zp)->z_zfsvfs); \ 278 return (EIO); \ 279 } \ 280 281/* 282 * Macros for dealing with dmu_buf_hold 283 */ 284#define ZFS_OBJ_HASH(obj_num) ((obj_num) & (ZFS_OBJ_MTX_SZ - 1)) 285#define ZFS_OBJ_MUTEX(zfsvfs, obj_num) \ 286 (&(zfsvfs)->z_hold_mtx[ZFS_OBJ_HASH(obj_num)]) 287#define ZFS_OBJ_HOLD_ENTER(zfsvfs, obj_num) \ 288 mutex_enter(ZFS_OBJ_MUTEX((zfsvfs), (obj_num))) 289#define ZFS_OBJ_HOLD_TRYENTER(zfsvfs, obj_num) \ 290 mutex_tryenter(ZFS_OBJ_MUTEX((zfsvfs), (obj_num))) 291#define ZFS_OBJ_HOLD_EXIT(zfsvfs, obj_num) \ 292 mutex_exit(ZFS_OBJ_MUTEX((zfsvfs), (obj_num))) 293 | 274#define ZFS_VERIFY_ZP(zp) \ 275 if ((zp)->z_sa_hdl == NULL) { \ 276 ZFS_EXIT((zp)->z_zfsvfs); \ 277 return (EIO); \ 278 } \ 279 280/* 281 * Macros for dealing with dmu_buf_hold 282 */ 283#define ZFS_OBJ_HASH(obj_num) ((obj_num) & (ZFS_OBJ_MTX_SZ - 1)) 284#define ZFS_OBJ_MUTEX(zfsvfs, obj_num) \ 285 (&(zfsvfs)->z_hold_mtx[ZFS_OBJ_HASH(obj_num)]) 286#define ZFS_OBJ_HOLD_ENTER(zfsvfs, obj_num) \ 287 mutex_enter(ZFS_OBJ_MUTEX((zfsvfs), (obj_num))) 288#define ZFS_OBJ_HOLD_TRYENTER(zfsvfs, obj_num) \ 289 mutex_tryenter(ZFS_OBJ_MUTEX((zfsvfs), (obj_num))) 290#define ZFS_OBJ_HOLD_EXIT(zfsvfs, obj_num) \ 291 mutex_exit(ZFS_OBJ_MUTEX((zfsvfs), (obj_num))) 292 |
294/* 295 * Macros to encode/decode ZFS stored time values from/to struct timespec 296 */ | 293/* Encode ZFS stored time values from a struct timespec */ |
297#define ZFS_TIME_ENCODE(tp, stmp) \ 298{ \ 299 (stmp)[0] = (uint64_t)(tp)->tv_sec; \ 300 (stmp)[1] = (uint64_t)(tp)->tv_nsec; \ 301} 302 | 294#define ZFS_TIME_ENCODE(tp, stmp) \ 295{ \ 296 (stmp)[0] = (uint64_t)(tp)->tv_sec; \ 297 (stmp)[1] = (uint64_t)(tp)->tv_nsec; \ 298} 299 |
300/* Decode ZFS stored time values to a struct timespec */ |
|
303#define ZFS_TIME_DECODE(tp, stmp) \ 304{ \ 305 (tp)->tv_sec = (time_t)(stmp)[0]; \ 306 (tp)->tv_nsec = (long)(stmp)[1]; \ 307} 308 309/* 310 * Timestamp defines --- 72 unchanged lines hidden --- | 301#define ZFS_TIME_DECODE(tp, stmp) \ 302{ \ 303 (tp)->tv_sec = (time_t)(stmp)[0]; \ 304 (tp)->tv_nsec = (long)(stmp)[1]; \ 305} 306 307/* 308 * Timestamp defines --- 72 unchanged lines hidden --- |