From: Thomas Nikolajsen Date: Thu, 21 Aug 2008 23:28:43 +0000 (+0000) Subject: Update hammer: X-Git-Tag: v2.1.1~627 X-Git-Url: https://gitweb.dragonflybsd.org/dragonfly.git/commitdiff_plain/34bb69d8480371924f85fa0ddbf4f7551309f3d5 Update hammer: - sync usage() and hammer.8 - correct check for arg. count - break some overly long lines --- diff --git a/sbin/hammer/cmd_mirror.c b/sbin/hammer/cmd_mirror.c index f55fd3c296..6fa1f9934e 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.13 2008/08/19 11:02:34 mneumann Exp $ + * $DragonFly: src/sbin/hammer/cmd_mirror.c,v 1.14 2008/08/21 23:28:43 thomas Exp $ */ #include "hammer.h" @@ -83,7 +83,7 @@ hammer_cmd_mirror_read(char **av, int ac, int streaming) struct timeval bwtv; u_int64_t bwcount; - if (ac > 2) + if (ac == 0 || ac > 2) mirror_usage(1); filesystem = av[0]; @@ -245,7 +245,8 @@ done: if (interrupted) { if (CyclePath) { hammer_set_cycle(&mirror.key_cur, mirror.tid_beg); - fprintf(stderr, "Cyclefile %s updated for continuation\n", CyclePath); + fprintf(stderr, "Cyclefile %s updated for " + "continuation\n", CyclePath); } } else { sync_tid = mrec->update.tid; @@ -337,7 +338,7 @@ hammer_cmd_mirror_write(char **av, int ac) int fd; int n; - if (ac > 2) + if (ac != 1) mirror_usage(1); filesystem = av[0]; @@ -712,13 +713,15 @@ read_mrecords(int fd, char *buf, u_int size, hammer_ioc_mrecord_head_t pickup) } if (pickup->signature != HAMMER_IOC_MIRROR_SIGNATURE) { - fprintf(stderr, "read_mrecords: malformed record on pipe, bad signature\n"); + fprintf(stderr, "read_mrecords: malformed record on pipe, " + "bad signature\n"); exit(1); } } if (pickup->rec_size < HAMMER_MREC_HEADSIZE || pickup->rec_size > sizeof(*mrec) + HAMMER_XBUFSIZE) { - fprintf(stderr, "read_mrecords: malformed record on pipe, illegal rec_size\n"); + fprintf(stderr, "read_mrecords: malformed record on pipe, " + "illegal rec_size\n"); exit(1); } @@ -1098,11 +1101,14 @@ static void mirror_usage(int code) { fprintf(stderr, - "hammer mirror-read \n" + "hammer mirror-read [begin-tid]\n" + "hammer mirror-read-stream [begin-tid]\n" "hammer mirror-write \n" "hammer mirror-dump\n" - "hammer mirror-copy [[user@]host:]fs [[user@]host:]fs\n" - "hammer mirror-stream [[user@]host:]fs [[user@]host:]fs\n" + "hammer mirror-copy [[user@]host:]" + " [[user@]host:]\n" + "hammer mirror-stream [[user@]host:]" + " [[user@]host:]\n" ); exit(code); } diff --git a/sbin/hammer/cmd_pseudofs.c b/sbin/hammer/cmd_pseudofs.c index 8ee999d8fd..21b54195d7 100644 --- a/sbin/hammer/cmd_pseudofs.c +++ b/sbin/hammer/cmd_pseudofs.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_pseudofs.c,v 1.9 2008/08/17 10:35:18 mneumann Exp $ + * $DragonFly: src/sbin/hammer/cmd_pseudofs.c,v 1.10 2008/08/21 23:28:43 thomas Exp $ */ #include "hammer.h" @@ -166,6 +166,9 @@ hammer_cmd_pseudofs_status(char **av, int ac) int i; int fd; + if (ac == 0) + pseudofs_usage(1); + for (i = 0; i < ac; ++i) { printf("%s\t", av[i]); fd = getpfs(&pfs, av[i]); @@ -426,11 +429,14 @@ hammer_cmd_pseudofs_update(char **av, int ac) if (ioctl(fd, HAMMERIOC_GET_PSEUDOFS, &pfs) == 0) { dump_pfsd(pfs.ondisk); } else { - printf("Unable to retrieve pfs configuration after successful update: %s\n", strerror(errno)); + printf("Unable to retrieve pfs configuration " + "after successful update: %s\n", + strerror(errno)); exit(1); } } else { - printf("Unable to adjust pfs configuration: %s\n", strerror(errno)); + printf("Unable to adjust pfs configuration: %s\n", + strerror(errno)); exit(1); } } @@ -537,7 +543,7 @@ void pseudofs_usage(int code) { fprintf(stderr, - "hammer pfs-status ...\n" + "hammer pfs-status ...\n" "hammer pfs-master [options]\n" "hammer pfs-slave [options]\n" "hammer pfs-update [options]\n" diff --git a/sbin/hammer/cmd_softprune.c b/sbin/hammer/cmd_softprune.c index b2aa898edb..9b8646635c 100644 --- a/sbin/hammer/cmd_softprune.c +++ b/sbin/hammer/cmd_softprune.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_softprune.c,v 1.6 2008/07/07 00:27:22 dillon Exp $ + * $DragonFly: src/sbin/hammer/cmd_softprune.c,v 1.7 2008/08/21 23:28:43 thomas Exp $ */ #include "hammer.h" @@ -386,7 +386,7 @@ void softprune_usage(int code) { fprintf(stderr, "Badly formed prune command, use:\n"); - fprintf(stderr, "hammer prune \n"); + fprintf(stderr, "hammer prune \n"); fprintf(stderr, "hammer prune-everything \n"); exit(code); } diff --git a/sbin/hammer/hammer.8 b/sbin/hammer/hammer.8 index 0a8d4283a9..002ee43e06 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.45 2008/08/11 19:58:10 thomas Exp $ +.\" $DragonFly: src/sbin/hammer/hammer.8,v 1.46 2008/08/21 23:28:43 thomas Exp $ .Dd July 27, 2008 .Dt HAMMER 8 .Os @@ -47,7 +47,7 @@ .Op Fl i Ar delay .Op Fl t Ar seconds .Ar command -.Ar [argument ...] +.Op Ar argument ... .Sh DESCRIPTION This manual page documents the .Nm @@ -338,10 +338,10 @@ Reblocking is a per-PFS operation, so a .Nm HAMMER file system and each PFS in it have to be reblocked separately. .\" ==== pfs-status ==== -.It Ar pfs-status Ar dirpath +.It Ar pfs-status Ar dirpath ... Retrieve the mirroring configuration parameters for the specified .Nm HAMMER -file system or pseudo-filesystem. +file systems or pseudo-filesystems. .\" ==== pfs-master ==== .It Ar pfs-master Ar dirpath Op options Create a pseudo-filesystem (PFS) inside a @@ -384,34 +384,6 @@ A PFS can only be truly destroyed with the .Ar pfs-destroy directive. Removing the softlink will not destroy the underlying PFS. -.\" ==== pfs-upgrade ==== -.It Ar pfs-upgrade Ar dirpath -Upgrade a PFS from slave to master operation. The PFS will be rolled back -to the current end synchronization tid (removing any partial synchronizations), -and will then becomes writable. -.Pp -.Em WARNING! -.Nm HAMMER -currently supports only single masters and using -this command can easily result in file system corruption if you don't -know what you are doing. -.Pp -This directive will refuse to run if any programs have open descriptors -in the PFS, including programs chdir'd into the PFS. -.\" ==== pfs-downgrade ==== -.It Ar pfs-downgrade Ar dirpath -Downgrade a master PFS from master to slave operation. The PFS becomes -read-only and access will be locked to its -.Ar sync-end-tid . -.Pp -This directive will refuse to run if any programs have open descriptors -in the PFS, including programs chdir'd into the PFS. -.\" ==== pfs-destroy ==== -.It Ar pfs-destroy Ar dirpath -This permanently destroys a PFS. -.Pp -This directive will refuse to run if any programs have open descriptors -in the PFS, including programs chdir'd into the PFS. .\" ==== pfs-update ==== .It Ar pfs-update Ar dirpath Op options Update the configuration parameters for an existing @@ -442,7 +414,9 @@ Manually modifying this field is dangerous and can result in a broken mirror. .It shared-uuid= Set the shared UUID for this file system. All mirrors must have the same -shared UUID. For safety purposes the mirror-write directives will refuse +shared UUID. For safety purposes the +.Ar mirror-write +directives will refuse to operate on a target with a different shared UUID. .Pp Changing the shared UUID on an existing, non-empty mirroring target, @@ -454,6 +428,34 @@ anywhere else, even on exact copies of the file system. .It label= Set a descriptive label for this file system. .El +.\" ==== pfs-upgrade ==== +.It Ar pfs-upgrade Ar dirpath +Upgrade a PFS from slave to master operation. The PFS will be rolled back +to the current end synchronization tid (removing any partial synchronizations), +and will then becomes writable. +.Pp +.Em WARNING! +.Nm HAMMER +currently supports only single masters and using +this command can easily result in file system corruption if you don't +know what you are doing. +.Pp +This directive will refuse to run if any programs have open descriptors +in the PFS, including programs chdir'd into the PFS. +.\" ==== pfs-downgrade ==== +.It Ar pfs-downgrade Ar dirpath +Downgrade a master PFS from master to slave operation. The PFS becomes +read-only and access will be locked to its +.Ar sync-end-tid . +.Pp +This directive will refuse to run if any programs have open descriptors +in the PFS, including programs chdir'd into the PFS. +.\" ==== pfs-destroy ==== +.It Ar pfs-destroy Ar dirpath +This permanently destroys a PFS. +.Pp +This directive will refuse to run if any programs have open descriptors +in the PFS, including programs chdir'd into the PFS. .\" ==== mirror-read ==== .It Ar mirror-read Ar filesystem Op Ar Generate a mirroring stream to stdout. @@ -465,8 +467,8 @@ Upon completion the stream is paused until new data is synced to the master, then resumed. Operation continues until the pipe is broken. .\" ==== mirror-write ==== -.It Ar mirror-write Ar filesystem Op Ar -Take a mirroring stream on stdin and output it to stdout. +.It Ar mirror-write Ar filesystem +Take a mirroring stream on stdin. .Pp This command will fail if the .Ar shared-uuid diff --git a/sbin/hammer/hammer.c b/sbin/hammer/hammer.c index f48e80e533..5be575bdf7 100644 --- a/sbin/hammer/hammer.c +++ b/sbin/hammer/hammer.c @@ -31,7 +31,7 @@ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $DragonFly: src/sbin/hammer/hammer.c,v 1.37 2008/08/19 11:02:34 mneumann Exp $ + * $DragonFly: src/sbin/hammer/hammer.c,v 1.38 2008/08/21 23:28:43 thomas Exp $ */ #include "hammer.h" @@ -308,7 +308,8 @@ usage(int exit_code) "hammer bstats [interval]\n" "hammer iostats [interval]\n" "hammer mirror-read [begin-tid]\n" - "hammer mirror-write [file ...]\n" + "hammer mirror-read-stream [begin-tid]\n" + "hammer mirror-write \n" "hammer mirror-dump\n" "hammer mirror-copy [[user@]host:]" " [[user@]host:]\n" @@ -316,7 +317,7 @@ usage(int exit_code) " [[user@]host:]\n" "hammer reblock[-btree/inodes/dirs/data] " " [fill_percentage]\n" - "hammer pfs-status \n" + "hammer pfs-status ...\n" "hammer pfs-master [options]\n" "hammer pfs-slave [options]\n" "hammer pfs-update [options]\n" diff --git a/sbin/hammer/ondisk.c b/sbin/hammer/ondisk.c index 6d6b8c3501..7702b1c1bd 100644 --- a/sbin/hammer/ondisk.c +++ b/sbin/hammer/ondisk.c @@ -31,7 +31,7 @@ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $DragonFly: src/sbin/hammer/ondisk.c,v 1.24 2008/07/24 05:40:14 dillon Exp $ + * $DragonFly: src/sbin/hammer/ondisk.c,v 1.25 2008/08/21 23:28:43 thomas Exp $ */ #include @@ -701,7 +701,8 @@ again: assert(layer2->append_off == 0); } if (layer2->zone != zone) { - blockmap->next_offset = (blockmap->next_offset + HAMMER_LARGEBLOCK_SIZE) & ~HAMMER_LARGEBLOCK_MASK64; + blockmap->next_offset = (blockmap->next_offset + HAMMER_LARGEBLOCK_SIZE) & + ~HAMMER_LARGEBLOCK_MASK64; goto again; }