From ddc8e7225b14302c90a7d9656c0a46366d3b7fb0 Mon Sep 17 00:00:00 2001 From: Matthew Dillon Date: Mon, 7 Jul 2008 03:51:29 +0000 Subject: [PATCH] HAMMER Utilities: Sync with 60F * Use sync_end_tid as the snapshot TID rather then sync_beg_tid. * Initialize sync_beg_tid to 0 instead of 1 in PFS 0's pfsd structure. * Reported the random fsid assigned by newfs_hammer to a new HAMMER filesystem. --- sbin/hammer/cmd_mirror.c | 4 ++-- sbin/hammer/hammer.8 | 6 +++--- sbin/newfs_hammer/newfs_hammer.c | 7 +++++-- 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/sbin/hammer/cmd_mirror.c b/sbin/hammer/cmd_mirror.c index 39dbb96b55..1b98c4bc67 100644 --- a/sbin/hammer/cmd_mirror.c +++ b/sbin/hammer/cmd_mirror.c @@ -31,7 +31,7 @@ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $DragonFly: src/sbin/hammer/cmd_mirror.c,v 1.4 2008/07/07 00:27:22 dillon Exp $ + * $DragonFly: src/sbin/hammer/cmd_mirror.c,v 1.5 2008/07/07 03:51:28 dillon Exp $ */ #include "hammer.h" @@ -717,7 +717,7 @@ update_pfs_snapshot(int fd, hammer_tid_t snapshot_tid) perror("update_pfs_snapshot (read)"); exit(1); } - pfsd.sync_beg_tid = snapshot_tid; + pfsd.sync_end_tid = snapshot_tid; if (ioctl(fd, HAMMERIOC_SET_PSEUDOFS, &pfs) != 0) { perror("update_pfs_snapshot (rewrite)"); exit(1); diff --git a/sbin/hammer/hammer.8 b/sbin/hammer/hammer.8 index f7ea346aed..fbdf9795b8 100644 --- a/sbin/hammer/hammer.8 +++ b/sbin/hammer/hammer.8 @@ -30,7 +30,7 @@ .\" OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.\" $DragonFly: src/sbin/hammer/hammer.8,v 1.31 2008/07/07 00:27:22 dillon Exp $ +.\" $DragonFly: src/sbin/hammer/hammer.8,v 1.32 2008/07/07 03:51:28 dillon Exp $ .Dd June 26, 2008 .Dt HAMMER 8 .Os @@ -252,7 +252,7 @@ or pseudo-filesystem. Options that may be specified: .Pp .Bl -tag -width indent .It sync-beg-tid=0x16llx -This is the automatic snapshot access TID for mirroring slaves. +This is the automatic snapshot access starting TID for mirroring slaves. This parameter is normally updated automatically by the .Ar mirror-write directive. @@ -265,7 +265,7 @@ data that is still undergoing synchronization. Manually modifying this field is dangerous and can result in a broken mirror. .It sync-end-tid=0x16llx -This is the current synchronization target for mirroring slaves. +This is the current synchronization point for mirroring slaves. This parameter is normally updated automatically by the .Ar mirror-write directive. diff --git a/sbin/newfs_hammer/newfs_hammer.c b/sbin/newfs_hammer/newfs_hammer.c index f42f8b3a2e..27390f4aef 100644 --- a/sbin/newfs_hammer/newfs_hammer.c +++ b/sbin/newfs_hammer/newfs_hammer.c @@ -31,7 +31,7 @@ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $DragonFly: src/sbin/newfs_hammer/newfs_hammer.c,v 1.37 2008/07/07 01:29:32 dillon Exp $ + * $DragonFly: src/sbin/newfs_hammer/newfs_hammer.c,v 1.38 2008/07/07 03:51:29 dillon Exp $ */ #include "newfs_hammer.h" @@ -54,6 +54,7 @@ main(int ac, char **av) int i; const char *label = NULL; struct volume_info *vol; + char *fsidstr; /* * Sanity check basic filesystem structures. No cookies for us @@ -176,6 +177,7 @@ main(int ac, char **av) vol = get_volume(RootVolNo); vol->ondisk->vol0_stat_bigblocks = vol->ondisk->vol0_stat_freebigblocks; vol->cache.modified = 1; + uuid_to_string(&Hammer_FSId, &fsidstr, &status); printf("---------------------------------------------\n"); printf("%d volume%s total size %s\n", @@ -185,6 +187,7 @@ main(int ac, char **av) printf("undo-buffer-size: %s\n", sizetostr(UndoBufferSize)); printf("total-pre-allocated: %s\n", sizetostr(vol->vol_free_off & HAMMER_OFF_SHORT_MASK)); + printf("fsid: %s\n", fsidstr); printf("\n"); flush_all_volumes(); @@ -489,7 +492,7 @@ format_root(const char *label) idata->nlinks = 1; pfsd->sync_low_tid = 1; - pfsd->sync_beg_tid = 1; + pfsd->sync_beg_tid = 0; pfsd->sync_end_tid = 0; /* overriden by vol0_next_tid on pfs0 */ pfsd->shared_uuid = Hammer_FSId; pfsd->unique_uuid = Hammer_FSId; -- 2.41.0