Changeset View
Changeset View
Standalone View
Standalone View
sys/contrib/openzfs/module/os/linux/zfs/zfs_znode.c
Show First 20 Lines • Show All 473 Lines • ▼ Show 20 Lines | #else | ||||
if (zp->z_pflags & ZFS_APPENDONLY) | if (zp->z_pflags & ZFS_APPENDONLY) | ||||
ip->i_flags |= S_APPEND; | ip->i_flags |= S_APPEND; | ||||
else | else | ||||
ip->i_flags &= ~S_APPEND; | ip->i_flags &= ~S_APPEND; | ||||
#endif | #endif | ||||
} | } | ||||
/* | /* | ||||
* Update the embedded inode given the znode. We should work toward | * Update the embedded inode given the znode. | ||||
* eliminating this function as soon as possible by removing values | |||||
* which are duplicated between the znode and inode. If the generic | |||||
* inode has the correct field it should be used, and the ZFS code | |||||
* updated to access the inode. This can be done incrementally. | |||||
*/ | */ | ||||
void | void | ||||
zfs_inode_update(znode_t *zp) | zfs_znode_update_vfs(znode_t *zp) | ||||
{ | { | ||||
zfsvfs_t *zfsvfs; | zfsvfs_t *zfsvfs; | ||||
struct inode *ip; | struct inode *ip; | ||||
uint32_t blksize; | uint32_t blksize; | ||||
u_longlong_t i_blocks; | u_longlong_t i_blocks; | ||||
ASSERT(zp != NULL); | ASSERT(zp != NULL); | ||||
zfsvfs = ZTOZSB(zp); | zfsvfs = ZTOZSB(zp); | ||||
▲ Show 20 Lines • Show All 99 Lines • ▼ Show 20 Lines | zfs_znode_alloc(zfsvfs_t *zfsvfs, dmu_buf_t *db, int blksz, | ||||
if (zp->z_pflags & ZFS_XATTR) | if (zp->z_pflags & ZFS_XATTR) | ||||
zp->z_xattr_parent = parent; | zp->z_xattr_parent = parent; | ||||
ZFS_TIME_DECODE(&ip->i_atime, atime); | ZFS_TIME_DECODE(&ip->i_atime, atime); | ||||
ZFS_TIME_DECODE(&ip->i_mtime, mtime); | ZFS_TIME_DECODE(&ip->i_mtime, mtime); | ||||
ZFS_TIME_DECODE(&ip->i_ctime, ctime); | ZFS_TIME_DECODE(&ip->i_ctime, ctime); | ||||
ip->i_ino = zp->z_id; | ip->i_ino = zp->z_id; | ||||
zfs_inode_update(zp); | zfs_znode_update_vfs(zp); | ||||
zfs_inode_set_ops(zfsvfs, ip); | zfs_inode_set_ops(zfsvfs, ip); | ||||
/* | /* | ||||
* The only way insert_inode_locked() can fail is if the ip->i_ino | * The only way insert_inode_locked() can fail is if the ip->i_ino | ||||
* number is already hashed for this super block. This can never | * number is already hashed for this super block. This can never | ||||
* happen because the inode numbers map 1:1 with the object numbers. | * happen because the inode numbers map 1:1 with the object numbers. | ||||
* | * | ||||
* The one exception is rolling back a mounted file system, but in | * The one exception is rolling back a mounted file system, but in | ||||
▲ Show 20 Lines • Show All 659 Lines • ▼ Show 20 Lines | if ((uint32_t)gen != ZTOI(zp)->i_generation) { | ||||
return (SET_ERROR(EIO)); | return (SET_ERROR(EIO)); | ||||
} | } | ||||
set_nlink(ZTOI(zp), (uint32_t)links); | set_nlink(ZTOI(zp), (uint32_t)links); | ||||
zfs_set_inode_flags(zp, ZTOI(zp)); | zfs_set_inode_flags(zp, ZTOI(zp)); | ||||
zp->z_blksz = doi.doi_data_block_size; | zp->z_blksz = doi.doi_data_block_size; | ||||
zp->z_atime_dirty = B_FALSE; | zp->z_atime_dirty = B_FALSE; | ||||
zfs_inode_update(zp); | zfs_znode_update_vfs(zp); | ||||
/* | /* | ||||
* If the file has zero links, then it has been unlinked on the send | * If the file has zero links, then it has been unlinked on the send | ||||
* side and it must be in the received unlinked set. | * side and it must be in the received unlinked set. | ||||
* We call zfs_znode_dmu_fini() now to prevent any accesses to the | * We call zfs_znode_dmu_fini() now to prevent any accesses to the | ||||
* stale data and to prevent automatic removal of the file in | * stale data and to prevent automatic removal of the file in | ||||
* zfs_zinactive(). The file will be removed either when it is removed | * zfs_zinactive(). The file will be removed either when it is removed | ||||
* on the send side and the next incremental stream is received or | * on the send side and the next incremental stream is received or | ||||
▲ Show 20 Lines • Show All 501 Lines • ▼ Show 20 Lines | log: | ||||
zfs_tstamp_update_setup(zp, CONTENT_MODIFIED, mtime, ctime); | zfs_tstamp_update_setup(zp, CONTENT_MODIFIED, mtime, ctime); | ||||
error = sa_bulk_update(zp->z_sa_hdl, bulk, count, tx); | error = sa_bulk_update(zp->z_sa_hdl, bulk, count, tx); | ||||
ASSERT(error == 0); | ASSERT(error == 0); | ||||
zfs_log_truncate(zilog, tx, TX_TRUNCATE, zp, off, len); | zfs_log_truncate(zilog, tx, TX_TRUNCATE, zp, off, len); | ||||
dmu_tx_commit(tx); | dmu_tx_commit(tx); | ||||
zfs_inode_update(zp); | zfs_znode_update_vfs(zp); | ||||
error = 0; | error = 0; | ||||
out: | out: | ||||
/* | /* | ||||
* Truncate the page cache - for file truncate operations, use | * Truncate the page cache - for file truncate operations, use | ||||
* the purpose-built API for truncations. For punching operations, | * the purpose-built API for truncations. For punching operations, | ||||
* the truncation is handled under a range lock in zfs_free_range. | * the truncation is handled under a range lock in zfs_free_range. | ||||
*/ | */ | ||||
▲ Show 20 Lines • Show All 314 Lines • ▼ Show 20 Lines | zfs_obj_to_path_impl(objset_t *osp, uint64_t obj, sa_handle_t *hdl, | ||||
error = 0; | error = 0; | ||||
for (;;) { | for (;;) { | ||||
uint64_t pobj = 0; | uint64_t pobj = 0; | ||||
char component[MAXNAMELEN + 2]; | char component[MAXNAMELEN + 2]; | ||||
size_t complen; | size_t complen; | ||||
int is_xattrdir = 0; | int is_xattrdir = 0; | ||||
if (prevdb) | if (prevdb) { | ||||
ASSERT(prevhdl != NULL); | |||||
zfs_release_sa_handle(prevhdl, prevdb, FTAG); | zfs_release_sa_handle(prevhdl, prevdb, FTAG); | ||||
} | |||||
if ((error = zfs_obj_to_pobj(osp, sa_hdl, sa_table, &pobj, | if ((error = zfs_obj_to_pobj(osp, sa_hdl, sa_table, &pobj, | ||||
&is_xattrdir)) != 0) | &is_xattrdir)) != 0) | ||||
break; | break; | ||||
if (pobj == obj) { | if (pobj == obj) { | ||||
if (path[0] != '/') | if (path[0] != '/') | ||||
*--path = '/'; | *--path = '/'; | ||||
▲ Show 20 Lines • Show All 107 Lines • Show Last 20 Lines |