您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ zil_itx_assign函数代码示例

51自学网 2021-06-03 11:59:46
  C++
这篇教程C++ zil_itx_assign函数代码示例写得很实用,希望能帮到您。

本文整理汇总了C++中zil_itx_assign函数的典型用法代码示例。如果您正苦于以下问题:C++ zil_itx_assign函数的具体用法?C++ zil_itx_assign怎么用?C++ zil_itx_assign使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。

在下文中一共展示了zil_itx_assign函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: zfs_log_symlink

/* * Handles TX_SYMLINK transactions. */voidzfs_log_symlink(zilog_t *zilog, dmu_tx_t *tx, uint64_t txtype,    znode_t *dzp, znode_t *zp, char *name, char *link){	itx_t *itx;	lr_create_t *lr;	size_t namesize = strlen(name) + 1;	size_t linksize = strlen(link) + 1;	if (zil_replaying(zilog, tx))		return;	itx = zil_itx_create(txtype, sizeof (*lr) + namesize + linksize);	lr = (lr_create_t *)&itx->itx_lr;	lr->lr_doid = dzp->z_id;	lr->lr_foid = zp->z_id;	lr->lr_uid = zp->z_uid;	lr->lr_gid = zp->z_gid;	lr->lr_mode = zp->z_mode;	(void) sa_lookup(zp->z_sa_hdl, SA_ZPL_GEN(ZTOZSB(zp)), &lr->lr_gen,	    sizeof (uint64_t));	(void) sa_lookup(zp->z_sa_hdl, SA_ZPL_CRTIME(ZTOZSB(zp)),	    lr->lr_crtime, sizeof (uint64_t) * 2);	bcopy(name, (char *)(lr + 1), namesize);	bcopy(link, (char *)(lr + 1) + namesize, linksize);	zil_itx_assign(zilog, itx, tx);}
开发者ID:Acidburn0zzz,项目名称:zfs,代码行数:31,


示例2: zfs_log_create

/* * zfs_log_create() is used to handle TX_CREATE, TX_MKDIR and TX_MKXATTR * transactions. */voidzfs_log_create(zilog_t *zilog, dmu_tx_t *tx, int txtype,	znode_t *dzp, znode_t *zp, char *name){	itx_t *itx;	uint64_t seq;	lr_create_t *lr;	size_t namesize = strlen(name) + 1;	if (zilog == NULL)		return;	itx = zil_itx_create(txtype, sizeof (*lr) + namesize);	lr = (lr_create_t *)&itx->itx_lr;	lr->lr_doid = dzp->z_id;	lr->lr_foid = zp->z_id;	lr->lr_mode = zp->z_phys->zp_mode;	lr->lr_uid = zp->z_phys->zp_uid;	lr->lr_gid = zp->z_phys->zp_gid;	lr->lr_gen = zp->z_phys->zp_gen;	lr->lr_crtime[0] = zp->z_phys->zp_crtime[0];	lr->lr_crtime[1] = zp->z_phys->zp_crtime[1];	lr->lr_rdev = zp->z_phys->zp_rdev;	bcopy(name, (char *)(lr + 1), namesize);	seq = zil_itx_assign(zilog, itx, tx);	dzp->z_last_itx = seq;	zp->z_last_itx = seq;}
开发者ID:roddi,项目名称:mac-zfs,代码行数:33,


示例3: zfs_log_rename

/* * zfs_log_rename() handles TX_RENAME transactions. */voidzfs_log_rename(zilog_t *zilog, dmu_tx_t *tx, int txtype,	znode_t *sdzp, char *sname, znode_t *tdzp, char *dname, znode_t *szp){	itx_t *itx;	uint64_t seq;	lr_rename_t *lr;	size_t snamesize = strlen(sname) + 1;	size_t dnamesize = strlen(dname) + 1;	if (zilog == NULL)		return;	itx = zil_itx_create(txtype, sizeof (*lr) + snamesize + dnamesize);	lr = (lr_rename_t *)&itx->itx_lr;	lr->lr_sdoid = sdzp->z_id;	lr->lr_tdoid = tdzp->z_id;	bcopy(sname, (char *)(lr + 1), snamesize);	bcopy(dname, (char *)(lr + 1) + snamesize, dnamesize);	seq = zil_itx_assign(zilog, itx, tx);	sdzp->z_last_itx = seq;	tdzp->z_last_itx = seq;	szp->z_last_itx = seq;}
开发者ID:roddi,项目名称:mac-zfs,代码行数:28,


示例4: zfs_log_symlink

/* * zfs_log_symlink() handles TX_SYMLINK transactions. */voidzfs_log_symlink(zilog_t *zilog, dmu_tx_t *tx, uint64_t txtype,                znode_t *dzp, znode_t *zp, char *name, char *link){    itx_t *itx;    uint64_t seq;    lr_create_t *lr;    size_t namesize = strlen(name) + 1;    size_t linksize = strlen(link) + 1;    if (zil_replaying(zilog, tx))        return;    itx = zil_itx_create(txtype, sizeof (*lr) + namesize + linksize);    lr = (lr_create_t *)&itx->itx_lr;    lr->lr_doid = dzp->z_id;    lr->lr_foid = zp->z_id;    lr->lr_mode = zp->z_phys->zp_mode;    lr->lr_uid = zp->z_phys->zp_uid;    lr->lr_gid = zp->z_phys->zp_gid;    lr->lr_gen = zp->z_phys->zp_gen;    lr->lr_crtime[0] = zp->z_phys->zp_crtime[0];    lr->lr_crtime[1] = zp->z_phys->zp_crtime[1];    bcopy(name, (char *)(lr + 1), namesize);    bcopy(link, (char *)(lr + 1) + namesize, linksize);    seq = zil_itx_assign(zilog, itx, tx);    dzp->z_last_itx = seq;    zp->z_last_itx = seq;}
开发者ID:pscedu,项目名称:slash2-stable,代码行数:33,


示例5: zfs_log_setattr

/* * Handles TX_SETATTR transactions. */voidzfs_log_setattr(zilog_t *zilog, dmu_tx_t *tx, int txtype,    znode_t *zp, vattr_t *vap, uint_t mask_applied, zfs_fuid_info_t *fuidp){	itx_t		*itx;	lr_setattr_t	*lr;	xvattr_t	*xvap = (xvattr_t *)vap;	size_t		recsize = sizeof (lr_setattr_t);	void		*start;	if (zil_replaying(zilog, tx) || zp->z_unlinked)		return;	/*	 * If XVATTR set, then log record size needs to allow	 * for lr_attr_t + xvattr mask, mapsize and create time	 * plus actual attribute values	 */	if (vap->va_mask & AT_XVATTR)		recsize = sizeof (*lr) + ZIL_XVAT_SIZE(xvap->xva_mapsize);	if (fuidp)		recsize += fuidp->z_domain_str_sz;	itx = zil_itx_create(txtype, recsize);	lr = (lr_setattr_t *)&itx->itx_lr;	lr->lr_foid = zp->z_id;	lr->lr_mask = (uint64_t)mask_applied;	lr->lr_mode = (uint64_t)vap->va_mode;	if ((mask_applied & AT_UID) && IS_EPHEMERAL(vap->va_uid))		lr->lr_uid = fuidp->z_fuid_owner;	else		lr->lr_uid = (uint64_t)vap->va_uid;	if ((mask_applied & AT_GID) && IS_EPHEMERAL(vap->va_gid))		lr->lr_gid = fuidp->z_fuid_group;	else		lr->lr_gid = (uint64_t)vap->va_gid;	lr->lr_size = (uint64_t)vap->va_size;	ZFS_TIME_ENCODE(&vap->va_atime, lr->lr_atime);	ZFS_TIME_ENCODE(&vap->va_mtime, lr->lr_mtime);	start = (lr_setattr_t *)(lr + 1);	if (vap->va_mask & AT_XVATTR) {		zfs_log_xvattr((lr_attr_t *)start, xvap);		start = (caddr_t)start + ZIL_XVAT_SIZE(xvap->xva_mapsize);	}	/*	 * Now stick on domain information if any on end	 */	if (fuidp)		(void) zfs_log_fuid_domains(fuidp, start);	itx->itx_sync = (zp->z_sync_cnt != 0);	zil_itx_assign(zilog, itx, tx);}
开发者ID:FreeBSDFoundation,项目名称:freebsd,代码行数:61,


示例6: zfs_log_truncate

/* * Handles TX_TRUNCATE transactions. */voidzfs_log_truncate(zilog_t *zilog, dmu_tx_t *tx, int txtype,    znode_t *zp, uint64_t off, uint64_t len){	itx_t *itx;	lr_truncate_t *lr;	if (zil_replaying(zilog, tx) || zp->z_unlinked)		return;	itx = zil_itx_create(txtype, sizeof (*lr));	lr = (lr_truncate_t *)&itx->itx_lr;	lr->lr_foid = zp->z_id;	lr->lr_offset = off;	lr->lr_length = len;	itx->itx_sync = (zp->z_sync_cnt != 0);	zil_itx_assign(zilog, itx, tx);}
开发者ID:FreeBSDFoundation,项目名称:freebsd,代码行数:22,


示例7: zfs_log_link

/* * Handles TX_LINK transactions. */voidzfs_log_link(zilog_t *zilog, dmu_tx_t *tx, uint64_t txtype,	znode_t *dzp, znode_t *zp, char *name){	itx_t *itx;	lr_link_t *lr;	size_t namesize = strlen(name) + 1;	if (zil_replaying(zilog, tx))		return;	itx = zil_itx_create(txtype, sizeof (*lr) + namesize);	lr = (lr_link_t *)&itx->itx_lr;	lr->lr_doid = dzp->z_id;	lr->lr_link_obj = zp->z_id;	bcopy(name, (char *)(lr + 1), namesize);	zil_itx_assign(zilog, itx, tx);}
开发者ID:Acidburn0zzz,项目名称:zfs,代码行数:22,


示例8: zvol_log_truncate

/* * Log a DKIOCFREE/free-long-range to the ZIL with TX_TRUNCATE. */static voidzvol_log_truncate(zvol_state_t *zv, dmu_tx_t *tx, uint64_t off, uint64_t len,    boolean_t sync){	itx_t *itx;	lr_truncate_t *lr;	zilog_t *zilog = zv->zv_zilog;	if (zil_replaying(zilog, tx))		return;	itx = zil_itx_create(TX_TRUNCATE, sizeof (*lr));	lr = (lr_truncate_t *)&itx->itx_lr;	lr->lr_foid = ZVOL_OBJ;	lr->lr_offset = off;	lr->lr_length = len;	itx->itx_sync = sync;	zil_itx_assign(zilog, itx, tx);}
开发者ID:alek-p,项目名称:zfs,代码行数:23,


示例9: zfs_log_remove

/* * Handles both TX_REMOVE and TX_RMDIR transactions. */voidzfs_log_remove(zilog_t *zilog, dmu_tx_t *tx, uint64_t txtype,    znode_t *dzp, char *name, uint64_t foid){	itx_t *itx;	lr_remove_t *lr;	size_t namesize = strlen(name) + 1;	if (zil_replaying(zilog, tx) || zfs_xattr_owner_unlinked(dzp))		return;	itx = zil_itx_create(txtype, sizeof (*lr) + namesize);	lr = (lr_remove_t *)&itx->itx_lr;	lr->lr_doid = dzp->z_id;	bcopy(name, (char *)(lr + 1), namesize);	itx->itx_oid = foid;	zil_itx_assign(zilog, itx, tx);}
开发者ID:LLNL,项目名称:zfs,代码行数:23,


示例10: zfs_log_remove

/* * zfs_log_remove() handles both TX_REMOVE and TX_RMDIR transactions. */voidzfs_log_remove(zilog_t *zilog, dmu_tx_t *tx, int txtype,	znode_t *dzp, char *name){	itx_t *itx;	uint64_t seq;	lr_remove_t *lr;	size_t namesize = strlen(name) + 1;	if (zilog == NULL)		return;	itx = zil_itx_create(txtype, sizeof (*lr) + namesize);	lr = (lr_remove_t *)&itx->itx_lr;	lr->lr_doid = dzp->z_id;	bcopy(name, (char *)(lr + 1), namesize);	seq = zil_itx_assign(zilog, itx, tx);	dzp->z_last_itx = seq;}
开发者ID:roddi,项目名称:mac-zfs,代码行数:23,


示例11: zfs_log_link

/* * zfs_log_link() handles TX_LINK transactions. */voidzfs_log_link(zilog_t *zilog, dmu_tx_t *tx, uint64_t txtype,             znode_t *dzp, znode_t *zp, char *name){    itx_t *itx;    uint64_t seq;    lr_link_t *lr;    size_t namesize = strlen(name) + 1;    if (zilog == NULL)        return;    ZFS_HANDLE_REPLAY(zilog, tx); /* exits if replay */    itx = zil_itx_create(txtype, sizeof (*lr) + namesize);    lr = (lr_link_t *)&itx->itx_lr;    lr->lr_doid = dzp->z_id;    lr->lr_link_obj = zp->z_id;    bcopy(name, (char *)(lr + 1), namesize);    seq = zil_itx_assign(zilog, itx, tx);    dzp->z_last_itx = seq;    zp->z_last_itx = seq;}
开发者ID:harshada,项目名称:zfs,代码行数:27,


示例12: zvol_log_write

static voidzvol_log_write(zvol_state_t *zv, dmu_tx_t *tx, uint64_t offset,    uint64_t size, int sync){	uint32_t blocksize = zv->zv_volblocksize;	zilog_t *zilog = zv->zv_zilog;	boolean_t slogging;	ssize_t immediate_write_sz;	if (zil_replaying(zilog, tx))		return;	immediate_write_sz = (zilog->zl_logbias == ZFS_LOGBIAS_THROUGHPUT)		? 0 : zvol_immediate_write_sz;	slogging = spa_has_slogs(zilog->zl_spa) &&		(zilog->zl_logbias == ZFS_LOGBIAS_LATENCY);	while (size) {		itx_t *itx;		lr_write_t *lr;		ssize_t len;		itx_wr_state_t write_state;		/*		 * Unlike zfs_log_write() we can be called with		 * up to DMU_MAX_ACCESS/2 (5MB) writes.		 */		if (blocksize > immediate_write_sz && !slogging &&		    size >= blocksize && offset % blocksize == 0) {			write_state = WR_INDIRECT; /* uses dmu_sync */			len = blocksize;		} else if (sync) {			write_state = WR_COPIED;			len = MIN(ZIL_MAX_LOG_DATA, size);		} else {			write_state = WR_NEED_COPY;			len = MIN(ZIL_MAX_LOG_DATA, size);		}		itx = zil_itx_create(TX_WRITE, sizeof (*lr) +		    (write_state == WR_COPIED ? len : 0));		lr = (lr_write_t *)&itx->itx_lr;		if (write_state == WR_COPIED && dmu_read(zv->zv_objset,		    ZVOL_OBJ, offset, len, lr+1, DMU_READ_NO_PREFETCH) != 0) {			zil_itx_destroy(itx);			itx = zil_itx_create(TX_WRITE, sizeof (*lr));			lr = (lr_write_t *)&itx->itx_lr;			write_state = WR_NEED_COPY;		}		itx->itx_wr_state = write_state;		if (write_state == WR_NEED_COPY)			itx->itx_sod += len;		lr->lr_foid = ZVOL_OBJ;		lr->lr_offset = offset;		lr->lr_length = len;		lr->lr_blkoff = 0;		BP_ZERO(&lr->lr_blkptr);		itx->itx_private = zv;		itx->itx_sync = sync;		(void) zil_itx_assign(zilog, itx, tx);		offset += len;		size -= len;	}}
开发者ID:alek-p,项目名称:zfs,代码行数:68,


示例13: zfs_log_acl

/* * Handles TX_ACL transactions. */voidzfs_log_acl(zilog_t *zilog, dmu_tx_t *tx, znode_t *zp,    vsecattr_t *vsecp, zfs_fuid_info_t *fuidp){	itx_t *itx;	lr_acl_v0_t *lrv0;	lr_acl_t *lr;	int txtype;	int lrsize;	size_t txsize;	size_t aclbytes = vsecp->vsa_aclentsz;	if (zil_replaying(zilog, tx) || zp->z_unlinked)		return;	txtype = (zp->z_zfsvfs->z_version < ZPL_VERSION_FUID) ?	    TX_ACL_V0 : TX_ACL;	if (txtype == TX_ACL)		lrsize = sizeof (*lr);	else		lrsize = sizeof (*lrv0);	txsize = lrsize +	    ((txtype == TX_ACL) ? ZIL_ACE_LENGTH(aclbytes) : aclbytes) +	    (fuidp ? fuidp->z_domain_str_sz : 0) +	    sizeof (uint64_t) * (fuidp ? fuidp->z_fuid_cnt : 0);	itx = zil_itx_create(txtype, txsize);	lr = (lr_acl_t *)&itx->itx_lr;	lr->lr_foid = zp->z_id;	if (txtype == TX_ACL) {		lr->lr_acl_bytes = aclbytes;		lr->lr_domcnt = fuidp ? fuidp->z_domain_cnt : 0;		lr->lr_fuidcnt = fuidp ? fuidp->z_fuid_cnt : 0;		if (vsecp->vsa_mask & VSA_ACE_ACLFLAGS)			lr->lr_acl_flags = (uint64_t)vsecp->vsa_aclflags;		else			lr->lr_acl_flags = 0;	}	lr->lr_aclcnt = (uint64_t)vsecp->vsa_aclcnt;	if (txtype == TX_ACL_V0) {		lrv0 = (lr_acl_v0_t *)lr;		bcopy(vsecp->vsa_aclentp, (ace_t *)(lrv0 + 1), aclbytes);	} else {		void *start = (ace_t *)(lr + 1);		bcopy(vsecp->vsa_aclentp, start, aclbytes);		start = (caddr_t)start + ZIL_ACE_LENGTH(aclbytes);		if (fuidp) {			start = zfs_log_fuid_ids(fuidp, start);			(void) zfs_log_fuid_domains(fuidp, start);		}	}	itx->itx_sync = (zp->z_sync_cnt != 0);	zil_itx_assign(zilog, itx, tx);}
开发者ID:FreeBSDFoundation,项目名称:freebsd,代码行数:65,


示例14: zfs_log_write

voidzfs_log_write(zilog_t *zilog, dmu_tx_t *tx, int txtype,	znode_t *zp, offset_t off, ssize_t resid, int ioflag){	itx_wr_state_t write_state;	boolean_t slogging;	uintptr_t fsync_cnt;	if (zilog == NULL || zp->z_unlinked)		return;	/*	 * Writes are handled in three different ways:	 *	 * WR_INDIRECT:	 *    If the write is greater than zfs_immediate_write_sz and there are	 *    no separate logs in this pool then later *if* we need to log the	 *    write then dmu_sync() is used to immediately write the block and	 *    its block pointer is put in the log record.	 * WR_COPIED:	 *    If we know we'll immediately be committing the	 *    transaction (FDSYNC (O_DSYNC)), the we allocate a larger	 *    log record here for the data and copy the data in.	 * WR_NEED_COPY:	 *    Otherwise we don't allocate a buffer, and *if* we need to	 *    flush the write later then a buffer is allocated and	 *    we retrieve the data using the dmu.	 */	slogging = spa_has_slogs(zilog->zl_spa);	if (resid > zfs_immediate_write_sz && !slogging)		write_state = WR_INDIRECT;	else if (ioflag & FDSYNC)		write_state = WR_COPIED;	else		write_state = WR_NEED_COPY;#ifndef __APPLE__	if ((fsync_cnt = (uintptr_t)tsd_get(zfs_fsyncer_key)) != 0) {		(void) tsd_set(zfs_fsyncer_key, (void *)(fsync_cnt - 1));	}#endif	while (resid) {		itx_t *itx;		lr_write_t *lr;		ssize_t len;		/*		 * If there are slogs and the write would overflow the largest		 * block, then because we don't want to use the main pool		 * to dmu_sync, we have to split the write.		 */		if (slogging && resid > ZIL_MAX_LOG_DATA)			len = SPA_MAXBLOCKSIZE >> 1;		else			len = resid;		itx = zil_itx_create(txtype, sizeof (*lr) +		    (write_state == WR_COPIED ? len : 0));		lr = (lr_write_t *)&itx->itx_lr;		if (write_state == WR_COPIED && dmu_read(zp->z_zfsvfs->z_os,		    zp->z_id, off, len, lr + 1) != 0) {			kmem_free(itx, offsetof(itx_t, itx_lr) +			    itx->itx_lr.lrc_reclen);			itx = zil_itx_create(txtype, sizeof (*lr));			lr = (lr_write_t *)&itx->itx_lr;			write_state = WR_NEED_COPY;		}		itx->itx_wr_state = write_state;		lr->lr_foid = zp->z_id;		lr->lr_offset = off;		lr->lr_length = len;		lr->lr_blkoff = 0;		BP_ZERO(&lr->lr_blkptr);		itx->itx_private = zp->z_zfsvfs;		if ((zp->z_sync_cnt != 0) || (fsync_cnt != 0))			itx->itx_sync = B_TRUE;		else			itx->itx_sync = B_FALSE;		zp->z_last_itx = zil_itx_assign(zilog, itx, tx);		off += len;		resid -= len;	}
开发者ID:roddi,项目名称:mac-zfs,代码行数:86,


示例15: zfs_log_write

voidzfs_log_write(zilog_t *zilog, dmu_tx_t *tx, int txtype,              znode_t *zp, offset_t off, ssize_t resid, int ioflag){    itx_wr_state_t write_state;    boolean_t slogging;    uintptr_t fsync_cnt;    if (zilog == NULL || zp->z_unlinked)        return;    ZFS_HANDLE_REPLAY(zilog, tx); /* exits if replay */    slogging = spa_has_slogs(zilog->zl_spa);    if (resid > zfs_immediate_write_sz && !slogging && resid <= zp->z_blksz)        write_state = WR_INDIRECT;    else if (ioflag & (FSYNC | FDSYNC))        write_state = WR_COPIED;    else        write_state = WR_NEED_COPY;    if ((fsync_cnt = (uintptr_t)tsd_get(zfs_fsyncer_key)) != 0) {        (void) tsd_set(zfs_fsyncer_key, (void *)(fsync_cnt - 1));    }    while (resid) {        itx_t *itx;        lr_write_t *lr;        ssize_t len;        /*         * If the write would overflow the largest block then split it.         */        if (write_state != WR_INDIRECT && resid > ZIL_MAX_LOG_DATA)            len = SPA_MAXBLOCKSIZE >> 1;        else            len = resid;        itx = zil_itx_create(txtype, sizeof (*lr) +                             (write_state == WR_COPIED ? len : 0));        lr = (lr_write_t *)&itx->itx_lr;        if (write_state == WR_COPIED && dmu_read(zp->z_zfsvfs->z_os,                zp->z_id, off, len, lr + 1, DMU_READ_NO_PREFETCH) != 0) {            kmem_free(itx, offsetof(itx_t, itx_lr) +                      itx->itx_lr.lrc_reclen);            itx = zil_itx_create(txtype, sizeof (*lr));            lr = (lr_write_t *)&itx->itx_lr;            write_state = WR_NEED_COPY;        }        itx->itx_wr_state = write_state;        if (write_state == WR_NEED_COPY)            itx->itx_sod += len;        lr->lr_foid = zp->z_id;        lr->lr_offset = off;        lr->lr_length = len;        lr->lr_blkoff = 0;        BP_ZERO(&lr->lr_blkptr);        itx->itx_private = zp->z_zfsvfs;        if ((zp->z_sync_cnt != 0) || (fsync_cnt != 0) ||                (ioflag & (FSYNC | FDSYNC)))            itx->itx_sync = B_TRUE;        else            itx->itx_sync = B_FALSE;        zp->z_last_itx = zil_itx_assign(zilog, itx, tx);        off += len;        resid -= len;    }
开发者ID:harshada,项目名称:zfs,代码行数:72,


示例16: zfs_log_create

//.........这里部分代码省略.........	size_t aclsize = 0;	size_t xvatsize = 0;	size_t txsize;	xvattr_t *xvap = (xvattr_t *)vap;	void *end;	size_t lrsize;	size_t namesize = strlen(name) + 1;	size_t fuidsz = 0;	if (zil_replaying(zilog, tx))		return;	/*	 * If we have FUIDs present then add in space for	 * domains and ACE fuid's if any.	 */	if (fuidp) {		fuidsz += fuidp->z_domain_str_sz;		fuidsz += fuidp->z_fuid_cnt * sizeof (uint64_t);	}	if (vap->va_mask & ATTR_XVATTR)		xvatsize = ZIL_XVAT_SIZE(xvap->xva_mapsize);	if ((int)txtype == TX_CREATE_ATTR || (int)txtype == TX_MKDIR_ATTR ||	    (int)txtype == TX_CREATE || (int)txtype == TX_MKDIR ||	    (int)txtype == TX_MKXATTR) {		txsize = sizeof (*lr) + namesize + fuidsz + xvatsize;		lrsize = sizeof (*lr);	} else {		txsize =		    sizeof (lr_acl_create_t) + namesize + fuidsz +		    ZIL_ACE_LENGTH(aclsize) + xvatsize;		lrsize = sizeof (lr_acl_create_t);	}	itx = zil_itx_create(txtype, txsize);	lr = (lr_create_t *)&itx->itx_lr;	lr->lr_doid = dzp->z_id;	lr->lr_foid = zp->z_id;	lr->lr_mode = zp->z_mode;	if (!IS_EPHEMERAL(zp->z_uid)) {		lr->lr_uid = (uint64_t)zp->z_uid;	} else {		lr->lr_uid = fuidp->z_fuid_owner;	}	if (!IS_EPHEMERAL(zp->z_gid)) {		lr->lr_gid = (uint64_t)zp->z_gid;	} else {		lr->lr_gid = fuidp->z_fuid_group;	}	(void) sa_lookup(zp->z_sa_hdl, SA_ZPL_GEN(ZTOZSB(zp)), &lr->lr_gen,	    sizeof (uint64_t));	(void) sa_lookup(zp->z_sa_hdl, SA_ZPL_CRTIME(ZTOZSB(zp)),	    lr->lr_crtime, sizeof (uint64_t) * 2);	if (sa_lookup(zp->z_sa_hdl, SA_ZPL_RDEV(ZTOZSB(zp)), &lr->lr_rdev,	    sizeof (lr->lr_rdev)) != 0)		lr->lr_rdev = 0;	/*	 * Fill in xvattr info if any	 */	if (vap->va_mask & ATTR_XVATTR) {		zfs_log_xvattr((lr_attr_t *)((caddr_t)lr + lrsize), xvap);		end = (caddr_t)lr + lrsize + xvatsize;	} else {		end = (caddr_t)lr + lrsize;	}	/* Now fill in any ACL info */	if (vsecp) {		lracl = (lr_acl_create_t *)&itx->itx_lr;		lracl->lr_aclcnt = vsecp->vsa_aclcnt;		lracl->lr_acl_bytes = aclsize;		lracl->lr_domcnt = fuidp ? fuidp->z_domain_cnt : 0;		lracl->lr_fuidcnt  = fuidp ? fuidp->z_fuid_cnt : 0;		if (vsecp->vsa_aclflags & VSA_ACE_ACLFLAGS)			lracl->lr_acl_flags = (uint64_t)vsecp->vsa_aclflags;		else			lracl->lr_acl_flags = 0;		bcopy(vsecp->vsa_aclentp, end, aclsize);		end = (caddr_t)end + ZIL_ACE_LENGTH(aclsize);	}	/* drop in FUID info */	if (fuidp) {		end = zfs_log_fuid_ids(fuidp, end);		end = zfs_log_fuid_domains(fuidp, end);	}	/*	 * Now place file name in log record	 */	bcopy(name, end, namesize);	zil_itx_assign(zilog, itx, tx);}
开发者ID:Acidburn0zzz,项目名称:zfs,代码行数:101,


示例17: zvol_log_write

intzvol_log_write(zvol_state_t *zv, dmu_tx_t *tx, offset_t off, ssize_t len,    char *addr){	dmu_object_info_t doi;	ssize_t nbytes;	itx_t *itx;	lr_write_t *lr;	objset_t *os;	dmu_buf_t *db;	uint64_t txg;	uint64_t boff;	int error;	uint32_t blocksize;	/* handle common case */	if (len <= zvol_immediate_write_sz) {		itx = zvol_immediate_itx(off, len, addr);		(void) zil_itx_assign(zv->zv_zilog, itx, tx);		return (0);	}	txg = dmu_tx_get_txg(tx);	os = zv->zv_objset;	/*	 * We need to dmu_sync() each block in the range.	 * For this we need the blocksize.	 */	error = dmu_object_info(os, ZVOL_OBJ, &doi);	if (error)		return (error);	blocksize = doi.doi_data_block_size;	/*	 * We need to immediate write or dmu_sync() each block in the range.	 */	while (len) {		nbytes = MIN(len, blocksize - P2PHASE(off, blocksize));		if (nbytes <= zvol_immediate_write_sz) {			itx = zvol_immediate_itx(off, nbytes, addr);		} else {			boff =  P2ALIGN_TYPED(off, blocksize, uint64_t);			itx = zil_itx_create(TX_WRITE, sizeof (*lr));			lr = (lr_write_t *)&itx->itx_lr;			lr->lr_foid = ZVOL_OBJ;			lr->lr_offset = off;			lr->lr_length = nbytes;			lr->lr_blkoff = off - boff;			BP_ZERO(&lr->lr_blkptr);			/* XXX - we should do these IOs in parallel */			VERIFY(0 == dmu_buf_hold(os, ZVOL_OBJ, boff,			    FTAG, &db));			ASSERT(boff == db->db_offset);			error = dmu_sync(NULL, db, &lr->lr_blkptr,			    txg, NULL, NULL);			dmu_buf_rele(db, FTAG);			if (error) {				kmem_free(itx, offsetof(itx_t, itx_lr));				return (error);			}			itx->itx_wr_state = WR_COPIED;		}		(void) zil_itx_assign(zv->zv_zilog, itx, tx);		len -= nbytes;		off += nbytes;	}	return (0);}
开发者ID:andreiw,项目名称:polaris,代码行数:70,


示例18: zfs_log_write

voidzfs_log_write(zilog_t *zilog, dmu_tx_t *tx, int txtype,    znode_t *zp, offset_t off, ssize_t resid, int ioflag){	uint32_t blocksize = zp->z_blksz;	itx_wr_state_t write_state;	uintptr_t fsync_cnt;	if (zil_replaying(zilog, tx) || zp->z_unlinked)		return;	if (zilog->zl_logbias == ZFS_LOGBIAS_THROUGHPUT)		write_state = WR_INDIRECT;	else if (!spa_has_slogs(zilog->zl_spa) &&	    resid >= zfs_immediate_write_sz)		write_state = WR_INDIRECT;	else if (ioflag & (FSYNC | FDSYNC))		write_state = WR_COPIED;	else		write_state = WR_NEED_COPY;	if ((fsync_cnt = (uintptr_t)tsd_get(zfs_fsyncer_key)) != 0) {		(void) tsd_set(zfs_fsyncer_key, (void *)(fsync_cnt - 1));	}	while (resid) {		itx_t *itx;		lr_write_t *lr;		itx_wr_state_t wr_state = write_state;		ssize_t len = resid;		if (wr_state == WR_COPIED && resid > ZIL_MAX_COPIED_DATA)			wr_state = WR_NEED_COPY;		else if (wr_state == WR_INDIRECT)			len = MIN(blocksize - P2PHASE(off, blocksize), resid);		itx = zil_itx_create(txtype, sizeof (*lr) +		    (wr_state == WR_COPIED ? len : 0));		lr = (lr_write_t *)&itx->itx_lr;		if (wr_state == WR_COPIED && dmu_read(zp->z_zfsvfs->z_os,		    zp->z_id, off, len, lr + 1, DMU_READ_NO_PREFETCH) != 0) {			zil_itx_destroy(itx);			itx = zil_itx_create(txtype, sizeof (*lr));			lr = (lr_write_t *)&itx->itx_lr;			wr_state = WR_NEED_COPY;		}		itx->itx_wr_state = wr_state;		lr->lr_foid = zp->z_id;		lr->lr_offset = off;		lr->lr_length = len;		lr->lr_blkoff = 0;		BP_ZERO(&lr->lr_blkptr);		itx->itx_private = zp->z_zfsvfs;		if (!(ioflag & (FSYNC | FDSYNC)) && (zp->z_sync_cnt == 0) &&		    (fsync_cnt == 0))			itx->itx_sync = B_FALSE;		zil_itx_assign(zilog, itx, tx);		off += len;		resid -= len;	}}
开发者ID:FreeBSDFoundation,项目名称:freebsd,代码行数:66,


示例19: zfs_log_write

voidzfs_log_write(zilog_t *zilog, dmu_tx_t *tx, int txtype,	znode_t *zp, offset_t off, ssize_t resid, int ioflag,	zil_callback_t callback, void *callback_data){	itx_wr_state_t write_state;	boolean_t slogging;	uintptr_t fsync_cnt;	ssize_t immediate_write_sz;	if (zil_replaying(zilog, tx) || zp->z_unlinked) {		if (callback != NULL)			callback(callback_data);		return;	}	immediate_write_sz = (zilog->zl_logbias == ZFS_LOGBIAS_THROUGHPUT)	    ? 0 : (ssize_t)zfs_immediate_write_sz;	slogging = spa_has_slogs(zilog->zl_spa) &&	    (zilog->zl_logbias == ZFS_LOGBIAS_LATENCY);	if (resid > immediate_write_sz && !slogging && resid <= zp->z_blksz)		write_state = WR_INDIRECT;	else if (ioflag & (FSYNC | FDSYNC))		write_state = WR_COPIED;	else		write_state = WR_NEED_COPY;	if ((fsync_cnt = (uintptr_t)tsd_get(zfs_fsyncer_key)) != 0) {		(void) tsd_set(zfs_fsyncer_key, (void *)(fsync_cnt - 1));	}	while (resid) {		itx_t *itx;		lr_write_t *lr;		ssize_t len;		/*		 * If the write would overflow the largest block then split it.		 */		if (write_state != WR_INDIRECT && resid > ZIL_MAX_LOG_DATA)			len = SPA_MAXBLOCKSIZE >> 1;		else			len = resid;		itx = zil_itx_create(txtype, sizeof (*lr) +		    (write_state == WR_COPIED ? len : 0));		lr = (lr_write_t *)&itx->itx_lr;		if (write_state == WR_COPIED && dmu_read(ZTOZSB(zp)->z_os,		    zp->z_id, off, len, lr + 1, DMU_READ_NO_PREFETCH) != 0) {			zil_itx_destroy(itx);			itx = zil_itx_create(txtype, sizeof (*lr));			lr = (lr_write_t *)&itx->itx_lr;			write_state = WR_NEED_COPY;		}		itx->itx_wr_state = write_state;		if (write_state == WR_NEED_COPY)			itx->itx_sod += len;		lr->lr_foid = zp->z_id;		lr->lr_offset = off;		lr->lr_length = len;		lr->lr_blkoff = 0;		BP_ZERO(&lr->lr_blkptr);		itx->itx_private = ZTOZSB(zp);		if (!(ioflag & (FSYNC | FDSYNC)) && (zp->z_sync_cnt == 0) &&		    (fsync_cnt == 0))			itx->itx_sync = B_FALSE;		itx->itx_callback = callback;		itx->itx_callback_data = callback_data;		zil_itx_assign(zilog, itx, tx);		off += len;		resid -= len;	}
开发者ID:Acidburn0zzz,项目名称:zfs,代码行数:78,


示例20: zfs_log_create

//.........这里部分代码省略.........    if (zilog == NULL)        return;    ZFS_HANDLE_REPLAY(zilog, tx); /* exits if replay */    /*     * If we have FUIDs present then add in space for     * domains and ACE fuid's if any.     */    if (fuidp) {        fuidsz += fuidp->z_domain_str_sz;        fuidsz += fuidp->z_fuid_cnt * sizeof (uint64_t);    }    if (vap->va_mask & AT_XVATTR)        xvatsize = ZIL_XVAT_SIZE(xvap->xva_mapsize);    if ((int)txtype == TX_CREATE_ATTR || (int)txtype == TX_MKDIR_ATTR ||            (int)txtype == TX_CREATE || (int)txtype == TX_MKDIR ||            (int)txtype == TX_MKXATTR) {        txsize = sizeof (*lr) + namesize + fuidsz + xvatsize;        lrsize = sizeof (*lr);    } else {        aclsize = (vsecp) ? vsecp->vsa_aclentsz : 0;        txsize =            sizeof (lr_acl_create_t) + namesize + fuidsz +            ZIL_ACE_LENGTH(aclsize) + xvatsize;        lrsize = sizeof (lr_acl_create_t);    }    itx = zil_itx_create(txtype, txsize);    lr = (lr_create_t *)&itx->itx_lr;    lr->lr_doid = dzp->z_id;    lr->lr_foid = zp->z_id;    lr->lr_mode = zp->z_phys->zp_mode;    if (!IS_EPHEMERAL(zp->z_phys->zp_uid)) {        lr->lr_uid = (uint64_t)zp->z_phys->zp_uid;    } else {        lr->lr_uid = fuidp->z_fuid_owner;    }    if (!IS_EPHEMERAL(zp->z_phys->zp_gid)) {        lr->lr_gid = (uint64_t)zp->z_phys->zp_gid;    } else {        lr->lr_gid = fuidp->z_fuid_group;    }    lr->lr_gen = zp->z_phys->zp_gen;    lr->lr_crtime[0] = zp->z_phys->zp_crtime[0];    lr->lr_crtime[1] = zp->z_phys->zp_crtime[1];    lr->lr_rdev = zp->z_phys->zp_rdev;    /*     * Fill in xvattr info if any     */#ifdef HAVE_ZPL    if (vap->va_mask & AT_XVATTR) {        zfs_log_xvattr((lr_attr_t *)((caddr_t)lr + lrsize), xvap);        end = (caddr_t)lr + lrsize + xvatsize;    } else {        end = (caddr_t)lr + lrsize;    }#else    end = (caddr_t)lr + lrsize;#endif /* HAVE_ZPL */    /* Now fill in any ACL info */#ifdef HAVE_ZPL    if (vsecp) {        lracl = (lr_acl_create_t *)&itx->itx_lr;        lracl->lr_aclcnt = vsecp->vsa_aclcnt;        lracl->lr_acl_bytes = aclsize;        lracl->lr_domcnt = fuidp ? fuidp->z_domain_cnt : 0;        lracl->lr_fuidcnt  = fuidp ? fuidp->z_fuid_cnt : 0;        if (vsecp->vsa_aclflags & VSA_ACE_ACLFLAGS)            lracl->lr_acl_flags = (uint64_t)vsecp->vsa_aclflags;        else            lracl->lr_acl_flags = 0;        bcopy(vsecp->vsa_aclentp, end, aclsize);        end = (caddr_t)end + ZIL_ACE_LENGTH(aclsize);    }    /* drop in FUID info */    if (fuidp) {        end = zfs_log_fuid_ids(fuidp, end);        end = zfs_log_fuid_domains(fuidp, end);    }#endif    /*     * Now place file name in log record     */    bcopy(name, end, namesize);    seq = zil_itx_assign(zilog, itx, tx);    dzp->z_last_itx = seq;    zp->z_last_itx = seq;}
开发者ID:harshada,项目名称:zfs,代码行数:101,



注:本文中的zil_itx_assign函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


C++ zip函数代码示例
C++ zhash_new函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。