Deleted Added
sdiff udiff text old ( 185321 ) new ( 209962 )
full compact
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

--- 28 unchanged lines hidden (view full) ---

37#include <sys/zil_impl.h>
38#include <sys/byteorder.h>
39#include <sys/policy.h>
40#include <sys/stat.h>
41#include <sys/acl.h>
42#include <sys/dmu.h>
43#include <sys/spa.h>
44#include <sys/zfs_fuid.h>
45
46/*
47 * All the functions in this file are used to construct the log entries
48 * to record transactions. They allocate * an intent log transaction
49 * structure (itx_t) and save within it all the information necessary to
50 * possibly replay the transaction. The itx is then assigned a sequence
51 * number and inserted in the in-memory list anchored in the zilog.
52 */
53
54int
55zfs_log_create_txtype(zil_create_t type, vsecattr_t *vsecp, vattr_t *vap)
56{
57 int isxvattr = (vap->va_mask & AT_XVATTR);
58 switch (type) {
59 case Z_FILE:

--- 171 unchanged lines hidden (view full) ---

231 void *end;
232 size_t lrsize;
233 size_t namesize = strlen(name) + 1;
234 size_t fuidsz = 0;
235
236 if (zilog == NULL)
237 return;
238
239 /*
240 * If we have FUIDs present then add in space for
241 * domains and ACE fuid's if any.
242 */
243 if (fuidp) {
244 fuidsz += fuidp->z_domain_str_sz;
245 fuidsz += fuidp->z_fuid_cnt * sizeof (uint64_t);
246 }

--- 87 unchanged lines hidden (view full) ---

334 itx_t *itx;
335 uint64_t seq;
336 lr_remove_t *lr;
337 size_t namesize = strlen(name) + 1;
338
339 if (zilog == NULL)
340 return;
341
342 itx = zil_itx_create(txtype, sizeof (*lr) + namesize);
343 lr = (lr_remove_t *)&itx->itx_lr;
344 lr->lr_doid = dzp->z_id;
345 bcopy(name, (char *)(lr + 1), namesize);
346
347 seq = zil_itx_assign(zilog, itx, tx);
348 dzp->z_last_itx = seq;
349}

--- 8 unchanged lines hidden (view full) ---

358 itx_t *itx;
359 uint64_t seq;
360 lr_link_t *lr;
361 size_t namesize = strlen(name) + 1;
362
363 if (zilog == NULL)
364 return;
365
366 itx = zil_itx_create(txtype, sizeof (*lr) + namesize);
367 lr = (lr_link_t *)&itx->itx_lr;
368 lr->lr_doid = dzp->z_id;
369 lr->lr_link_obj = zp->z_id;
370 bcopy(name, (char *)(lr + 1), namesize);
371
372 seq = zil_itx_assign(zilog, itx, tx);
373 dzp->z_last_itx = seq;

--- 11 unchanged lines hidden (view full) ---

385 uint64_t seq;
386 lr_create_t *lr;
387 size_t namesize = strlen(name) + 1;
388 size_t linksize = strlen(link) + 1;
389
390 if (zilog == NULL)
391 return;
392
393 itx = zil_itx_create(txtype, sizeof (*lr) + namesize + linksize);
394 lr = (lr_create_t *)&itx->itx_lr;
395 lr->lr_doid = dzp->z_id;
396 lr->lr_foid = zp->z_id;
397 lr->lr_mode = zp->z_phys->zp_mode;
398 lr->lr_uid = zp->z_phys->zp_uid;
399 lr->lr_gid = zp->z_phys->zp_gid;
400 lr->lr_gen = zp->z_phys->zp_gen;

--- 18 unchanged lines hidden (view full) ---

419 uint64_t seq;
420 lr_rename_t *lr;
421 size_t snamesize = strlen(sname) + 1;
422 size_t dnamesize = strlen(dname) + 1;
423
424 if (zilog == NULL)
425 return;
426
427 itx = zil_itx_create(txtype, sizeof (*lr) + snamesize + dnamesize);
428 lr = (lr_rename_t *)&itx->itx_lr;
429 lr->lr_sdoid = sdzp->z_id;
430 lr->lr_tdoid = tdzp->z_id;
431 bcopy(sname, (char *)(lr + 1), snamesize);
432 bcopy(dname, (char *)(lr + 1) + snamesize, dnamesize);
433
434 seq = zil_itx_assign(zilog, itx, tx);

--- 16 unchanged lines hidden (view full) ---

451{
452 itx_wr_state_t write_state;
453 boolean_t slogging;
454 uintptr_t fsync_cnt;
455
456 if (zilog == NULL || zp->z_unlinked)
457 return;
458
459 /*
460 * Writes are handled in three different ways:
461 *
462 * WR_INDIRECT:
463 * In this mode, if we need to commit the write later, then the block
464 * is immediately written into the file system (using dmu_sync),
465 * and a pointer to the block is put into the log record.
466 * When the txg commits the block is linked in.

--- 36 unchanged lines hidden (view full) ---

503 len = SPA_MAXBLOCKSIZE >> 1;
504 else
505 len = resid;
506
507 itx = zil_itx_create(txtype, sizeof (*lr) +
508 (write_state == WR_COPIED ? len : 0));
509 lr = (lr_write_t *)&itx->itx_lr;
510 if (write_state == WR_COPIED && dmu_read(zp->z_zfsvfs->z_os,
511 zp->z_id, off, len, lr + 1) != 0) {
512 kmem_free(itx, offsetof(itx_t, itx_lr) +
513 itx->itx_lr.lrc_reclen);
514 itx = zil_itx_create(txtype, sizeof (*lr));
515 lr = (lr_write_t *)&itx->itx_lr;
516 write_state = WR_NEED_COPY;
517 }
518
519 itx->itx_wr_state = write_state;

--- 29 unchanged lines hidden (view full) ---

549{
550 itx_t *itx;
551 uint64_t seq;
552 lr_truncate_t *lr;
553
554 if (zilog == NULL || zp->z_unlinked)
555 return;
556
557 itx = zil_itx_create(txtype, sizeof (*lr));
558 lr = (lr_truncate_t *)&itx->itx_lr;
559 lr->lr_foid = zp->z_id;
560 lr->lr_offset = off;
561 lr->lr_length = len;
562
563 itx->itx_sync = (zp->z_sync_cnt != 0);
564 seq = zil_itx_assign(zilog, itx, tx);

--- 13 unchanged lines hidden (view full) ---

578 xvattr_t *xvap = (xvattr_t *)vap;
579 size_t recsize = sizeof (lr_setattr_t);
580 void *start;
581
582
583 if (zilog == NULL || zp->z_unlinked)
584 return;
585
586 /*
587 * If XVATTR set, then log record size needs to allow
588 * for lr_attr_t + xvattr mask, mapsize and create time
589 * plus actual attribute values
590 */
591 if (vap->va_mask & AT_XVATTR)
592 recsize = sizeof (*lr) + ZIL_XVAT_SIZE(xvap->xva_mapsize);
593

--- 50 unchanged lines hidden (view full) ---

644 int txtype;
645 int lrsize;
646 size_t txsize;
647 size_t aclbytes = vsecp->vsa_aclentsz;
648
649 if (zilog == NULL || zp->z_unlinked)
650 return;
651
652 txtype = (zp->z_zfsvfs->z_version < ZPL_VERSION_FUID) ?
653 TX_ACL_V0 : TX_ACL;
654
655 if (txtype == TX_ACL)
656 lrsize = sizeof (*lr);
657 else
658 lrsize = sizeof (*lrv0);
659

--- 40 unchanged lines hidden ---