[gfs2-utils] 03/03: glocktop: Remove a non-existent flag from the
usage string
by git repository hosting
This is an automated email from the git hooks/post-receive script.
andyp pushed a commit to branch master
in repository gfs2-utils.
commit 26b4d21c9ced2b8a8d03e2b0e4413373bd0de69b
Author: Andrew Price <anprice(a)redhat.com>
Date: Thu Feb 15 11:06:18 2018 +0000
glocktop: Remove a non-existent flag from the usage string
There is no -f option.
Signed-off-by: Andrew Price <anprice(a)redhat.com>
---
gfs2/glocktop/glocktop.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/gfs2/glocktop/glocktop.c b/gfs2/glocktop/glocktop.c
index bcee3d8..cef368a 100644
--- a/gfs2/glocktop/glocktop.c
+++ b/gfs2/glocktop/glocktop.c
@@ -1630,8 +1630,7 @@ static void parse_glocks_file(int fd, const char *fsname, int dlmwaiters,
static void usage(void)
{
printf("Usage:\n");
- printf("glocktop [-i] [-d <delay sec>] [-f] [-n <iter>] [-sX] "
- "[-c] [-D] [-H] [-r] [-t]\n");
+ printf("glocktop [-i] [-d <delay sec>] [-n <iter>] [-sX] [-c] [-D] [-H] [-r] [-t]\n");
printf("\n");
printf("-i : Runs glocktop in interactive mode.\n");
printf("-d : delay between refreshes, in seconds (default: %d).\n", REFRESH_TIME);
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
6 years, 2 months
[gfs2-utils] 02/03: gfs2-utils: Remove make-tarball.sh
by git repository hosting
This is an automated email from the git hooks/post-receive script.
andyp pushed a commit to branch master
in repository gfs2-utils.
commit 56909254d29d2e4388419d17beedd45ad8650574
Author: Andrew Price <anprice(a)redhat.com>
Date: Thu Feb 15 11:04:38 2018 +0000
gfs2-utils: Remove make-tarball.sh
This script hasn't been used in a long time.
Signed-off-by: Andrew Price <anprice(a)redhat.com>
---
make-tarball.sh | 22 ----------------------
1 file changed, 22 deletions(-)
diff --git a/make-tarball.sh b/make-tarball.sh
deleted file mode 100755
index fd12195..0000000
--- a/make-tarball.sh
+++ /dev/null
@@ -1,22 +0,0 @@
-#!/bin/bash
-
-FILES=`git ls-files | sed -e's/^/gfs2-utils\//'`
-BRANCH=`git branch | grep '^\*' | cut -d' ' -f2`
-DESC=`git describe 2>/dev/null`
-
-if [ $? != 128 ]; then
- if [ ${BRANCH} == "master" ]; then
- VERSION=-${DESC}
- else
- VERSION=-${BRANCH}-${DESC}
- fi
-fi
-
-DEST=`pwd`/gfs2-utils${VERSION}.tar.gz
-
-echo "Creating ${DEST}..."
-
-(cd ..; tar -zcf ${DEST} ${FILES})
-
-echo "Done."
-
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
6 years, 2 months
[gfs2-utils] 01/03: mkfs.gfs2: Scale down journal size for smaller
devices
by git repository hosting
This is an automated email from the git hooks/post-receive script.
andyp pushed a commit to branch master
in repository gfs2-utils.
commit 04598c779cb1309f342ca14b555df5eb676e38c9
Author: Andrew Price <anprice(a)redhat.com>
Date: Mon Feb 12 19:27:48 2018 +0000
mkfs.gfs2: Scale down journal size for smaller devices
Currently the default behaviour when the journal size is not specified
is to use a default size of 128M, which means that mkfs.gfs2 can run out
of space while writing to a small device. The hard default also means
that some xfstests fail with gfs2 as they try to create small file
systems.
This patch addresses these problems by setting sensible default journal
sizes depending on the size of the file system. Journal sizes specified
by the user are limited to half of the fs. As the minimum journal size
is 8MB that means we effectively get a hard minimum file system size of
16MB (per journal).
Signed-off-by: Andrew Price <anprice(a)redhat.com>
---
gfs2/libgfs2/libgfs2.h | 2 ++
gfs2/man/mkfs.gfs2.8 | 5 +++--
gfs2/mkfs/main_mkfs.c | 54 ++++++++++++++++++++++++++++++++++++++++++++++++--
tests/edit.at | 2 +-
tests/mkfs.at | 10 ++++++++++
tests/testsuite.at | 6 ++++++
6 files changed, 74 insertions(+), 5 deletions(-)
diff --git a/gfs2/libgfs2/libgfs2.h b/gfs2/libgfs2/libgfs2.h
index 85ac74c..15d2a9d 100644
--- a/gfs2/libgfs2/libgfs2.h
+++ b/gfs2/libgfs2/libgfs2.h
@@ -319,6 +319,8 @@ struct metapath {
#define GFS2_DEFAULT_BSIZE (4096)
#define GFS2_DEFAULT_JSIZE (128)
+#define GFS2_MAX_JSIZE (1024)
+#define GFS2_MIN_JSIZE (8)
#define GFS2_DEFAULT_RGSIZE (256)
#define GFS2_DEFAULT_UTSIZE (1)
#define GFS2_DEFAULT_QCSIZE (1)
diff --git a/gfs2/man/mkfs.gfs2.8 b/gfs2/man/mkfs.gfs2.8
index 342a636..35e355a 100644
--- a/gfs2/man/mkfs.gfs2.8
+++ b/gfs2/man/mkfs.gfs2.8
@@ -32,8 +32,9 @@ Enable debugging output.
Print out a help message describing the available options, then exit.
.TP
\fB-J\fP \fImegabytes\fR
-The size of each journal. The default journal size is 128 megabytes and the
-minimum size is 8 megabytes.
+The size of each journal. The minimum size is 8 megabytes and the maximum is
+1024. If this is not specified, a value based on a sensible proportion of the
+file system will be chosen.
.TP
\fB-j\fP \fIjournals\fR
The number of journals for mkfs.gfs2 to create. At least one journal is
diff --git a/gfs2/mkfs/main_mkfs.c b/gfs2/mkfs/main_mkfs.c
index 54ff2db..05e9749 100644
--- a/gfs2/mkfs/main_mkfs.c
+++ b/gfs2/mkfs/main_mkfs.c
@@ -552,7 +552,7 @@ static void opts_check(struct mkfs_opts *opts)
if (!opts->journals)
die( _("no journals specified\n"));
- if (opts->jsize < 8 || opts->jsize > 1024)
+ if (opts->jsize < GFS2_MIN_JSIZE || opts->jsize > GFS2_MAX_JSIZE)
die( _("bad journal size\n"));
if (!opts->qcsize || opts->qcsize > 64)
@@ -575,6 +575,7 @@ static void print_results(struct gfs2_sb *sb, struct mkfs_opts *opts, uint64_t r
printf("%-27s%.2f %s (%"PRIu64" %s)\n", _("Filesystem size:"),
(fssize / ((float)(1 << 30)) * sb->sb_bsize), _("GB"), fssize, _("blocks"));
printf("%-27s%u\n", _("Journals:"), opts->journals);
+ printf("%-27s%uMB\n", _("Journal size:"), opts->jsize);
printf("%-27s%"PRIu64"\n", _("Resource groups:"), rgrps);
printf("%-27s\"%s\"\n", _("Locking protocol:"), opts->lockproto);
printf("%-27s\"%s\"\n", _("Lock table:"), opts->locktable);
@@ -814,6 +815,36 @@ static int place_rgrps(struct gfs2_sbd *sdp, lgfs2_rgrps_t rgs, uint64_t *rgaddr
return 0;
}
+/*
+ * Find a reasonable journal file size (in blocks) given the number of blocks
+ * in the filesystem. For very small filesystems, it is not reasonable to
+ * have a journal that fills more than half of the filesystem.
+ *
+ * n.b. comments assume 4k blocks
+ *
+ * This was copied and adapted from e2fsprogs.
+ */
+static int default_journal_size(unsigned bsize, uint64_t num_blocks)
+{
+ int min_blocks = (GFS2_MIN_JSIZE << 20) / bsize;
+
+ if (num_blocks < 2 * min_blocks)
+ return -1;
+ if (num_blocks < 131072) /* 512 MB */
+ return min_blocks; /* 8 MB */
+ if (num_blocks < 512*1024) /* 2 GB */
+ return (4096); /* 16 MB */
+ if (num_blocks < 2048*1024) /* 8 GB */
+ return (8192); /* 32 MB */
+ if (num_blocks < 4096*1024) /* 16 GB */
+ return (16384); /* 64 MB */
+ if (num_blocks < 262144*1024) /* 1 TB */
+ return (32768); /* 128 MB */
+ if (num_blocks < 2621440*1024) /* 10 TB */
+ return (131072); /* 512 MB */
+ return 262144; /* 1 GB */
+}
+
static void sbd_init(struct gfs2_sbd *sdp, struct mkfs_opts *opts, unsigned bsize)
{
memset(sdp, 0, sizeof(struct gfs2_sbd));
@@ -838,9 +869,28 @@ static void sbd_init(struct gfs2_sbd *sdp, struct mkfs_opts *opts, unsigned bsiz
opts->dev.size / ((float)(1 << 30)), _("GB"),
opts->dev.size / sdp->bsize, _("blocks"));
}
- /* TODO: Check if the fssize is too small, somehow */
sdp->device.length = opts->fssize;
}
+ /* opts->jsize has already been max/min checked but we need to check it
+ makes sense for the device size, or set a sensible default, if one
+ will fit. For user-provided journal sizes, limit it to half of the fs. */
+ if (!opts->got_jsize) {
+ int default_jsize = default_journal_size(sdp->bsize, sdp->device.length / opts->journals);
+ if (default_jsize < 0) {
+ fprintf(stderr, _("gfs2 will not fit on this device.\n"));
+ exit(1);
+ }
+ opts->jsize = (default_jsize * sdp->bsize) >> 20;
+ } else if ((((opts->jsize * opts->journals) << 20) / sdp->bsize) > (sdp->device.length / 2)) {
+ unsigned max_jsize = (sdp->device.length / 2 * sdp->bsize / opts->journals) >> 20;
+
+ fprintf(stderr, _("gfs2 will not fit on this device.\n"));
+ if (max_jsize >= GFS2_MIN_JSIZE)
+ fprintf(stderr, _("Maximum size for %u journals on this device is %uMB.\n"),
+ opts->journals, max_jsize);
+ exit(1);
+ }
+ sdp->jsize = opts->jsize;
}
static int probe_contents(struct mkfs_dev *dev)
diff --git a/tests/edit.at b/tests/edit.at
index 3bd4163..e1a0fca 100644
--- a/tests/edit.at
+++ b/tests/edit.at
@@ -6,7 +6,7 @@ AT_KEYWORDS(gfs2_edit edit)
GFS_TGT_REGEN
AT_CHECK([$GFS_MKFS -p lock_nolock $GFS_TGT $(($(gfs_max_blocks 4096)/2))], 0, [ignore], [ignore])
AT_CHECK([gfs2_edit savemeta $GFS_TGT test.meta > savemeta.log], 0, [ignore], [ignore])
-AT_CHECK([head -2 savemeta.log], 0, [There are 1310718 blocks of 4096 bytes in the filesystem.
+AT_CHECK([head -2 savemeta.log], 0, [There are 1310716 blocks of 4096 bytes in the filesystem.
Filesystem size: 4.1023GB
], [ignore])
GFS_TGT_REGEN
diff --git a/tests/mkfs.at b/tests/mkfs.at
index be88817..7ae6fcc 100644
--- a/tests/mkfs.at
+++ b/tests/mkfs.at
@@ -155,3 +155,13 @@ AT_CHECK([rgrifieldscheck.sh $GFS_TGT], 0, [ignore], [ignore])
AT_CHECK([$GFS_MKFS -p lock_nolock -o test_topology=0:512:65536:393216:512 $GFS_TGT], 0, [ignore], [ignore])
AT_CHECK([rgrifieldscheck.sh $GFS_TGT], 0, [ignore], [ignore])
AT_CLEANUP
+
+AT_SETUP([Small filesystems])
+AT_KEYWORDS(mkfs.gfs2 mkfs)
+GFS_TGT_SIZE(32M)
+AT_CHECK([$GFS_MKFS -p lock_nolock $GFS_TGT], 0, [ignore], [ignore])
+AT_CHECK([fsck.gfs2 -n $GFS_TGT], 0, [ignore], [ignore])
+GFS_TGT_SIZE(64M)
+AT_CHECK([$GFS_MKFS -p lock_nolock -j2 $GFS_TGT], 0, [ignore], [ignore])
+AT_CHECK([fsck.gfs2 -n $GFS_TGT], 0, [ignore], [ignore])
+AT_CLEANUP
diff --git a/tests/testsuite.at b/tests/testsuite.at
index cc1bd54..522ac1c 100644
--- a/tests/testsuite.at
+++ b/tests/testsuite.at
@@ -4,6 +4,12 @@ m4_define([GFS_TGT_REGEN],
[AT_CHECK([rm -f $GFS_TGT && truncate -s ${GFS_TGT_SZ}G ${GFS_TGT}], [ignore], [ignore], [ignore])
AT_SKIP_IF([test ! -f ${GFS_TGT}])])
+# Regenerate the sparse file used for testing, with a given size, and skip the test if it fails
+# Usage: GFS_TGT_REGEN(<size>)
+m4_define([GFS_TGT_SIZE],
+[AT_CHECK([rm -f $GFS_TGT && truncate -s $1 ${GFS_TGT}], [ignore], [ignore], [ignore])
+AT_SKIP_IF([test ! -f ${GFS_TGT}])])
+
# Regenerate, check, fsck is used a lot so combine it into one macro
# Usage: GFS_FSCK_CHECK ([mkfs.gfs2 ... $GFS_TGT])
m4_define([GFS_FSCK_CHECK],
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
6 years, 2 months
[gfs2-utils] 01/01: gfs2_edit: Print offsets of indirect pointers
by git repository hosting
This is an automated email from the git hooks/post-receive script.
andyp pushed a commit to branch RHEL7
in repository gfs2-utils.
commit 0c333e3f49744ab3dd1b9c9c24d8f2c8b739c018
Author: Andrew Price <anprice(a)redhat.com>
Date: Thu Nov 30 19:00:31 2017 +0000
gfs2_edit: Print offsets of indirect pointers
When printing indirect pointers gfs2_edit doesn't keep track of the
location of the pointer within the indirect block and only prints an
index for each non-zero pointer. Instead, store the offset of each
non-zero pointer and print it when displaying indirect blocks, as it is
done in interactive mode.
Resolves: rhbz#1518938
Signed-off-by: Andrew Price <anprice(a)redhat.com>
---
gfs2/edit/extended.c | 10 +++++-----
gfs2/edit/gfs2hex.c | 2 ++
gfs2/edit/hexedit.h | 1 +
3 files changed, 8 insertions(+), 5 deletions(-)
diff --git a/gfs2/edit/extended.c b/gfs2/edit/extended.c
index e804853..214fdba 100644
--- a/gfs2/edit/extended.c
+++ b/gfs2/edit/extended.c
@@ -51,6 +51,7 @@ static int get_height(void)
static int _do_indirect_extended(char *diebuf, struct iinfo *iinf, int hgt)
{
unsigned int x, y;
+ off_t headoff;
uint64_t p;
int i_blocks;
@@ -62,15 +63,14 @@ static int _do_indirect_extended(char *diebuf, struct iinfo *iinf, int hgt)
iinf->ii[x].dirents = 0;
memset(&iinf->ii[x].dirent, 0, sizeof(struct gfs2_dirents));
}
- for (x = (sbd.gfs1 ? sizeof(struct gfs_indirect):
- sizeof(struct gfs2_meta_header)), y = 0;
- x < sbd.bsize;
- x += sizeof(uint64_t), y++) {
+ headoff = sbd.gfs1 ? sizeof(struct gfs_indirect) : sizeof(struct gfs2_meta_header);
+ for (x = headoff, y = 0; x < sbd.bsize; x += sizeof(uint64_t), y++) {
p = be64_to_cpu(*(uint64_t *)(diebuf + x));
if (p) {
iinf->ii[i_blocks].block = p;
iinf->ii[i_blocks].mp.mp_list[hgt] = i_blocks;
iinf->ii[i_blocks].is_dir = FALSE;
+ iinf->ii[i_blocks].ptroff = (x - headoff) / sizeof(uint64_t);
i_blocks++;
}
}
@@ -177,7 +177,7 @@ static int display_indirect(struct iinfo *ind, int indblocks, int level,
for (h = 0; h < level; h++)
print_gfs2(" ");
}
- print_gfs2("%d => ", pndx);
+ print_gfs2("%d: 0x%"PRIx64" => ", pndx, ind->ii[pndx].ptroff);
if (termlines)
move(line,9);
print_gfs2("0x%"PRIx64" / %"PRId64, ind->ii[pndx].block,
diff --git a/gfs2/edit/gfs2hex.c b/gfs2/edit/gfs2hex.c
index 3d0f10d..8abadd2 100644
--- a/gfs2/edit/gfs2hex.c
+++ b/gfs2/edit/gfs2hex.c
@@ -255,6 +255,8 @@ void do_dinode_extended(struct gfs2_dinode *dine, struct gfs2_buffer_head *lbh)
indirect->ii[indirect_blocks].mp.mp_list[0] =
ptroff;
indirect->ii[indirect_blocks].is_dir = FALSE;
+ indirect->ii[indirect_blocks].ptroff =
+ (x - sizeof(*dine)) / sizeof(uint64_t);
indirect_blocks++;
}
ptroff++;
diff --git a/gfs2/edit/hexedit.h b/gfs2/edit/hexedit.h
index 4f7207b..d2992d8 100644
--- a/gfs2/edit/hexedit.h
+++ b/gfs2/edit/hexedit.h
@@ -81,6 +81,7 @@ struct indirect_info {
struct gfs2_leaf lf;
struct metapath mp;
struct gfs2_dirents dirent[64];
+ uint64_t ptroff;
};
struct iinfo {
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
6 years, 2 months