Changeset View
Changeset View
Standalone View
Standalone View
sys/ufs/ufs/inode.h
Show First 20 Lines • Show All 132 Lines • ▼ Show 20 Lines | |||||
#define IN_TRUNCATED 0x0200 /* Journaled truncation pending. */ | #define IN_TRUNCATED 0x0200 /* Journaled truncation pending. */ | ||||
#define IN_UFS2 0x0400 /* UFS2 vs UFS1 */ | #define IN_UFS2 0x0400 /* UFS2 vs UFS1 */ | ||||
#define PRINT_INODE_FLAGS "\20\20b16\17b15\16b14\15b13" \ | #define PRINT_INODE_FLAGS "\20\20b16\17b15\16b14\15b13" \ | ||||
"\14b12\13is_ufs2\12truncated\11ea_lockwait\10ea_locked" \ | "\14b12\13is_ufs2\12truncated\11ea_lockwait\10ea_locked" \ | ||||
"\7lazyaccess\6lazymod\5needsync\4modified\3update\2change\1access" | "\7lazyaccess\6lazymod\5needsync\4modified\3update\2change\1access" | ||||
#define UFS_INODE_FLAG_DIRTY_MASK \ | |||||
(IN_ACCESS | IN_CHANGE | IN_MODIFIED | IN_UPDATE | IN_LAZYMOD | IN_LAZYACCESS) | |||||
#define UFS_INODE_SET_FLAG(ip, flags) do { \ | #define UFS_INODE_SET_FLAG(ip, flags) do { \ | ||||
struct inode *_ip = (ip); \ | struct inode *_ip = (ip); \ | ||||
struct vnode *_vp = ITOV(_ip); \ | |||||
int _flags = (flags); \ | int _flags = (flags); \ | ||||
\ | \ | ||||
_ip->i_flag |= _flags; \ | _ip->i_flag |= _flags; \ | ||||
if (_flags & UFS_INODE_FLAG_DIRTY_MASK) \ | |||||
vdirty(_vp); \ | |||||
} while (0) | |||||
#define UFS_INODE_SET_FLAG_SHARED(ip, flags) do { \ | |||||
jeff: This is big enough to want to be a function. | |||||
Done Inline ActionsI don't have a strong opinion, I see I wrote the macro a little bit poorly though. Note that passed flags are known at compilation time, so should the code be: if (_flags & UFS_INODE_FLAG_DIRTY_MASK) vdirty(_vp); the compiler can *always* elide the branch and either do nothing or insert a mandatory vdirty call. mjg: I don't have a strong opinion, I see I wrote the macro a little bit poorly though.
Note that… | |||||
struct inode *_ip = (ip); \ | |||||
struct vnode *_vp = ITOV(_ip); \ | |||||
int _flags = (flags); \ | |||||
\ | |||||
ASSERT_VI_UNLOCKED(_vp, __func__); \ | |||||
if ((_ip->i_flag & (_flags)) != _flags) { \ | |||||
VI_LOCK(_vp); \ | |||||
_ip->i_flag |= _flags; \ | |||||
if (_flags & UFS_INODE_FLAG_DIRTY_MASK) \ | |||||
vdirty(_vp); \ | |||||
VI_UNLOCK(_vp); \ | |||||
} \ | |||||
} while (0) | } while (0) | ||||
#define i_dirhash i_un.dirhash | #define i_dirhash i_un.dirhash | ||||
#define i_snapblklist i_un.snapblklist | #define i_snapblklist i_un.snapblklist | ||||
#define i_din1 dinode_u.din1 | #define i_din1 dinode_u.din1 | ||||
#define i_din2 dinode_u.din2 | #define i_din2 dinode_u.din2 | ||||
#ifdef _KERNEL | #ifdef _KERNEL | ||||
▲ Show 20 Lines • Show All 67 Lines • Show Last 20 Lines |
This is big enough to want to be a function.