[gfs2-utils] branch master updated: fsck.gfs2: Fix declaration
mismatch for invalidate_*
by pagure@pagure.io
This is an automated email from the git hooks/post-receive script.
andyp pushed a commit to branch master
in repository gfs2-utils.
The following commit(s) were added to refs/heads/master by this push:
new fda789ce fsck.gfs2: Fix declaration mismatch for invalidate_*
fda789ce is described below
commit fda789cef3097fd779e25b2236fa7c86646a0a04
Author: Andrew Price <anprice(a)redhat.com>
AuthorDate: Tue Apr 27 11:04:57 2021 +0100
fsck.gfs2: Fix declaration mismatch for invalidate_*
Move the invalidate_fxns struct definition down so that the forward
declarations for those functions can be removed to avoid mismatches.
Fixes sparse error:
pass1.c:1146:12: error: symbol 'invalidate_data' redeclared with
different type (incompatible argument 6 (different base types))
Signed-off-by: Andrew Price <anprice(a)redhat.com>
---
gfs2/fsck/pass1.c | 34 ++++++++++------------------------
1 file changed, 10 insertions(+), 24 deletions(-)
diff --git a/gfs2/fsck/pass1.c b/gfs2/fsck/pass1.c
index 71d6a46d..0cd9b274 100644
--- a/gfs2/fsck/pass1.c
+++ b/gfs2/fsck/pass1.c
@@ -68,20 +68,6 @@ static int check_extended_leaf_eattr(struct gfs2_inode *ip, int i,
void *private);
static int finish_eattr_indir(struct gfs2_inode *ip, int leaf_pointers,
int leaf_pointer_errors, void *private);
-static int invalidate_metadata(struct iptr iptr, struct gfs2_buffer_head **bh, int h,
- int *is_valid, int *was_duplicate, void *private);
-static int invalidate_leaf(struct gfs2_inode *ip, uint64_t block,
- void *private);
-static int invalidate_data(struct gfs2_inode *ip, uint64_t metablock,
- uint64_t block, void *private,
- struct gfs2_buffer_head *bh, uint64_t *ptr);
-static int invalidate_eattr_indir(struct gfs2_inode *ip, uint64_t block,
- uint64_t parent,
- struct gfs2_buffer_head **bh,
- void *private);
-static int invalidate_eattr_leaf(struct gfs2_inode *ip, uint64_t block,
- uint64_t parent, struct gfs2_buffer_head **bh,
- void *private);
static int handle_ip(struct gfs2_sbd *sdp, struct gfs2_inode *ip);
static int delete_block(struct gfs2_inode *ip, uint64_t block,
struct gfs2_buffer_head **bh, const char *btype,
@@ -202,16 +188,6 @@ struct metawalk_fxns pass1_fxns = {
.delete_block = delete_block,
};
-struct metawalk_fxns invalidate_fxns = {
- .private = NULL,
- .check_metalist = invalidate_metadata,
- .check_data = invalidate_data,
- .check_leaf = invalidate_leaf,
- .check_eattr_indir = invalidate_eattr_indir,
- .check_eattr_leaf = invalidate_eattr_leaf,
- .delete_block = delete_block,
-};
-
/*
* resuscitate_metalist - make sure a system directory entry's metadata blocks
* are marked "in use" in the bitmap.
@@ -1169,6 +1145,16 @@ static int invalidate_eattr_leaf(struct gfs2_inode *ip, uint64_t block,
NULL, NULL);
}
+struct metawalk_fxns invalidate_fxns = {
+ .private = NULL,
+ .check_metalist = invalidate_metadata,
+ .check_data = invalidate_data,
+ .check_leaf = invalidate_leaf,
+ .check_eattr_indir = invalidate_eattr_indir,
+ .check_eattr_leaf = invalidate_eattr_leaf,
+ .delete_block = delete_block,
+};
+
/**
* Check for massive amounts of pointer corruption. If the block has
* lots of out-of-range pointers, we can't trust any of the pointers.
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
2 years, 11 months
[gfs2-utils] 05/05: fsck.gfs2: Add partial extent-based inode support
by pagure@pagure.io
This is an automated email from the git hooks/post-receive script.
andyp pushed a commit to branch andyp-extents
in repository gfs2-utils.
commit 8747d9003ae4219ec6a2b8790075ec3d5fd0aa13
Author: Andreas Gruenbacher <agruenba(a)redhat.com>
AuthorDate: Wed Apr 21 20:52:31 2021 +0200
fsck.gfs2: Add partial extent-based inode support
Signed-off-by: Andreas Gruenbacher <agruenba(a)redhat.com>
---
gfs2/fsck/metawalk.c | 185 ++++++++++++++++++++++++++++++++++++++-------------
1 file changed, 140 insertions(+), 45 deletions(-)
diff --git a/gfs2/fsck/metawalk.c b/gfs2/fsck/metawalk.c
index 8b721015..62476ab8 100644
--- a/gfs2/fsck/metawalk.c
+++ b/gfs2/fsck/metawalk.c
@@ -1446,38 +1446,93 @@ static int metawalk_check_data(struct gfs2_inode *ip, struct metawalk_fxns *pass
struct gfs2_buffer_head *bh, unsigned int height,
uint64_t *blks_checked, struct error_block *error_blk)
{
- int error = 0, rc = 0;
+ int error = 0, rc;
uint64_t block;
- __be64 *ptr_start = (uint64_t *)(bh->b_data + hdr_size(bh, height));
- __be64 *ptr_end = (uint64_t *)(bh->b_data + ip->i_sbd->bsize);
- __be64 *ptr;
uint64_t metablock = bh->b_blocknr;
/* If there isn't much pointer corruption check the pointers */
log_debug("Processing data blocks for inode 0x%llx, metadata block 0x%llx.\n",
(unsigned long long)ip->i_di.di_num.no_addr,
(unsigned long long)metablock);
- for (ptr = ptr_start ; ptr < ptr_end && !fsck_abort; ptr++) {
- if (!*ptr)
- continue;
- if (skip_this_pass || fsck_abort)
- return error;
- block = be64_to_cpu(*ptr);
- /* It's important that we don't call valid_block() and
- bypass calling check_data on invalid blocks because that
- would defeat the rangecheck_block related functions in
- pass1. Therefore the individual check_data functions
- should do a range check. */
- rc = pass->check_data(ip, metablock, block, pass->private,
- bh, ptr);
- if (rc && (!error || (rc < error))) {
- report_data_error(metablock, (char *)ptr - bh->b_data, block, error_blk, rc, error);
- error = rc;
+ /* It's important that we don't call valid_block() and
+ bypass calling check_data on invalid blocks because that
+ would defeat the rangecheck_block related functions in
+ pass1. Therefore the individual check_data functions
+ should do a range check. */
+
+ if (ip->i_di.di_flags & GFS2_DIF_EXTENTS) {
+ unsigned int max_extents = (ip->i_sbd->bsize - hdr_size(bh, height)) /
+ sizeof(struct gfs2_extent);
+ struct gfs2_extent_header *eh = (struct gfs2_extent_header *)
+ (bh->b_data + hdr_size(bh, height));
+ struct gfs2_extent *first_ex = (struct gfs2_extent *)(eh + 1);
+ unsigned int extents = be16_to_cpu(eh->eh_entries);
+ struct gfs2_extent *ex;
+
+ if (extents > max_extents) {
+ log_err(_("Inode %"PRId64" (0x%"PRIx64") has a "
+ "number of extents greater than %u.\n"),
+ ip->i_di.di_num.no_addr,
+ ip->i_di.di_num.no_addr,
+ max_extents);
+ return META_ERROR;
+ }
+
+ for (ex = first_ex; ex != first_ex + extents && !fsck_abort; ex++) {
+ uint64_t first_block = be64_to_cpu(ex->ex_addr);
+ unsigned int len = be16_to_cpu(ex->ex_len);
+
+ /* if (!ex->ex_addr || !ex->ex_len || too_big(ex->ex_len)) */
+
+ for (block = first_block; block < first_block + len; block++) {
+ __be64 dummy = cpu_to_be64(-1);
+
+ /*
+ * FIXME: We cannot relocate or free blocks in
+ * the middle of an extent without rewriting
+ * the extent tree, which may require an
+ * allocation; handling this in clone_data()
+ * won't work.
+ */
+
+ if (skip_this_pass || fsck_abort)
+ return error;
+ rc = pass->check_data(ip, metablock, block, pass->private,
+ bh, &dummy);
+ if (rc && (!error || (rc < error))) {
+ report_data_error(metablock, (char *)ex - bh->b_data,
+ block, error_blk, rc, error);
+ error = rc;
+ }
+ if (rc < 0)
+ return rc;
+ (*blks_checked)++;
+ }
+ }
+ } else {
+ __be64 *ptr_start = (uint64_t *)(bh->b_data + hdr_size(bh, height));
+ __be64 *ptr_end = (uint64_t *)(bh->b_data + ip->i_sbd->bsize);
+ __be64 *ptr;
+
+ for (ptr = ptr_start ; ptr < ptr_end && !fsck_abort; ptr++) {
+ if (!*ptr)
+ continue;
+
+ if (skip_this_pass || fsck_abort)
+ return error;
+ block = be64_to_cpu(*ptr);
+ rc = pass->check_data(ip, metablock, block, pass->private,
+ bh, ptr);
+ if (rc && (!error || (rc < error))) {
+ report_data_error(metablock, (char *)ptr - bh->b_data,
+ block, error_blk, rc, error);
+ error = rc;
+ }
+ if (rc < 0)
+ return rc;
+ (*blks_checked)++;
}
- if (rc < 0)
- return rc;
- (*blks_checked)++;
}
return error;
}
@@ -1515,28 +1570,54 @@ static int undo_check_data(struct gfs2_inode *ip, struct metawalk_fxns *pass,
struct gfs2_buffer_head *bh, unsigned int height,
struct error_block *error_blk, int error)
{
- __be64 *ptr_start = (uint64_t *)(bh->b_data + hdr_size(bh, height));
- __be64 *ptr_end = (uint64_t *)(bh->b_data + ip->i_sbd->bsize);
- __be64 *ptr;
uint64_t metablock = bh->b_blocknr;
- int rc = 0;
+ int rc;
uint64_t block;
int found_error_blk = 0;
/* If there isn't much pointer corruption check the pointers */
- for (ptr = ptr_start ; ptr < ptr_end && !fsck_abort; ptr++) {
- if (!*ptr)
- continue;
- if (skip_this_pass || fsck_abort)
- return 1;
- block = be64_to_cpu(*ptr);
- if (report_undo_data_error(metablock, (char *)ptr - bh->b_data,
- block, error_blk, &found_error_blk, error))
- return 1;
- rc = pass->undo_check_data(ip, block, pass->private);
- if (rc < 0)
- return rc;
+ if (ip->i_di.di_flags & GFS2_DIF_EXTENTS) {
+ struct gfs2_extent_header *eh = (struct gfs2_extent_header *)
+ (bh->b_data + hdr_size(bh, height));
+ struct gfs2_extent *first_ex = (struct gfs2_extent *)(eh + 1);
+ unsigned int extents = be16_to_cpu(eh->eh_entries);
+ struct gfs2_extent *ex;
+
+ for (ex = first_ex; ex != first_ex + extents && !fsck_abort; ex++) {
+ uint64_t first_block = be64_to_cpu(ex->ex_addr);
+ unsigned int len = be16_to_cpu(ex->ex_len);
+
+ for (block = first_block; block < first_block + len; block++) {
+ if (skip_this_pass || fsck_abort)
+ return 1;
+ if (report_undo_data_error(metablock, (char *)ex - bh->b_data,
+ block, error_blk, &found_error_blk, error))
+ return 1;
+ rc = pass->undo_check_data(ip, block, pass->private);
+ if (rc < 0)
+ return rc;
+ }
+ }
+ } else {
+ __be64 *ptr_start = (uint64_t *)(bh->b_data + hdr_size(bh, height));
+ __be64 *ptr_end = (uint64_t *)(bh->b_data + ip->i_sbd->bsize);
+ __be64 *ptr;
+
+ for (ptr = ptr_start ; ptr < ptr_end && !fsck_abort; ptr++) {
+ if (!*ptr)
+ continue;
+
+ if (skip_this_pass || fsck_abort)
+ return 1;
+ block = be64_to_cpu(*ptr);
+ if (report_undo_data_error(metablock, (char *)ptr - bh->b_data,
+ block, error_blk, &found_error_blk, error))
+ return 1;
+ rc = pass->undo_check_data(ip, block, pass->private);
+ if (rc < 0)
+ return rc;
+ }
}
return found_error_blk;
}
@@ -1562,7 +1643,7 @@ int check_metatree(struct gfs2_inode *ip, struct metawalk_fxns *pass)
struct gfs2_buffer_head *bh;
unsigned int i;
uint64_t blks_checked = 0;
- int error, rc;
+ int error = 0, rc;
int metadata_clean = 0;
struct error_block error_blk = {0, 0, 0};
int hit_error_blk = 0;
@@ -1574,11 +1655,25 @@ int check_metatree(struct gfs2_inode *ip, struct metawalk_fxns *pass)
for (i = 0; i <= height; i++)
osi_list_init(&metalist[i]);
- /* create and check the metadata list for each height */
- error = build_and_check_metalist(ip, metalist, pass);
- if (error) {
- stack;
- goto undo_metalist;
+ if (ip->i_di.di_flags & GFS2_DIF_EXTENTS) {
+ if (height > 1) {
+ log_err(_("Inode %"PRId64" (0x%"PRIx64") has an "
+ "extent tree height greater than %u.\n"),
+ ip->i_di.di_num.no_addr,
+ ip->i_di.di_num.no_addr,
+ 1);
+ error = META_ERROR;
+ goto undo_metalist;
+ }
+ /* make sure we check the inode below */
+ osi_list_add(&ip->i_bh->b_altlist, metalist);
+ } else {
+ /* create and check the metadata list for each height */
+ error = build_and_check_metalist(ip, metalist, pass);
+ if (error) {
+ stack;
+ goto undo_metalist;
+ }
}
metadata_clean = 1;
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
2 years, 12 months
[gfs2-utils] 04/05: gfs2_edit: Display extents in dinode blocks
by pagure@pagure.io
This is an automated email from the git hooks/post-receive script.
andyp pushed a commit to branch andyp-extents
in repository gfs2-utils.
commit 0e740603298e90fe3937cee28d3bdd4997181698
Author: Andrew Price <anprice(a)redhat.com>
AuthorDate: Wed Apr 21 15:36:11 2021 +0100
gfs2_edit: Display extents in dinode blocks
Signed-off-by: Andrew Price <anprice(a)redhat.com>
---
gfs2/edit/gfs2hex.c | 20 +++++++++++++++++++-
1 file changed, 19 insertions(+), 1 deletion(-)
diff --git a/gfs2/edit/gfs2hex.c b/gfs2/edit/gfs2hex.c
index 5e79009a..e1fc5dcb 100644
--- a/gfs2/edit/gfs2hex.c
+++ b/gfs2/edit/gfs2hex.c
@@ -238,7 +238,7 @@ void do_dinode_extended(struct gfs2_dinode *dine, char *buf)
indirect_blocks = 0;
memset(indirect, 0, sizeof(struct iinfo));
- if (dine->di_height > 0) {
+ if (dine->di_height > 0 && !(dine->di_flags & GFS2_DIF_EXTENTS)) {
/* Indirect pointers */
for (x = sizeof(struct gfs2_dinode); x < sbd.bsize;
x += sizeof(uint64_t)) {
@@ -448,6 +448,22 @@ static void gfs1_rgrp_print(struct gfs_rgrp *rg)
pv(rg, rg_freemeta, "%"PRIu32, "0x%"PRIx32);
}
+static void display_extents(void *buf)
+{
+ struct gfs2_extent_header *eh = buf;
+ struct gfs2_extent *ex = (void *)(eh + 1);
+ uint16_t entries = be16_to_cpu(eh->eh_entries);
+
+ print_gfs2("Extent header:");
+ eol(0);
+ lgfs2_extent_header_print(eh);
+ for (int i = 0; i < entries; i++) {
+ print_gfs2("Extent %d:", i);
+ eol(0);
+ lgfs2_extent_print(&ex[i]);
+ }
+}
+
int display_gfs2(char *buf)
{
struct gfs2_meta_header mh;
@@ -497,6 +513,8 @@ int display_gfs2(char *buf)
case GFS2_METATYPE_DI:
gfs2_dinode_print(&di);
+ if (di.di_flags & GFS2_DIF_EXTENTS)
+ display_extents(buf + sizeof(di));
break;
case GFS2_METATYPE_IN:
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
2 years, 12 months
[gfs2-utils] 03/05: libgfs2: Add functions for printing struct
gfs2_extent(_header)
by pagure@pagure.io
This is an automated email from the git hooks/post-receive script.
andyp pushed a commit to branch andyp-extents
in repository gfs2-utils.
commit 534c6da9cd68931fa14603f35b08cc1af040fd82
Author: Andrew Price <anprice(a)redhat.com>
AuthorDate: Wed Apr 21 15:31:40 2021 +0100
libgfs2: Add functions for printing struct gfs2_extent(_header)
It makes more sense to convert the big-endian values as we print them
instead of having a separate conversion step, so provide new macros to
simplify that.
Signed-off-by: Andrew Price <anprice(a)redhat.com>
---
gfs2/libgfs2/libgfs2.h | 3 +++
gfs2/libgfs2/ondisk.c | 26 ++++++++++++++++++++++++++
2 files changed, 29 insertions(+)
diff --git a/gfs2/libgfs2/libgfs2.h b/gfs2/libgfs2/libgfs2.h
index 65e1b8c8..ba556151 100644
--- a/gfs2/libgfs2/libgfs2.h
+++ b/gfs2/libgfs2/libgfs2.h
@@ -741,6 +741,9 @@ extern void gfs2_log_header_print(const struct gfs2_log_header *lh);
extern void gfs2_log_descriptor_print(const struct gfs2_log_descriptor *ld);
extern void gfs2_statfs_change_print(const struct gfs2_statfs_change *sc);
extern void gfs2_quota_change_print(const struct gfs2_quota_change *qc);
+/* These expect on-disk data instead of native-endian structs */
+extern void lgfs2_extent_header_print(void *ehp);
+extern void lgfs2_extent_print(void *exp);
__END_DECLS
diff --git a/gfs2/libgfs2/ondisk.c b/gfs2/libgfs2/ondisk.c
index 35a0b3db..e46073e3 100644
--- a/gfs2/libgfs2/ondisk.c
+++ b/gfs2/libgfs2/ondisk.c
@@ -16,6 +16,15 @@
print_it(" ", fmt, fmt2, struct->member); \
} while (0);
+#define printbe16(struct, member) do { \
+ print_it(" "#member, "%"PRIu16, "0x%"PRIx16, be16_to_cpu(struct->member)); \
+ } while(0)
+#define printbe32(struct, member) do { \
+ print_it(" "#member, "%"PRIu32, "0x%"PRIx32, be32_to_cpu(struct->member)); \
+ } while(0)
+#define printbe64(struct, member) do { \
+ print_it(" "#member, "%"PRIu64, "0x%"PRIx64, be64_to_cpu(struct->member)); \
+ } while(0)
#define CPIN_08(s1, s2, member, count) {memcpy((s1->member), (s2->member), (count));}
#define CPOUT_08(s1, s2, member, count) {memcpy((s2->member), (s1->member), (count));}
@@ -375,6 +384,23 @@ void gfs2_dinode_print(const struct gfs2_dinode *di)
pv(di, di_eattr, "%"PRIu64, "0x%"PRIx64);
}
+void lgfs2_extent_header_print(void *ehp)
+{
+ struct gfs2_extent_header *eh = ehp;
+
+ printbe16(eh, eh_entries);
+}
+
+void lgfs2_extent_print(void *exp)
+{
+ struct gfs2_extent *ex = exp;
+
+ printbe64(ex, ex_start);
+ printbe64(ex, ex_addr);
+ printbe16(ex, ex_len);
+ printbe16(ex, ex_flags);
+}
+
void gfs2_dirent_in(struct gfs2_dirent *de, char *buf)
{
struct gfs2_dirent *str = (struct gfs2_dirent *)buf;
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
2 years, 12 months
[gfs2-utils] 02/05: libgfs2: Add support for new extent structs to
meta.c
by pagure@pagure.io
This is an automated email from the git hooks/post-receive script.
andyp pushed a commit to branch andyp-extents
in repository gfs2-utils.
commit 374ddbd60cb66b5d6e99faeae98058d9518e06a4
Author: Andrew Price <anprice(a)redhat.com>
AuthorDate: Mon Apr 19 16:01:14 2021 +0100
libgfs2: Add support for new extent structs to meta.c
Signed-off-by: Andrew Price <anprice(a)redhat.com>
---
gfs2/libgfs2/libgfs2.h | 3 +++
gfs2/libgfs2/meta.c | 59 ++++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 62 insertions(+)
diff --git a/gfs2/libgfs2/libgfs2.h b/gfs2/libgfs2/libgfs2.h
index 3f36ffb2..65e1b8c8 100644
--- a/gfs2/libgfs2/libgfs2.h
+++ b/gfs2/libgfs2/libgfs2.h
@@ -88,6 +88,9 @@ enum lgfs2_meta_type {
LGFS2_MT_GFS_BLOCK_TAG = 25,
LGFS2_MT_DATA = 26,
LGFS2_MT_FREE = 27,
+ LGFS2_MT_GFS2_EXTENT_HEADER = 28,
+ LGFS2_MT_GFS2_EXTENT_IDX = 29,
+ LGFS2_MT_GFS2_EXTENT = 30,
LGFS2_MT_NR,
};
diff --git a/gfs2/libgfs2/meta.c b/gfs2/libgfs2/meta.c
index db5f37b1..c082f198 100644
--- a/gfs2/libgfs2/meta.c
+++ b/gfs2/libgfs2/meta.c
@@ -23,6 +23,8 @@ SYM(GFS2_METATYPE_LB)
SYM(GFS2_METATYPE_EA)
SYM(GFS2_METATYPE_ED)
SYM(GFS2_METATYPE_QC)
+SYM(GFS2_METATYPE_XI)
+SYM(GFS2_METATYPE_XL)
};
const unsigned lgfs2_metatype_size = ARRAY_SIZE(lgfs2_metatypes);
@@ -42,6 +44,8 @@ SYM(GFS2_FORMAT_LB)
SYM(GFS2_FORMAT_EA)
SYM(GFS2_FORMAT_ED)
SYM(GFS2_FORMAT_QC)
+SYM(GFS2_FORMAT_XI)
+SYM(GFS2_FORMAT_XL)
SYM(GFS2_FORMAT_RI)
SYM(GFS2_FORMAT_DE)
SYM(GFS2_FORMAT_QU)
@@ -60,6 +64,7 @@ SYM(GFS2_DIF_APPENDONLY)
SYM(GFS2_DIF_NOATIME)
SYM(GFS2_DIF_SYNC)
SYM(GFS2_DIF_SYSTEM)
+SYM(GFS2_DIF_EXTENTS)
SYM(GFS2_DIF_TRUNC_IN_PROG)
SYM(GFS2_DIF_INHERIT_DIRECTIO)
SYM(GFS2_DIF_INHERIT_JDATA)
@@ -118,6 +123,10 @@ SYM(GFS_LOG_DESC_LAST)
const unsigned int lgfs2_ld1_type_size = ARRAY_SIZE(lgfs2_ld1_types);
+const struct lgfs2_symbolic lgfs2_ex_flags[] = {
+SYM(GFS2_EF_UNWRITTEN)
+};
+
#undef SYM
@@ -325,6 +334,32 @@ FP(di_eattr, .points_to = (1 << LGFS2_MT_EA_ATTR)|(1 << LGFS2_MT_GFS_INDIRECT))
F(di_reserved)
};
+#undef STRUCT
+#define STRUCT gfs2_extent_header
+
+static const struct lgfs2_metafield gfs2_extent_header_fields[] = {
+F(eh_entries)
+F(eh_pad)
+};
+
+#undef STRUCT
+#define STRUCT gfs2_extent_idx
+
+static const struct lgfs2_metafield gfs2_extent_idx_fields[] = {
+F(ei_start)
+F(ei_leaf)
+};
+
+#undef STRUCT
+#define STRUCT gfs2_extent
+
+static const struct lgfs2_metafield gfs2_extent_fields[] = {
+F(ex_start)
+F(ex_addr)
+F(ex_len, .flags = LGFS2_MFF_FSBLOCKS)
+F(ex_flags, .flags = LGFS2_MFF_MASK, .symtab=lgfs2_ex_flags, .nsyms=ARRAY_SIZE(lgfs2_ex_flags))
+};
+
#undef STRUCT
struct gfs2_indirect { struct gfs2_meta_header in_header; };
#define STRUCT gfs2_indirect
@@ -616,6 +651,30 @@ const struct lgfs2_metadata lgfs2_metadata[] = {
.nfields = ARRAY_SIZE(gfs_dinode_fields),
.size = sizeof(struct gfs_dinode),
},
+ [LGFS2_MT_GFS2_EXTENT_HEADER] = {
+ .versions = LGFS2_MD_GFS2,
+ .name = "gfs2_extent_header",
+ .display = "extent header",
+ .fields = gfs2_extent_header_fields,
+ .nfields = ARRAY_SIZE(gfs2_extent_header_fields),
+ .size = sizeof(struct gfs2_extent_header),
+ },
+ [LGFS2_MT_GFS2_EXTENT_IDX] = {
+ .versions = LGFS2_MD_GFS2,
+ .name = "gfs2_extent_idx",
+ .display = "extent index",
+ .fields = gfs2_extent_idx_fields,
+ .nfields = ARRAY_SIZE(gfs2_extent_idx_fields),
+ .size = sizeof(struct gfs2_extent_idx),
+ },
+ [LGFS2_MT_GFS2_EXTENT] = {
+ .versions = LGFS2_MD_GFS2,
+ .name = "gfs2_extent",
+ .display = "extent",
+ .fields = gfs2_extent_fields,
+ .nfields = ARRAY_SIZE(gfs2_extent_fields),
+ .size = sizeof(struct gfs2_extent),
+ },
[LGFS2_MT_GFS2_INDIRECT] = {
.versions = LGFS2_MD_GFS2,
.header = 1,
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
2 years, 12 months
[gfs2-utils] 01/05: Add extents structs to gfs2_ondisk.h
by pagure@pagure.io
This is an automated email from the git hooks/post-receive script.
andyp pushed a commit to branch andyp-extents
in repository gfs2-utils.
commit e1c1aa363f3efae02b788fa241c1414b9c90640f
Author: Andrew Price <anprice(a)redhat.com>
AuthorDate: Wed Apr 21 10:29:27 2021 +0100
Add extents structs to gfs2_ondisk.h
gfs2_ondisk.h from linux-gfs2.git#extents 114e06345e5b
Signed-off-by: Andrew Price <anprice(a)redhat.com>
---
gfs2/include/linux/gfs2_ondisk.h | 24 ++++++++++++++++++++++++
1 file changed, 24 insertions(+)
diff --git a/gfs2/include/linux/gfs2_ondisk.h b/gfs2/include/linux/gfs2_ondisk.h
index fc948f89..ebba81c9 100644
--- a/gfs2/include/linux/gfs2_ondisk.h
+++ b/gfs2/include/linux/gfs2_ondisk.h
@@ -42,6 +42,8 @@
#define GFS2_FORMAT_EA 1600
#define GFS2_FORMAT_ED 1700
#define GFS2_FORMAT_QC 1400
+#define GFS2_FORMAT_XI 1500
+#define GFS2_FORMAT_XL 1600
/* These are format numbers for entities contained in files */
#define GFS2_FORMAT_RI 1100
#define GFS2_FORMAT_DE 1200
@@ -78,6 +80,8 @@ struct gfs2_inum {
#define GFS2_METATYPE_EA 10
#define GFS2_METATYPE_ED 11
#define GFS2_METATYPE_QC 14
+#define GFS2_METATYPE_XI 15
+#define GFS2_METATYPE_XL 16
struct gfs2_meta_header {
__be32 mh_magic;
@@ -258,6 +262,7 @@ enum {
#define GFS2_DIF_SYNC 0x00000100
#define GFS2_DIF_SYSTEM 0x00000200 /* New in gfs2 */
#define GFS2_DIF_TOPDIR 0x00000400 /* New in gfs2 */
+#define GFS2_DIF_EXTENTS 0x00000800 /* New in gfs2 */
#define GFS2_DIF_TRUNC_IN_PROG 0x20000000 /* New in gfs2 */
#define GFS2_DIF_INHERIT_DIRECTIO 0x40000000 /* only in gfs1 */
#define GFS2_DIF_INHERIT_JDATA 0x80000000
@@ -307,6 +312,25 @@ struct gfs2_dinode {
__u8 di_reserved[44];
};
+struct gfs2_extent_header {
+ __be16 eh_entries;
+ __be16 eh_pad;
+};
+
+struct gfs2_extent_idx {
+ __be64 ei_start;
+ __be64 ei_leaf;
+} __attribute__((packed, aligned(4)));
+
+#define GFS2_EF_UNWRITTEN 1
+
+struct gfs2_extent {
+ __be64 ex_start;
+ __be64 ex_addr;
+ __be16 ex_len;
+ __be16 ex_flags; /* GFS2_EF_... */
+} __attribute__((packed, aligned(4)));
+
/*
* directory structure - many of these per directory file
*/
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
2 years, 12 months
[gfs2-utils] branch andyp-extents updated (22ecaa4e -> 8747d900)
by pagure@pagure.io
This is an automated email from the git hooks/post-receive script.
andyp pushed a change to branch andyp-extents
in repository gfs2-utils.
omit 22ecaa4e gfs2_edit: Display extents in dinode blocks
omit a1b37270 libgfs2: Add functions for printing struct gfs2_extent(_header)
omit 13a5b7e6 libgfs2: Add support for new extent structs to meta.c
omit c6ce8dcb Add extents structs to gfs2_ondisk.h
add 112d6b40 fsck.gfs2: Clean up metawalk_check_data and undo_check_data argument passing
add 98811a57 fsck.gfs2: Minor data type cleanups
add 63c721b0 fsck.gfs2: More flexible metalist handling in check_metatree
add dea6f4d9 fsck.gfs2: Move struct error_block into metawalk.c
add e5afb2b3 fsck.gfs2: Fix some endianness annotations
add 99c46eed fsck.gfs2: Factor out error handling in metawalk_check_data
add 6b8677e5 fsck.gfs2: Convert enum values to upper-case
add f6d245be Remove gfs2/include/linux_endian.h
add 6eaac53e libgfs2: Add __force tags to endianness conversion macros
new e1c1aa36 Add extents structs to gfs2_ondisk.h
new 374ddbd6 libgfs2: Add support for new extent structs to meta.c
new 534c6da9 libgfs2: Add functions for printing struct gfs2_extent(_header)
new 0e740603 gfs2_edit: Display extents in dinode blocks
new 8747d900 fsck.gfs2: Add partial extent-based inode support
This update added new revisions after undoing existing revisions.
That is to say, some revisions that were in the old version of the
branch are not in the new version. This situation occurs
when a user --force pushes a change and generates a repository
containing something like this:
* -- * -- B -- O -- O -- O (22ecaa4e)
\
N -- N -- N refs/heads/andyp-extents (8747d900)
You should already have received notification emails for all of the O
revisions, and so the following emails describe only the N revisions
from the common base, B.
Any revisions marked "omit" are not gone; other references still
refer to them. Any revisions marked "discard" are gone forever.
The 5 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
Summary of changes:
gfs2/convert/gfs2_convert.c | 2 +-
gfs2/fsck/afterpass1_common.c | 10 +-
gfs2/fsck/afterpass1_common.h | 2 +-
gfs2/fsck/fs_recovery.c | 10 +-
gfs2/fsck/fsck.h | 28 ++-
gfs2/fsck/initialize.c | 4 +-
gfs2/fsck/link.c | 16 +-
gfs2/fsck/link.h | 8 +-
gfs2/fsck/metawalk.c | 403 +++++++++++++++++++++++++++---------------
gfs2/fsck/metawalk.h | 10 +-
gfs2/fsck/pass1.c | 88 ++++-----
gfs2/fsck/pass1b.c | 74 ++++----
gfs2/fsck/pass2.c | 8 +-
gfs2/fsck/rgrepair.c | 28 +--
gfs2/fsck/util.c | 24 +--
gfs2/fsck/util.h | 2 +-
gfs2/include/Makefile.am | 1 -
gfs2/include/linux/types.h | 3 +
gfs2/include/linux_endian.h | 68 -------
gfs2/libgfs2/libgfs2.h | 49 +++--
gfs2/tune/super.c | 1 -
21 files changed, 442 insertions(+), 397 deletions(-)
delete mode 100644 gfs2/include/linux_endian.h
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
2 years, 12 months
[gfs2-utils] 09/09: libgfs2: Add __force tags to endianness
conversion macros
by pagure@pagure.io
This is an automated email from the git hooks/post-receive script.
andyp pushed a commit to branch master
in repository gfs2-utils.
commit 6eaac53e9a1e9f1a38f29e47f17175257ba1fcaa
Author: Andrew Price <anprice(a)redhat.com>
AuthorDate: Tue Apr 20 17:37:09 2021 +0100
libgfs2: Add __force tags to endianness conversion macros
The __be* on-disk field types are annotated with __bitwise, which causes
sparse to recognise them as conflicting with non-__bitwise types, but
the endianness conversion macros don't have the required annotations to
tell sparse when to resolve the conflicts instead of flagging a warning.
Add __force annotations to the conversion macros.
This clears up a handful of sparse warnings but the anti-pattern of
storing cpu-endian values in the on-disk structs is still common (see
libgfs2/ondisk.c), so there are still some to be resolved.
Signed-off-by: Andrew Price <anprice(a)redhat.com>
---
gfs2/convert/gfs2_convert.c | 2 +-
gfs2/include/linux/types.h | 3 +++
gfs2/libgfs2/libgfs2.h | 49 ++++++++++++++++++++++-----------------------
3 files changed, 28 insertions(+), 26 deletions(-)
diff --git a/gfs2/convert/gfs2_convert.c b/gfs2/convert/gfs2_convert.c
index 5656b39d..ded2589e 100644
--- a/gfs2/convert/gfs2_convert.c
+++ b/gfs2/convert/gfs2_convert.c
@@ -1201,7 +1201,7 @@ static int process_dirent_info(struct gfs2_inode *dip, struct gfs2_sbd *sbp,
/* Only do this if the dent was a true gfs1 dent, and not a */
/* gfs2 dent converted from a previously aborted run. */
if (dent_was_gfs1) {
- switch be16_to_cpu(dent->de_type) {
+ switch (be16_to_cpu(dent->de_type)) {
case GFS_FILE_NON:
dent->de_type = cpu_to_be16(DT_UNKNOWN);
break;
diff --git a/gfs2/include/linux/types.h b/gfs2/include/linux/types.h
index 7f4d4b98..a092afc0 100644
--- a/gfs2/include/linux/types.h
+++ b/gfs2/include/linux/types.h
@@ -7,10 +7,13 @@
#ifdef __CHECKER__
#define __bitwise__ __attribute__((bitwise))
+#define __force__ __attribute__((force))
#else
#define __bitwise__
+#define __force__
#endif
#define __bitwise __bitwise__
+#define __force __force__
typedef uint8_t __u8;
typedef uint16_t __u16;
diff --git a/gfs2/libgfs2/libgfs2.h b/gfs2/libgfs2/libgfs2.h
index d8afc100..3f36ffb2 100644
--- a/gfs2/libgfs2/libgfs2.h
+++ b/gfs2/libgfs2/libgfs2.h
@@ -21,42 +21,41 @@ __BEGIN_DECLS
#if __BYTE_ORDER == __BIG_ENDIAN
-#define be16_to_cpu(x) (x)
-#define be32_to_cpu(x) (x)
-#define be64_to_cpu(x) (x)
+#define be16_to_cpu(x) ((__force uint16_t)(__be16)(x))
+#define be32_to_cpu(x) ((__force uint32_t)(__be32)(x))
+#define be64_to_cpu(x) ((__force uint64_t)(__be64)(x))
-#define cpu_to_be16(x) (x)
-#define cpu_to_be32(x) (x)
-#define cpu_to_be64(x) (x)
+#define cpu_to_be16(x) ((__force __be16)(uint16_t)(x))
+#define cpu_to_be32(x) ((__force __be32)(uint32_t)(x))
+#define cpu_to_be64(x) ((__force __be64)(uint64_t)(x))
-#define le16_to_cpu(x) (bswap_16((x)))
-#define le32_to_cpu(x) (bswap_32((x)))
-#define le64_to_cpu(x) (bswap_64((x)))
+#define le16_to_cpu(x) bswap_16((__force uint16_t)(__le16)(x))
+#define le32_to_cpu(x) bswap_32((__force uint32_t)(__le32)(x))
+#define le64_to_cpu(x) bswap_64((__force uint64_t)(__le64)(x))
-#define cpu_to_le16(x) (bswap_16((x)))
-#define cpu_to_le32(x) (bswap_32((x)))
-#define cpu_to_le64(x) (bswap_64((x)))
+#define cpu_to_le16(x) ((__force __le16)bswap_16((x)))
+#define cpu_to_le32(x) ((__force __le32)bswap_32((x)))
+#define cpu_to_le64(x) ((__force __le64)bswap_64((x)))
#endif /* __BYTE_ORDER == __BIG_ENDIAN */
-
#if __BYTE_ORDER == __LITTLE_ENDIAN
-#define be16_to_cpu(x) (bswap_16((x)))
-#define be32_to_cpu(x) (bswap_32((x)))
-#define be64_to_cpu(x) (bswap_64((x)))
+#define be16_to_cpu(x) bswap_16((__force uint16_t)(__be16)(x))
+#define be32_to_cpu(x) bswap_32((__force uint32_t)(__be32)(x))
+#define be64_to_cpu(x) bswap_64((__force uint64_t)(__be64)(x))
-#define cpu_to_be16(x) (bswap_16((x)))
-#define cpu_to_be32(x) (bswap_32((x)))
-#define cpu_to_be64(x) (bswap_64((x)))
+#define cpu_to_be16(x) ((__force __be16)bswap_16((x)))
+#define cpu_to_be32(x) ((__force __be32)bswap_32((x)))
+#define cpu_to_be64(x) ((__force __be64)bswap_64((x)))
-#define le16_to_cpu(x) (x)
-#define le32_to_cpu(x) (x)
-#define le64_to_cpu(x) (x)
+#define le16_to_cpu(x) ((__force uint16_t)(__le16)(x))
+#define le32_to_cpu(x) ((__force uint32_t)(__le32)(x))
+#define le64_to_cpu(x) ((__force uint64_t)(__le64)(x))
-#define cpu_to_le16(x) (x)
-#define cpu_to_le32(x) (x)
-#define cpu_to_le64(x) (x)
+#define cpu_to_le16(x) ((__force __le16)(uint16_t)(x))
+#define cpu_to_le32(x) ((__force __le32)(uint32_t)(x))
+#define cpu_to_le64(x) ((__force __le64)(uint64_t)(x))
#endif /* __BYTE_ORDER == __LITTLE_ENDIAN */
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
2 years, 12 months
[gfs2-utils] 08/09: Remove gfs2/include/linux_endian.h
by pagure@pagure.io
This is an automated email from the git hooks/post-receive script.
andyp pushed a commit to branch master
in repository gfs2-utils.
commit f6d245be7b10d513e9a2ceb568c5c5c60324a660
Author: Andrew Price <anprice(a)redhat.com>
AuthorDate: Tue Apr 20 17:32:08 2021 +0100
Remove gfs2/include/linux_endian.h
Archaeology time. This header is a remnant of the integrated cluster.git
days and only tunegfs2 ever used it. The useful byte swapping functions
in it were added to libgfs2.h a long time ago so it is unneeded.
Signed-off-by: Andrew Price <anprice(a)redhat.com>
---
gfs2/include/Makefile.am | 1 -
gfs2/include/linux_endian.h | 68 ---------------------------------------------
gfs2/tune/super.c | 1 -
3 files changed, 70 deletions(-)
diff --git a/gfs2/include/Makefile.am b/gfs2/include/Makefile.am
index f9486288..c581e1db 100644
--- a/gfs2/include/Makefile.am
+++ b/gfs2/include/Makefile.am
@@ -3,7 +3,6 @@ MAINTAINERCLEANFILES = Makefile.in
noinst_HEADERS = \
osi_list.h \
osi_tree.h \
- linux_endian.h \
linux/gfs2_ondisk.h \
linux/types.h \
logging.h
diff --git a/gfs2/include/linux_endian.h b/gfs2/include/linux_endian.h
deleted file mode 100644
index 43089d2f..00000000
--- a/gfs2/include/linux_endian.h
+++ /dev/null
@@ -1,68 +0,0 @@
-#ifndef __LINUX_ENDIAN_DOT_H__
-#define __LINUX_ENDIAN_DOT_H__
-
-
-#include <endian.h>
-#include <byteswap.h>
-
-
-/* I'm not sure which versions of alpha glibc/gcc are broken,
- so fix all of them. */
-#ifdef __alpha__
-#undef bswap_64
-static __inline__ unsigned long bswap_64(unsigned long x)
-{
- unsigned int h = x >> 32;
- unsigned int l = x;
-
- h = bswap_32(h);
- l = bswap_32(l);
-
- return ((unsigned long)l << 32) | h;
-}
-#endif /* __alpha__ */
-
-
-#if __BYTE_ORDER == __BIG_ENDIAN
-
-#define be16_to_cpu(x) (x)
-#define be32_to_cpu(x) (x)
-#define be64_to_cpu(x) (x)
-
-#define cpu_to_be16(x) (x)
-#define cpu_to_be32(x) (x)
-#define cpu_to_be64(x) (x)
-
-#define le16_to_cpu(x) (bswap_16((x)))
-#define le32_to_cpu(x) (bswap_32((x)))
-#define le64_to_cpu(x) (bswap_64((x)))
-
-#define cpu_to_le16(x) (bswap_16((x)))
-#define cpu_to_le32(x) (bswap_32((x)))
-#define cpu_to_le64(x) (bswap_64((x)))
-
-#endif /* __BYTE_ORDER == __BIG_ENDIAN */
-
-
-#if __BYTE_ORDER == __LITTLE_ENDIAN
-
-#define be16_to_cpu(x) (bswap_16((x)))
-#define be32_to_cpu(x) (bswap_32((x)))
-#define be64_to_cpu(x) (bswap_64((x)))
-
-#define cpu_to_be16(x) (bswap_16((x)))
-#define cpu_to_be32(x) (bswap_32((x)))
-#define cpu_to_be64(x) (bswap_64((x)))
-
-#define le16_to_cpu(x) (x)
-#define le32_to_cpu(x) (x)
-#define le64_to_cpu(x) (x)
-
-#define cpu_to_le16(x) (x)
-#define cpu_to_le32(x) (x)
-#define cpu_to_le64(x) (x)
-
-#endif /* __BYTE_ORDER == __LITTLE_ENDIAN */
-
-
-#endif /* __LINUX_ENDIAN_DOT_H__ */
diff --git a/gfs2/tune/super.c b/gfs2/tune/super.c
index 9e6578fb..3290a791 100644
--- a/gfs2/tune/super.c
+++ b/gfs2/tune/super.c
@@ -10,7 +10,6 @@
#include <string.h>
#include <libintl.h>
#define _(String) gettext(String)
-#include <linux_endian.h>
#include <libgfs2.h>
#include <uuid.h>
#include "tunegfs2.h"
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
2 years, 12 months
[gfs2-utils] 07/09: fsck.gfs2: Convert enum values to upper-case
by pagure@pagure.io
This is an automated email from the git hooks/post-receive script.
andyp pushed a commit to branch master
in repository gfs2-utils.
commit 6b8677e53e8ef318f088a8ff4c2fb94a594675c7
Author: Andreas Gruenbacher <agruenba(a)redhat.com>
AuthorDate: Thu Apr 22 20:45:01 2021 +0200
fsck.gfs2: Convert enum values to upper-case
Several of the enums in the fsck.gfs2 code use lower-case enum values, which
makes the code harder to read than necessary. Convert those to upper-case
with:
toupper() {
printf '%s\n' "$@" |
awk '{ print "s/\\<" $1 "\\>/" toupper($1) "/g" }'
}
toupper \
ref_as_data ref_as_meta ref_as_ea ref_is_inode ref_types \
blind_faith ye_of_little_faith open_minded distrust indignation \
incr_link_bad incr_link_good incr_link_ino_mismatch incr_link_check_orig \
meta_error meta_is_good meta_skip_further meta_skip_one \
btype_meta btype_leaf btype_data btype_ieattr btype_eattr \
| sed -i -f /dev/stdin $(git ls-files gfs2/fsck)
Signed-off-by: Andreas Gruenbacher <agruenba(a)redhat.com>
---
gfs2/fsck/afterpass1_common.c | 8 ++---
gfs2/fsck/fs_recovery.c | 8 ++---
gfs2/fsck/fsck.h | 22 ++++++------
gfs2/fsck/initialize.c | 4 +--
gfs2/fsck/link.c | 16 ++++-----
gfs2/fsck/link.h | 8 ++---
gfs2/fsck/metawalk.c | 24 ++++++-------
gfs2/fsck/metawalk.h | 8 ++---
gfs2/fsck/pass1.c | 78 +++++++++++++++++++++----------------------
gfs2/fsck/pass1b.c | 68 ++++++++++++++++++-------------------
gfs2/fsck/pass2.c | 6 ++--
gfs2/fsck/rgrepair.c | 28 ++++++++--------
gfs2/fsck/util.c | 24 ++++++-------
gfs2/fsck/util.h | 2 +-
14 files changed, 152 insertions(+), 152 deletions(-)
diff --git a/gfs2/fsck/afterpass1_common.c b/gfs2/fsck/afterpass1_common.c
index 646e4010..82b9a54c 100644
--- a/gfs2/fsck/afterpass1_common.c
+++ b/gfs2/fsck/afterpass1_common.c
@@ -39,7 +39,7 @@ static int find_remove_dup(struct gfs2_inode *ip, uint64_t block,
if (!id)
goto more_refs;
- if (id->reftypecount[ref_as_meta])
+ if (id->reftypecount[REF_AS_META])
deleted_a_meta_ref = 1;
dup_listent_delete(dt, id);
if (dt->refs == 0) {
@@ -82,7 +82,7 @@ static int delete_block_if_notdup(struct gfs2_inode *ip, uint64_t block,
int removed_lastmeta = 0;
if (!valid_block_ip(ip, block))
- return meta_error;
+ return META_ERROR;
q = bitmap_type(ip->i_sbd, block);
if (q == GFS2_BLKST_FREE) {
@@ -92,7 +92,7 @@ static int delete_block_if_notdup(struct gfs2_inode *ip, uint64_t block,
(unsigned long long)block,
(unsigned long long)ip->i_di.di_num.no_addr,
(unsigned long long)ip->i_di.di_num.no_addr);
- return meta_is_good;
+ return META_IS_GOOD;
}
if (find_remove_dup(ip, block, btype, &removed_lastmeta)) { /* a dup */
if (was_duplicate) {
@@ -111,7 +111,7 @@ static int delete_block_if_notdup(struct gfs2_inode *ip, uint64_t block,
check_n_fix_bitmap(ip->i_sbd, ip->i_rgd, block, 0,
GFS2_BLKST_FREE);
}
- return meta_is_good;
+ return META_IS_GOOD;
}
static int remove_dentry(struct gfs2_inode *ip, struct gfs2_dirent *dent,
diff --git a/gfs2/fsck/fs_recovery.c b/gfs2/fsck/fs_recovery.c
index 7bfddbfd..c7704b0e 100644
--- a/gfs2/fsck/fs_recovery.c
+++ b/gfs2/fsck/fs_recovery.c
@@ -628,9 +628,9 @@ static int rangecheck_jblock(struct gfs2_inode *ip, uint64_t block)
"journal inode %lld (0x%llx).\n"),
(unsigned long long)ip->i_di.di_num.no_addr,
(unsigned long long)ip->i_di.di_num.no_addr);
- return meta_error; /* Exits check_metatree quicker */
+ return META_ERROR; /* Exits check_metatree quicker */
}
- return meta_is_good;
+ return META_IS_GOOD;
}
static int rangecheck_jmeta(struct iptr iptr, struct gfs2_buffer_head **bh, int h,
@@ -644,7 +644,7 @@ static int rangecheck_jmeta(struct iptr iptr, struct gfs2_buffer_head **bh, int
*was_duplicate = 0;
*is_valid = 0;
rc = rangecheck_jblock(ip, block);
- if (rc == meta_is_good) {
+ if (rc == META_IS_GOOD) {
*bh = bread(ip->i_sbd, block);
*is_valid = (gfs2_check_meta((*bh)->b_data, GFS2_METATYPE_IN) == 0);
if (!(*is_valid)) {
@@ -658,7 +658,7 @@ static int rangecheck_jmeta(struct iptr iptr, struct gfs2_buffer_head **bh, int
(unsigned long long)block);
brelse(*bh);
*bh = NULL;
- return meta_skip_further;
+ return META_SKIP_FURTHER;
}
}
return rc;
diff --git a/gfs2/fsck/fsck.h b/gfs2/fsck/fsck.h
index aad9a360..16aab67d 100644
--- a/gfs2/fsck/fsck.h
+++ b/gfs2/fsck/fsck.h
@@ -74,36 +74,36 @@ struct duptree {
};
enum dup_ref_type {
- ref_as_data = 0, /* dinode references this block as a data block */
- ref_as_meta = 1, /* dinode references this block as a metadata block */
- ref_as_ea = 2, /* dinode references this block as an extended attr */
- ref_is_inode= 3, /* The reference is itself a dinode. In other words,
+ REF_AS_DATA = 0, /* dinode references this block as a data block */
+ REF_AS_META = 1, /* dinode references this block as a metadata block */
+ REF_AS_EA = 2, /* dinode references this block as an extended attr */
+ REF_IS_INODE= 3, /* The reference is itself a dinode. In other words,
it's a dinode, not pointed to as data or
metadata */
- ref_types = 4,
+ REF_TYPES = 4,
};
struct inode_with_dups {
osi_list_t list;
uint64_t block_no;
int dup_count;
- int reftypecount[ref_types];
+ int reftypecount[REF_TYPES];
uint64_t parent;
char *name;
};
enum rgindex_trust_level { /* how far can we trust our RG index? */
- blind_faith = 0, /* We'd like to trust the rgindex. We always used to
+ BLIND_FAITH = 0, /* We'd like to trust the rgindex. We always used to
before bz 179069. This should cover most cases. */
- ye_of_little_faith = 1, /* The rindex seems trustworthy but there's
+ YE_OF_LITTLE_FAITH = 1, /* The rindex seems trustworthy but there's
rg damage that need to be fixed. */
- open_minded = 2, /* At least 1 RG is corrupt. Try to calculate what it
+ OPEN_MINDED = 2, /* At least 1 RG is corrupt. Try to calculate what it
should be, in a perfect world where our RGs are all
on even boundaries. Blue sky. Chirping birds. */
- distrust = 3, /* The world isn't perfect, our RGs are not on nice neat
+ DISTRUST = 3, /* The world isn't perfect, our RGs are not on nice neat
boundaries. The fs must have been messed with by
gfs2_grow or something. Count the RGs by hand. */
- indignation = 4 /* Not only do we have corruption, but the rgrps
+ INDIGNATION = 4 /* Not only do we have corruption, but the rgrps
aren't on even boundaries, so this file system
must have been converted from gfs2_convert. */
};
diff --git a/gfs2/fsck/initialize.c b/gfs2/fsck/initialize.c
index 17f2d6cd..e35cf0a9 100644
--- a/gfs2/fsck/initialize.c
+++ b/gfs2/fsck/initialize.c
@@ -779,7 +779,7 @@ static int fetch_rgrps(struct gfs2_sbd *sdp)
int ok = 1;
log_notice(_("Validating resource group index.\n"));
- for (trust_lvl = blind_faith; trust_lvl <= indignation; trust_lvl++) {
+ for (trust_lvl = BLIND_FAITH; trust_lvl <= INDIGNATION; trust_lvl++) {
int ret = 0;
ret = fetch_rgrps_level(sdp, trust_lvl, &rgcount, &ok);
@@ -788,7 +788,7 @@ static int fetch_rgrps(struct gfs2_sbd *sdp)
if (fsck_abort)
break;
}
- if (trust_lvl > indignation) {
+ if (trust_lvl > INDIGNATION) {
log_err( _("Resource group recovery impossible; I can't fix "
"this file system.\n"));
return -1;
diff --git a/gfs2/fsck/link.c b/gfs2/fsck/link.c
index 8ea09c75..08118e8a 100644
--- a/gfs2/fsck/link.c
+++ b/gfs2/fsck/link.c
@@ -88,33 +88,33 @@ int incr_link_count(struct gfs2_inum no, struct gfs2_inode *ip,
di = dirtree_find(no.no_addr);
if (di) {
if (di->dinode.no_formal_ino != no.no_formal_ino)
- return incr_link_ino_mismatch;
+ return INCR_LINK_INO_MISMATCH;
di->counted_links++;
whyincr(no.no_addr, why, referenced_from, di->counted_links);
- return incr_link_good;
+ return INCR_LINK_GOOD;
}
ii = inodetree_find(no.no_addr);
/* If the list has entries, look for one that matches inode_no */
if (ii) {
if (ii->di_num.no_formal_ino != no.no_formal_ino)
- return incr_link_ino_mismatch;
+ return INCR_LINK_INO_MISMATCH;
ii->counted_links++;
whyincr(no.no_addr, why, referenced_from, ii->counted_links);
- return incr_link_good;
+ return INCR_LINK_GOOD;
}
if (link1_type(&clink1map, no.no_addr) != 1) {
link1_set(&clink1map, no.no_addr, 1);
whyincr(no.no_addr, why, referenced_from, 1);
- return incr_link_good;
+ return INCR_LINK_GOOD;
}
link_ip = fsck_load_inode(ip->i_sbd, no.no_addr);
/* Check formal ino against dinode before adding to inode tree. */
if (no.no_formal_ino != link_ip->i_di.di_num.no_formal_ino) {
fsck_inode_put(&link_ip);
- return incr_link_ino_mismatch; /* inode mismatch */
+ return INCR_LINK_INO_MISMATCH; /* inode mismatch */
}
/* Move it from the link1 maps to a real inode tree entry */
link1_set(&nlink1map, no.no_addr, 0);
@@ -130,7 +130,7 @@ int incr_link_count(struct gfs2_inum no, struct gfs2_inode *ip,
(unsigned long long)referenced_from,
(unsigned long long)no.no_addr);
fsck_inode_put(&link_ip);
- return incr_link_bad;
+ return INCR_LINK_BAD;
}
ii->di_num = link_ip->i_di.di_num;
fsck_inode_put(&link_ip);
@@ -142,7 +142,7 @@ int incr_link_count(struct gfs2_inum no, struct gfs2_inode *ip,
not a directory. But the new reference has the correct formal
inode number, so the first reference is suspect: we need to
check it in case it's a bad reference, and not just a hard link. */
- return incr_link_check_orig;
+ return INCR_LINK_CHECK_ORIG;
}
#define whydecr(no_addr, why, referenced_from, counted_links) \
diff --git a/gfs2/fsck/link.h b/gfs2/fsck/link.h
index a5dd1c85..0b300225 100644
--- a/gfs2/fsck/link.h
+++ b/gfs2/fsck/link.h
@@ -5,10 +5,10 @@ extern struct gfs2_bmap nlink1map; /* map of dinodes with nlink == 1 */
extern struct gfs2_bmap clink1map; /* map of dinodes w/counted links == 1 */
enum {
- incr_link_bad = -1,
- incr_link_good = 0,
- incr_link_ino_mismatch = 1,
- incr_link_check_orig = 2,
+ INCR_LINK_BAD = -1,
+ INCR_LINK_GOOD = 0,
+ INCR_LINK_INO_MISMATCH = 1,
+ INCR_LINK_CHECK_ORIG = 2,
};
int link1_set(struct gfs2_bmap *bmap, uint64_t bblock, int mark);
diff --git a/gfs2/fsck/metawalk.c b/gfs2/fsck/metawalk.c
index ef029351..8b721015 100644
--- a/gfs2/fsck/metawalk.c
+++ b/gfs2/fsck/metawalk.c
@@ -1225,14 +1225,14 @@ static int do_check_metalist(struct iptr iptr, int height, struct gfs2_buffer_he
error = pass->check_metalist(iptr, bhp, height, &is_valid,
&was_duplicate, pass->private);
- if (error == meta_error) {
+ if (error == META_ERROR) {
stack;
log_info("\n");
log_info(_("Serious metadata error on block %"PRIu64" (0x%"PRIx64").\n"),
block, block);
return error;
}
- if (error == meta_skip_further) {
+ if (error == META_SKIP_FURTHER) {
log_info("\n");
log_info(_("Unrecoverable metadata error on block %"PRIu64" (0x%"PRIx64")\n"),
block, block);
@@ -1242,18 +1242,18 @@ static int do_check_metalist(struct iptr iptr, int height, struct gfs2_buffer_he
if (!is_valid) {
log_debug("Skipping rejected block %"PRIu64" (0x%"PRIx64")\n", block, block);
if (pass->invalid_meta_is_fatal)
- return meta_error;
- return meta_skip_one;
+ return META_ERROR;
+ return META_SKIP_ONE;
}
if (was_duplicate) {
log_debug("Skipping duplicate %"PRIu64" (0x%"PRIx64")\n", block, block);
- return meta_skip_one;
+ return META_SKIP_ONE;
}
if (!valid_block_ip(ip, block)) {
log_debug("Skipping invalid block %"PRIu64" (0x%"PRIx64")\n", block, block);
if (pass->invalid_meta_is_fatal)
- return meta_error;
- return meta_skip_one;
+ return META_ERROR;
+ return META_SKIP_ONE;
}
return error;
}
@@ -1293,7 +1293,7 @@ static int build_and_check_metalist(struct gfs2_inode *ip, osi_list_t *mlp,
/* if (<there are no indirect blocks to check>) */
if (height < 2)
- return meta_is_good;
+ return META_IS_GOOD;
for (h = 1; h < height; h++) {
if (h > 1) {
if (is_dir(&ip->i_di, ip->i_sbd->gfs1) &&
@@ -1323,7 +1323,7 @@ static int build_and_check_metalist(struct gfs2_inode *ip, osi_list_t *mlp,
if (gfs2_check_meta(iptr_buf(iptr), iblk_type)) {
if (pass->invalid_meta_is_fatal)
- return meta_error;
+ return META_ERROR;
continue;
}
@@ -1335,14 +1335,14 @@ static int build_and_check_metalist(struct gfs2_inode *ip, osi_list_t *mlp,
struct gfs2_buffer_head *nbh = NULL;
if (skip_this_pass || fsck_abort)
- return meta_is_good;
+ return META_IS_GOOD;
if (!iptr_block(iptr))
continue;
error = do_check_metalist(iptr, h, &nbh, pass);
- if (error == meta_error || error == meta_skip_further)
+ if (error == META_ERROR || error == META_SKIP_FURTHER)
goto error_undo;
- if (error == meta_skip_one)
+ if (error == META_SKIP_ONE)
continue;
if (!nbh)
nbh = bread(ip->i_sbd, iptr_block(iptr));
diff --git a/gfs2/fsck/metawalk.h b/gfs2/fsck/metawalk.h
index 88c7d9c1..f63ed5cf 100644
--- a/gfs2/fsck/metawalk.h
+++ b/gfs2/fsck/metawalk.h
@@ -36,10 +36,10 @@ extern struct gfs2_inode *fsck_system_inode(struct gfs2_sbd *sdp,
#define fsck_bitmap_set_noino(ip, b, bt, m) \
_fsck_bitmap_set(ip, b, bt, m, 1, __FUNCTION__, __LINE__)
enum meta_check_rc {
- meta_error = -1,
- meta_is_good = 0,
- meta_skip_further = 1,
- meta_skip_one = 2,
+ META_ERROR = -1,
+ META_IS_GOOD = 0,
+ META_SKIP_FURTHER = 1,
+ META_SKIP_ONE = 2,
};
struct iptr {
diff --git a/gfs2/fsck/pass1.c b/gfs2/fsck/pass1.c
index 27a7d6dc..71d6a46d 100644
--- a/gfs2/fsck/pass1.c
+++ b/gfs2/fsck/pass1.c
@@ -238,7 +238,7 @@ static int resuscitate_metalist(struct iptr iptr, struct gfs2_buffer_head **bh,
(unsigned long long)ip->i_di.di_num.no_addr,
(unsigned long long)ip->i_di.di_num.no_addr);
*is_valid = 0;
- return meta_is_good;
+ return META_IS_GOOD;
}
if (fsck_system_inode(ip->i_sbd, block))
fsck_blockmap_set(ip, block, _("system file"),
@@ -249,7 +249,7 @@ static int resuscitate_metalist(struct iptr iptr, struct gfs2_buffer_head **bh,
ip->i_sbd->gfs1 ?
GFS2_BLKST_DINODE : GFS2_BLKST_USED);
bc->indir_count++;
- return meta_is_good;
+ return META_IS_GOOD;
}
/*
@@ -328,7 +328,7 @@ static int p1check_leaf(struct gfs2_inode *ip, uint64_t block, void *private)
(unsigned long long)ip->i_di.di_num.no_addr,
(unsigned long long)ip->i_di.di_num.no_addr, q,
block_type_string(q));
- add_duplicate_ref(ip, block, ref_as_meta, 0, INODE_VALID);
+ add_duplicate_ref(ip, block, REF_AS_META, 0, INODE_VALID);
if (q == (ip->i_sbd->gfs1 ? GFS2_BLKST_DINODE :
GFS2_BLKST_USED))
/* If the previous reference also saw this as a leaf,
@@ -368,7 +368,7 @@ static int pass1_check_metalist(struct iptr iptr, struct gfs2_buffer_head **bh,
(unsigned long long)ip->i_di.di_num.no_addr,
(unsigned long long)ip->i_di.di_num.no_addr);
- return meta_skip_further;
+ return META_SKIP_FURTHER;
}
if (is_dir(&ip->i_di, ip->i_sbd->gfs1) && h == ip->i_di.di_height) {
iblk_type = GFS2_METATYPE_JD;
@@ -405,16 +405,16 @@ static int pass1_check_metalist(struct iptr iptr, struct gfs2_buffer_head **bh,
*iptr_ptr(iptr) = 0;
bmodified(iptr.ipt_bh);
*is_valid = 1;
- return meta_skip_one;
+ return META_SKIP_ONE;
} else {
brelse(nbh);
- return meta_skip_further;
+ return META_SKIP_FURTHER;
}
}
bc->indir_count++;
if (*was_duplicate) {
- add_duplicate_ref(ip, block, ref_as_meta, 0,
+ add_duplicate_ref(ip, block, REF_AS_META, 0,
*is_valid ? INODE_VALID : INODE_INVALID);
brelse(nbh);
} else {
@@ -424,8 +424,8 @@ static int pass1_check_metalist(struct iptr iptr, struct gfs2_buffer_head **bh,
}
if (*is_valid)
- return meta_is_good;
- return meta_skip_further;
+ return META_IS_GOOD;
+ return META_SKIP_FURTHER;
}
/* undo_reference - undo previously processed data or metadata
@@ -602,7 +602,7 @@ static int pass1_check_data(struct gfs2_inode *ip, uint64_t metablock,
when check_metatree tries to delete the inode, we
can't have the "undo" functions freeing the block
out from other the original referencing inode. */
- add_duplicate_ref(ip, block, ref_as_data, 0,
+ add_duplicate_ref(ip, block, REF_AS_DATA, 0,
INODE_VALID);
return 1;
case GFS2_BLKST_USED: /* tough decision: May be data or meta */
@@ -622,13 +622,13 @@ static int pass1_check_data(struct gfs2_inode *ip, uint64_t metablock,
the inode, we can't have the "undo"
functions freeing the block out from other
the original referencing inode. */
- add_duplicate_ref(ip, block, ref_as_data, 0,
+ add_duplicate_ref(ip, block, REF_AS_DATA, 0,
INODE_VALID);
return 1;
}
log_info( _("Seems to be a normal duplicate; I'll "
"sort it out in pass1b.\n"));
- add_duplicate_ref(ip, block, ref_as_data, 0,
+ add_duplicate_ref(ip, block, REF_AS_DATA, 0,
INODE_VALID);
/* This inode references the block as data. So if this
all is validated, we want to keep this count. */
@@ -636,7 +636,7 @@ static int pass1_check_data(struct gfs2_inode *ip, uint64_t metablock,
case GFS2_BLKST_UNLINKED:
log_info( _("The block was invalid as metadata but might be "
"okay as data. I'll sort it out in pass1b.\n"));
- add_duplicate_ref(ip, block, ref_as_data, 0, INODE_VALID);
+ add_duplicate_ref(ip, block, REF_AS_DATA, 0, INODE_VALID);
return 0;
}
}
@@ -692,7 +692,7 @@ static int undo_eattr_indir_or_leaf(struct gfs2_inode *ip, uint64_t block,
struct block_count *bc = (struct block_count *) private;
if (!valid_block_ip(ip, block))
- return meta_error;
+ return META_ERROR;
/* Need to check block_type before undoing the reference, which can
set it to free, which would cause the test below to fail. */
@@ -755,7 +755,7 @@ static int check_eattr_indir(struct gfs2_inode *ip, uint64_t indirect,
if (gfs2_check_meta((*bh)->b_data, GFS2_METATYPE_IN)) {
bc->ea_count++;
if (q != GFS2_BLKST_FREE) { /* Duplicate? */
- add_duplicate_ref(ip, indirect, ref_as_ea, 0,
+ add_duplicate_ref(ip, indirect, REF_AS_EA, 0,
INODE_VALID);
complain_eas(ip, indirect,
_("Bad indirect Extended Attribute "
@@ -772,7 +772,7 @@ static int check_eattr_indir(struct gfs2_inode *ip, uint64_t indirect,
return 1;
}
if (q != GFS2_BLKST_FREE) { /* Duplicate? */
- add_duplicate_ref(ip, indirect, ref_as_ea, 0, INODE_VALID);
+ add_duplicate_ref(ip, indirect, REF_AS_EA, 0, INODE_VALID);
complain_eas(ip, indirect,
_("Duplicate Extended Attribute indirect block"));
bc->ea_count++;
@@ -837,7 +837,7 @@ static int check_ealeaf_block(struct gfs2_inode *ip, uint64_t block, int btype,
if (gfs2_check_meta(leaf_bh->b_data, btype)) {
bc->ea_count++;
if (q != GFS2_BLKST_FREE) { /* Duplicate? */
- add_duplicate_ref(ip, block, ref_as_ea, 0,
+ add_duplicate_ref(ip, block, REF_AS_EA, 0,
INODE_VALID);
complain_eas(ip, block, _("Extended attribute leaf "
"duplicate found"));
@@ -855,7 +855,7 @@ static int check_ealeaf_block(struct gfs2_inode *ip, uint64_t block, int btype,
if (q != GFS2_BLKST_FREE) { /* Duplicate? */
complain_eas(ip, block, _("Extended Attribute leaf "
"duplicate found"));
- add_duplicate_ref(ip, block, ref_as_data, 0, INODE_VALID);
+ add_duplicate_ref(ip, block, REF_AS_DATA, 0, INODE_VALID);
bc->ea_count++;
brelse(leaf_bh);
/* Return 0 here because if all that's wrong is a duplicate
@@ -1103,7 +1103,7 @@ static int mark_block_invalid(struct gfs2_inode *ip, uint64_t block,
if (!valid_block_ip(ip, block)) {
if (is_valid)
*is_valid = 0;
- return meta_is_good;
+ return META_IS_GOOD;
}
q = block_type(bl, block);
@@ -1118,10 +1118,10 @@ static int mark_block_invalid(struct gfs2_inode *ip, uint64_t block,
(unsigned long long)block,
(unsigned long long)ip->i_di.di_num.no_addr,
(unsigned long long)ip->i_di.di_num.no_addr);
- return meta_is_good;
+ return META_IS_GOOD;
}
fsck_blockmap_set(ip, block, btype, GFS2_BLKST_UNLINKED);
- return meta_is_good;
+ return META_IS_GOOD;
}
static int invalidate_metadata(struct iptr iptr, struct gfs2_buffer_head **bh, int h,
@@ -1132,14 +1132,14 @@ static int invalidate_metadata(struct iptr iptr, struct gfs2_buffer_head **bh, i
*is_valid = 1;
*was_duplicate = 0;
- return mark_block_invalid(ip, block, ref_as_meta, _("metadata"),
+ return mark_block_invalid(ip, block, REF_AS_META, _("metadata"),
is_valid, was_duplicate);
}
static int invalidate_leaf(struct gfs2_inode *ip, uint64_t block,
void *private)
{
- return mark_block_invalid(ip, block, ref_as_meta, _("leaf"),
+ return mark_block_invalid(ip, block, REF_AS_META, _("leaf"),
NULL, NULL);
}
@@ -1147,7 +1147,7 @@ static int invalidate_data(struct gfs2_inode *ip, uint64_t metablock,
uint64_t block, void *private,
struct gfs2_buffer_head *bh, __be64 *ptr)
{
- return mark_block_invalid(ip, block, ref_as_data, _("data"),
+ return mark_block_invalid(ip, block, REF_AS_DATA, _("data"),
NULL, NULL);
}
@@ -1155,7 +1155,7 @@ static int invalidate_eattr_indir(struct gfs2_inode *ip, uint64_t block,
uint64_t parent,
struct gfs2_buffer_head **bh, void *private)
{
- return mark_block_invalid(ip, block, ref_as_ea,
+ return mark_block_invalid(ip, block, REF_AS_EA,
_("indirect extended attribute"),
NULL, NULL);
}
@@ -1164,7 +1164,7 @@ static int invalidate_eattr_leaf(struct gfs2_inode *ip, uint64_t block,
uint64_t parent, struct gfs2_buffer_head **bh,
void *private)
{
- return mark_block_invalid(ip, block, ref_as_ea,
+ return mark_block_invalid(ip, block, REF_AS_EA,
_("extended attribute"),
NULL, NULL);
}
@@ -1181,7 +1181,7 @@ static int invalidate_eattr_leaf(struct gfs2_inode *ip, uint64_t block,
* be trusted. Thus it needs to be in a separate loop.
* Returns: 0 if good range, otherwise != 0
*/
-enum b_types { btype_meta, btype_leaf, btype_data, btype_ieattr, btype_eattr};
+enum b_types { BTYPE_META, BTYPE_LEAF, BTYPE_DATA, BTYPE_IEATTR, BTYPE_EATTR};
const char *btypes[5] = {
"metadata", "leaf", "data", "indirect extended attribute",
"extended attribute" };
@@ -1201,9 +1201,9 @@ static int rangecheck_block(struct gfs2_inode *ip, uint64_t block,
(unsigned long long)ip->i_di.di_num.no_addr,
(unsigned long long)ip->i_di.di_num.no_addr);
if ((*bad_pointers) <= BAD_POINTER_TOLERANCE)
- return meta_is_good;
+ return META_IS_GOOD;
else
- return meta_error; /* Exits check_metatree quicker */
+ return META_ERROR; /* Exits check_metatree quicker */
}
/* See how many duplicate blocks it has */
q = block_type(bl, block);
@@ -1216,16 +1216,16 @@ static int rangecheck_block(struct gfs2_inode *ip, uint64_t block,
(unsigned long long)ip->i_di.di_num.no_addr,
(unsigned long long)ip->i_di.di_num.no_addr);
if ((*bad_pointers) <= BAD_POINTER_TOLERANCE)
- return meta_is_good;
+ return META_IS_GOOD;
else {
log_debug(_("Inode 0x%llx bad pointer tolerance "
"exceeded: block 0x%llx.\n"),
(unsigned long long)ip->i_di.di_num.no_addr,
(unsigned long long)block);
- return meta_error; /* Exits check_metatree quicker */
+ return META_ERROR; /* Exits check_metatree quicker */
}
}
- return meta_is_good;
+ return META_IS_GOOD;
}
static int rangecheck_metadata(struct iptr iptr, struct gfs2_buffer_head **bh, int h,
@@ -1236,34 +1236,34 @@ static int rangecheck_metadata(struct iptr iptr, struct gfs2_buffer_head **bh, i
*is_valid = 1;
*was_duplicate = 0;
- return rangecheck_block(ip, block, bh, btype_meta, private);
+ return rangecheck_block(ip, block, bh, BTYPE_META, private);
}
static int rangecheck_leaf(struct gfs2_inode *ip, uint64_t block,
void *private)
{
- return rangecheck_block(ip, block, NULL, btype_leaf, private);
+ return rangecheck_block(ip, block, NULL, BTYPE_LEAF, private);
}
static int rangecheck_data(struct gfs2_inode *ip, uint64_t metablock,
uint64_t block, void *private,
struct gfs2_buffer_head *bh, __be64 *ptr)
{
- return rangecheck_block(ip, block, NULL, btype_data, private);
+ return rangecheck_block(ip, block, NULL, BTYPE_DATA, private);
}
static int rangecheck_eattr_indir(struct gfs2_inode *ip, uint64_t block,
uint64_t parent,
struct gfs2_buffer_head **bh, void *private)
{
- return rangecheck_block(ip, block, NULL, btype_ieattr, private);
+ return rangecheck_block(ip, block, NULL, BTYPE_IEATTR, private);
}
static int rangecheck_eattr_leaf(struct gfs2_inode *ip, uint64_t block,
uint64_t parent, struct gfs2_buffer_head **bh,
void *private)
{
- return rangecheck_block(ip, block, NULL, btype_eattr, private);
+ return rangecheck_block(ip, block, NULL, BTYPE_EATTR, private);
}
struct metawalk_fxns rangecheck_fxns = {
@@ -1355,7 +1355,7 @@ static int alloc_metalist(struct iptr iptr, struct gfs2_buffer_head **bh, int h,
gfs2_blockmap_set(bl, block, ip->i_sbd->gfs1 ?
GFS2_BLKST_DINODE : GFS2_BLKST_USED);
}
- return meta_is_good;
+ return META_IS_GOOD;
}
static int alloc_data(struct gfs2_inode *ip, uint64_t metablock,
@@ -1975,7 +1975,7 @@ static int pass1_process_bitmap(struct gfs2_sbd *sdp, struct rgrp_tree *rgd, uin
block_type_string(q));
ip = fsck_inode_get(sdp, rgd, bh);
if (is_inode && ip->i_di.di_num.no_addr == block)
- add_duplicate_ref(ip, block, ref_is_inode, 0,
+ add_duplicate_ref(ip, block, REF_IS_INODE, 0,
INODE_VALID);
else
log_info(_("dinum.no_addr is wrong, so I "
diff --git a/gfs2/fsck/pass1b.c b/gfs2/fsck/pass1b.c
index ae5a2c49..a6f06ade 100644
--- a/gfs2/fsck/pass1b.c
+++ b/gfs2/fsck/pass1b.c
@@ -55,10 +55,10 @@ static void log_inode_reference(struct duptree *dt, osi_list_t *tmp, int inval)
sprintf(reftypestring, "as %s", reftypes[get_ref_type(id)]);
else
sprintf(reftypestring, "%d/%d/%d/%d",
- id->reftypecount[ref_is_inode],
- id->reftypecount[ref_as_data],
- id->reftypecount[ref_as_meta],
- id->reftypecount[ref_as_ea]);
+ id->reftypecount[REF_IS_INODE],
+ id->reftypecount[REF_AS_DATA],
+ id->reftypecount[REF_AS_META],
+ id->reftypecount[REF_AS_EA]);
if (inval)
log_warn( _("Invalid "));
log_warn( _("Inode %s (%lld/0x%llx) has %d reference(s) to "
@@ -74,7 +74,7 @@ static int findref_meta(struct iptr iptr, struct gfs2_buffer_head **bh, int h,
{
*is_valid = 1;
*was_duplicate = 0;
- return meta_is_good;
+ return META_IS_GOOD;
}
static int findref_data(struct gfs2_inode *ip, uint64_t metablock,
@@ -90,7 +90,7 @@ static int findref_data(struct gfs2_inode *ip, uint64_t metablock,
"block 0x%llx, offset 0x%x\n",
(unsigned long long)mbr->metablock, mbr->off);
}
- return meta_is_good;
+ return META_IS_GOOD;
}
static void clone_data_block(struct gfs2_sbd *sdp, struct duptree *dt,
@@ -225,7 +225,7 @@ static void resolve_dup_references(struct gfs2_sbd *sdp, struct duptree *dt,
* block, we should really duplicate the block and fix all
* references to it in this inode. Unfortunately, we would
* have to traverse the entire metadata tree to do that. */
- if (acceptable_ref != ref_types && /* If we're nuking all but
+ if (acceptable_ref != REF_TYPES && /* If we're nuking all but
an acceptable reference
type and */
this_ref == acceptable_ref) { /* this ref is acceptable */
@@ -261,7 +261,7 @@ static void resolve_dup_references(struct gfs2_sbd *sdp, struct duptree *dt,
(unsigned long long)dt->block,
(unsigned long long)dt->block,
reftypes[this_ref], reftypes[acceptable_ref]);
- if (this_ref == ref_as_ea) {
+ if (this_ref == REF_AS_EA) {
if (!(query( _("Okay to remove extended attributes "
"from %s inode %lld (0x%llx)? (y/n) "),
(inval ? _("invalidated") : ""),
@@ -278,8 +278,8 @@ static void resolve_dup_references(struct gfs2_sbd *sdp, struct duptree *dt,
dup_listent_delete(dt, id);
continue;
}
- } else if (acceptable_ref == ref_types &&
- this_ref == ref_as_data) {
+ } else if (acceptable_ref == REF_TYPES &&
+ this_ref == REF_AS_DATA) {
clone_data_block(sdp, dt, id);
dup_listent_delete(dt, id);
revise_dup_handler(dt->block, dh);
@@ -303,7 +303,7 @@ static void resolve_dup_references(struct gfs2_sbd *sdp, struct duptree *dt,
"deleted.\n"),
(unsigned long long)id->block_no,
(unsigned long long)id->block_no);
- else if (this_ref == ref_as_ea)
+ else if (this_ref == REF_AS_EA)
log_warn(_("Pass1b is removing extended attributes "
"from inode %lld (0x%llx).\n"),
(unsigned long long)id->block_no,
@@ -343,9 +343,9 @@ static void resolve_dup_references(struct gfs2_sbd *sdp, struct duptree *dt,
}
/* If the reference was as metadata or data, we've got
a corrupt dinode that will be deleted. */
- if ((this_ref != ref_as_ea) &&
- (inval || id->reftypecount[ref_as_data] ||
- id->reftypecount[ref_as_meta])) {
+ if ((this_ref != REF_AS_EA) &&
+ (inval || id->reftypecount[REF_AS_DATA] ||
+ id->reftypecount[REF_AS_META])) {
/* Fix the bitmap first, while the inodetree
and dirtree entries exist. That way, the
bitmap_set will do proper accounting for
@@ -385,7 +385,7 @@ static void resolve_dup_references(struct gfs2_sbd *sdp, struct duptree *dt,
(because they were eliminated earlier in pass1b). And so
the blocks will be mistakenly freed, when, in fact, they're
still being referenced by a valid dinode. */
- if (this_ref != ref_as_ea)
+ if (this_ref != REF_AS_EA)
delete_all_dups(ip);
fsck_inode_put(&ip); /* out, brelse, free */
}
@@ -584,12 +584,12 @@ static void resolve_last_reference(struct gfs2_sbd *sdp, struct duptree *dt,
"already marked free.\n"),
(unsigned long long)id->block_no,
(unsigned long long)id->block_no);
- } else if (id->reftypecount[ref_is_inode]) {
+ } else if (id->reftypecount[REF_IS_INODE]) {
set_ip_bitmap(ip);
- } else if (id->reftypecount[ref_as_data]) {
+ } else if (id->reftypecount[REF_AS_DATA]) {
fsck_bitmap_set(ip, dt->block, _("reference-repaired data"),
GFS2_BLKST_USED);
- } else if (id->reftypecount[ref_as_meta]) {
+ } else if (id->reftypecount[REF_AS_META]) {
if (is_dir(&ip->i_di, sdp->gfs1))
fsck_bitmap_set(ip, dt->block,
_("reference-repaired leaf"),
@@ -601,7 +601,7 @@ static void resolve_last_reference(struct gfs2_sbd *sdp, struct duptree *dt,
sdp->gfs1 ? GFS2_BLKST_DINODE :
GFS2_BLKST_USED);
} else {
- if (acceptable_ref == ref_as_ea)
+ if (acceptable_ref == REF_AS_EA)
fsck_bitmap_set(ip, dt->block,
_("reference-repaired extended "
"attribute"),
@@ -687,16 +687,16 @@ static int handle_dup_blk(struct gfs2_sbd *sdp, struct duptree *dt)
entries) are invalid and should be deleted. */
if (be32_to_cpu(cmagic) == GFS2_MAGIC &&
be32_to_cpu(ctype) == GFS2_METATYPE_DI)
- acceptable_ref = ref_is_inode;
+ acceptable_ref = REF_IS_INODE;
else if (be32_to_cpu(cmagic) == GFS2_MAGIC &&
(be32_to_cpu(ctype) == GFS2_METATYPE_EA ||
be32_to_cpu(ctype) == GFS2_METATYPE_ED))
- acceptable_ref = ref_as_ea;
+ acceptable_ref = REF_AS_EA;
else if (be32_to_cpu(cmagic) == GFS2_MAGIC &&
be32_to_cpu(ctype) <= GFS2_METATYPE_QC)
- acceptable_ref = ref_as_meta;
+ acceptable_ref = REF_AS_META;
else
- acceptable_ref = ref_as_data;
+ acceptable_ref = REF_AS_DATA;
/* A single reference to the block implies a possible situation where
a data pointer points to a metadata block. In other words, the
@@ -714,7 +714,7 @@ static int handle_dup_blk(struct gfs2_sbd *sdp, struct duptree *dt)
/* Step 1 - eliminate references from inodes that are not valid.
* This may be because they were deleted due to corruption.
- * All block types are unacceptable, so we use ref_types.
+ * All block types are unacceptable, so we use REF_TYPES.
*/
if (dh.ref_count > 1) {
log_debug( _("----------------------------------------------\n"
@@ -724,7 +724,7 @@ static int handle_dup_blk(struct gfs2_sbd *sdp, struct duptree *dt)
(unsigned long long)dt->block,
(unsigned long long)dt->block);
resolve_dup_references(sdp, dt, &dt->ref_invinode_list,
- &dh, 1, ref_types);
+ &dh, 1, REF_TYPES);
revise_dup_handler(dup_blk, &dh);
}
/* Step 2 - eliminate reference from inodes that reference it as the
@@ -744,7 +744,7 @@ static int handle_dup_blk(struct gfs2_sbd *sdp, struct duptree *dt)
}
/* Step 3 - We have multiple dinodes referencing it as the correct
* type. Just blast one of them.
- * All block types are fair game, so we use ref_types.
+ * All block types are fair game, so we use REF_TYPES.
*/
if (dh.ref_count > 1) {
log_debug( _("----------------------------------------------\n"
@@ -753,7 +753,7 @@ static int handle_dup_blk(struct gfs2_sbd *sdp, struct duptree *dt)
(unsigned long long)dt->block,
(unsigned long long)dt->block);
resolve_dup_references(sdp, dt, &dt->ref_inode_list, &dh, 0,
- ref_types);
+ REF_TYPES);
revise_dup_handler(dup_blk, &dh);
}
/* If there's still a last remaining reference, and it's a valid
@@ -786,7 +786,7 @@ static int handle_dup_blk(struct gfs2_sbd *sdp, struct duptree *dt)
static int check_leaf_refs(struct gfs2_inode *ip, uint64_t block,
void *private)
{
- return add_duplicate_ref(ip, block, ref_as_meta, 1, INODE_VALID);
+ return add_duplicate_ref(ip, block, REF_AS_META, 1, INODE_VALID);
}
static int check_metalist_refs(struct iptr iptr, struct gfs2_buffer_head **bh, int h,
@@ -797,14 +797,14 @@ static int check_metalist_refs(struct iptr iptr, struct gfs2_buffer_head **bh, i
*was_duplicate = 0;
*is_valid = 1;
- return add_duplicate_ref(ip, block, ref_as_meta, 1, INODE_VALID);
+ return add_duplicate_ref(ip, block, REF_AS_META, 1, INODE_VALID);
}
static int check_data_refs(struct gfs2_inode *ip, uint64_t metablock,
uint64_t block, void *private,
struct gfs2_buffer_head *bh, __be64 *ptr)
{
- return add_duplicate_ref(ip, block, ref_as_data, 1, INODE_VALID);
+ return add_duplicate_ref(ip, block, REF_AS_DATA, 1, INODE_VALID);
}
static int check_eattr_indir_refs(struct gfs2_inode *ip, uint64_t block,
@@ -814,7 +814,7 @@ static int check_eattr_indir_refs(struct gfs2_inode *ip, uint64_t block,
struct gfs2_sbd *sdp = ip->i_sbd;
int error;
- error = add_duplicate_ref(ip, block, ref_as_ea, 1, INODE_VALID);
+ error = add_duplicate_ref(ip, block, REF_AS_EA, 1, INODE_VALID);
if (!error)
*bh = bread(sdp, block);
@@ -828,7 +828,7 @@ static int check_eattr_leaf_refs(struct gfs2_inode *ip, uint64_t block,
struct gfs2_sbd *sdp = ip->i_sbd;
int error;
- error = add_duplicate_ref(ip, block, ref_as_ea, 1, INODE_VALID);
+ error = add_duplicate_ref(ip, block, REF_AS_EA, 1, INODE_VALID);
if (!error)
*bh = bread(sdp, block);
return error;
@@ -859,7 +859,7 @@ static int check_eattr_extentry_refs(struct gfs2_inode *ip, int i,
the blockmap. In this case, we should be okay because the only
error possible is a malloc that fails, in which case we don't
want to delete the eattr anyway. */
- return add_duplicate_ref(ip, block, ref_as_ea, 1, INODE_VALID);
+ return add_duplicate_ref(ip, block, REF_AS_EA, 1, INODE_VALID);
}
/* Finds all references to duplicate blocks in the metadata */
@@ -892,7 +892,7 @@ static int find_block_ref(struct gfs2_sbd *sdp, uint64_t inode)
goto out;
}
/* Check to see if this inode was referenced by another by mistake */
- add_duplicate_ref(ip, inode, ref_is_inode, 1, INODE_VALID);
+ add_duplicate_ref(ip, inode, REF_IS_INODE, 1, INODE_VALID);
/* Check this dinode's metadata for references to known duplicates */
error = check_metatree(ip, &find_refs);
diff --git a/gfs2/fsck/pass2.c b/gfs2/fsck/pass2.c
index 9184bbc6..e595051d 100644
--- a/gfs2/fsck/pass2.c
+++ b/gfs2/fsck/pass2.c
@@ -977,9 +977,9 @@ static int check_dentry(struct gfs2_inode *ip, struct gfs2_dirent *dent,
dentry_is_valid:
/* This directory inode links to this inode via this dentry */
error = incr_link_count(entry, ip, _("valid reference"));
- if (error == incr_link_check_orig) {
+ if (error == INCR_LINK_CHECK_ORIG) {
error = check_suspicious_dirref(sdp, &entry);
- } else if (error == incr_link_ino_mismatch) {
+ } else if (error == INCR_LINK_INO_MISMATCH) {
log_err("incr_link_count err=%d.\n", error);
if (bad_formal_ino(ip, dent, entry, tmp_name, q, de, bh) == 1)
goto nuke_dentry;
@@ -1882,7 +1882,7 @@ static int check_metalist_qc(struct iptr iptr, struct gfs2_buffer_head **bh, int
*was_duplicate = 0;
*is_valid = 1;
*bh = bread(ip->i_sbd, block);
- return meta_is_good;
+ return META_IS_GOOD;
}
static int check_data_qc(struct gfs2_inode *ip, uint64_t metablock,
diff --git a/gfs2/fsck/rgrepair.c b/gfs2/fsck/rgrepair.c
index cc7c9c9d..bf1641e8 100644
--- a/gfs2/fsck/rgrepair.c
+++ b/gfs2/fsck/rgrepair.c
@@ -488,7 +488,7 @@ static uint64_t hunt_and_peck(struct gfs2_sbd *sdp, uint64_t blk,
/*
* rindex_rebuild - rebuild a corrupt Resource Group (RG) index manually
- * where trust_lvl == distrust
+ * where trust_lvl == DISTRUST
*
* If this routine is called, it means we have RGs in odd/unexpected places,
* and there is a corrupt RG or RG index entry. It also means we can't trust
@@ -854,7 +854,7 @@ static int calc_rgrps(struct gfs2_sbd *sdp)
/*
* gfs2_rindex_calculate - calculate what the rindex should look like
- * in a perfect world (trust_lvl == open_minded)
+ * in a perfect world (trust_lvl == OPEN_MINDED)
*
* Calculate what the rindex should look like,
* so we can later check if all RG index entries are sane.
@@ -1002,11 +1002,11 @@ static int expect_rindex_sanity(struct gfs2_sbd *sdp, int *num_rgs)
/*
* rg_repair - try to repair a damaged rg index (rindex)
* trust_lvl - This is how much we trust the rindex file.
- * blind_faith means we take the rindex at face value.
- * open_minded means it might be okay, but we should verify it.
- * distrust means it's not to be trusted, so we should go to
+ * BLIND_FAITH means we take the rindex at face value.
+ * OPEN_MINDED means it might be okay, but we should verify it.
+ * DISTRUST means it's not to be trusted, so we should go to
* greater lengths to build it from scratch.
- * indignation means we have corruption, but the file system
+ * INDIGNATION means we have corruption, but the file system
* was converted from GFS via gfs2_convert, and its rgrps are
* not on nice boundaries thanks to previous gfs_grow ops. Lovely.
*/
@@ -1017,9 +1017,9 @@ int rg_repair(struct gfs2_sbd *sdp, int trust_lvl, int *ok)
int calc_rg_count = 0, rg;
struct gfs2_rindex buf;
- if (trust_lvl == blind_faith)
+ if (trust_lvl == BLIND_FAITH)
return 0;
- if (trust_lvl == ye_of_little_faith) { /* if rindex seems sane */
+ if (trust_lvl == YE_OF_LITTLE_FAITH) { /* if rindex seems sane */
/* Don't free previous incarnations in memory, if any.
* We need them to copy in the next function:
* gfs2_rgrp_free(&sdp->rglist); */
@@ -1033,7 +1033,7 @@ int rg_repair(struct gfs2_sbd *sdp, int trust_lvl, int *ok)
gfs2_rgrp_free(sdp, &sdp->rgcalc);
return error;
}
- } else if (trust_lvl == open_minded) { /* If we can't trust RG index */
+ } else if (trust_lvl == OPEN_MINDED) { /* If we can't trust RG index */
/* Free previous incarnations in memory, if any. */
gfs2_rgrp_free(sdp, &sdp->rgtree);
@@ -1043,7 +1043,7 @@ int rg_repair(struct gfs2_sbd *sdp, int trust_lvl, int *ok)
gfs2_rgrp_free(sdp, &sdp->rgcalc);
return -1;
}
- } else if (trust_lvl == distrust) { /* If we can't trust RG index */
+ } else if (trust_lvl == DISTRUST) { /* If we can't trust RG index */
/* Free previous incarnations in memory, if any. */
gfs2_rgrp_free(sdp, &sdp->rgtree);
@@ -1053,7 +1053,7 @@ int rg_repair(struct gfs2_sbd *sdp, int trust_lvl, int *ok)
gfs2_rgrp_free(sdp, &sdp->rgcalc);
return -1;
}
- } else if (trust_lvl == indignation) { /* If we can't trust anything */
+ } else if (trust_lvl == INDIGNATION) { /* If we can't trust anything */
/* Free previous incarnations in memory, if any. */
gfs2_rgrp_free(sdp, &sdp->rgtree);
@@ -1090,11 +1090,11 @@ int rg_repair(struct gfs2_sbd *sdp, int trust_lvl, int *ok)
"extended, (2) an odd\n"), trust_lvl + 1);
log_warn( _("L%d: rgrp size was used, or (3) we have a corrupt "
"rg index.\n"), trust_lvl + 1);
- /* If the trust level is open_minded, we would have calculated
+ /* If the trust level is OPEN_MINDED, we would have calculated
the rindex based on the device size. If it's not the same
number, don't trust it. Complain about the discrepancy,
- then try again with a little more distrust. */
- if ((trust_lvl < distrust) ||
+ then try again with a little more DISTRUST. */
+ if ((trust_lvl < DISTRUST) ||
!query( _("Attempt to use what rgrps we can? (y/n)"))) {
gfs2_rgrp_free(sdp, &sdp->rgcalc);
gfs2_rgrp_free(sdp, &sdp->rgtree);
diff --git a/gfs2/fsck/util.c b/gfs2/fsck/util.c
index abcf5f9c..26170fa5 100644
--- a/gfs2/fsck/util.c
+++ b/gfs2/fsck/util.c
@@ -17,7 +17,7 @@
#include "metawalk.h"
#include "util.h"
-const char *reftypes[ref_types + 1] = {"data", "metadata",
+const char *reftypes[REF_TYPES + 1] = {"data", "metadata",
"an extended attribute", "an inode",
"unimportant"};
@@ -304,12 +304,12 @@ int count_dup_meta_refs(struct duptree *dt)
osi_list_foreach(ref, &dt->ref_invinode_list) {
id = osi_list_entry(ref, struct inode_with_dups, list);
- if (id->reftypecount[ref_as_meta])
+ if (id->reftypecount[REF_AS_META])
metarefs++;
}
osi_list_foreach(ref, &dt->ref_inode_list) {
id = osi_list_entry(ref, struct inode_with_dups, list);
- if (id->reftypecount[ref_as_meta])
+ if (id->reftypecount[REF_AS_META])
metarefs++;
}
return metarefs;
@@ -336,19 +336,19 @@ int add_duplicate_ref(struct gfs2_inode *ip, uint64_t block,
struct duptree *dt;
if (!valid_block_ip(ip, block))
- return meta_is_good;
+ return META_IS_GOOD;
/* If this is not the first reference (i.e. all calls from pass1) we
need to create the duplicate reference. If this is pass1b, we want
to ignore references that aren't found. */
dt = gfs2_dup_set(block, !first);
if (!dt) /* If this isn't a duplicate */
- return meta_is_good;
+ return META_IS_GOOD;
/* If we found the duplicate reference but we've already discovered
the first reference (in pass1b) and the other references in pass1,
we don't need to count it, so just return. */
if (dt->dup_flags & DUPFLAG_REF1_FOUND)
- return meta_is_good;
+ return META_IS_GOOD;
/* Check for a previous reference to this duplicate */
id = find_dup_ref_inode(dt, ip);
@@ -391,7 +391,7 @@ int add_duplicate_ref(struct gfs2_inode *ip, uint64_t block,
id = calloc(1, sizeof(*id));
if (!id) {
log_crit( _("Unable to allocate inode_with_dups structure\n"));
- return meta_error;
+ return META_ERROR;
}
id->block_no = ip->i_di.di_num.no_addr;
q = bitmap_type(ip->i_sbd, ip->i_di.di_num.no_addr);
@@ -431,7 +431,7 @@ int add_duplicate_ref(struct gfs2_inode *ip, uint64_t block,
"%d from this inode.\n"),
dt->refs, id->dup_count);
}
- return meta_is_good;
+ return META_IS_GOOD;
}
struct dir_info *dirtree_insert(struct gfs2_inum inum)
@@ -491,10 +491,10 @@ enum dup_ref_type get_ref_type(struct inode_with_dups *id)
int found_type_with_ref;
int found_other_types;
- for (t = ref_as_data; t < ref_types; t++) {
+ for (t = REF_AS_DATA; t < REF_TYPES; t++) {
found_type_with_ref = 0;
found_other_types = 0;
- for (i = ref_as_data; i < ref_types; i++) {
+ for (i = REF_AS_DATA; i < REF_TYPES; i++) {
if (id->reftypecount[i]) {
if (t == i)
found_type_with_ref = 1;
@@ -503,9 +503,9 @@ enum dup_ref_type get_ref_type(struct inode_with_dups *id)
}
}
if (found_type_with_ref)
- return found_other_types ? ref_types : t;
+ return found_other_types ? REF_TYPES : t;
}
- return ref_types;
+ return REF_TYPES;
}
void dup_listent_delete(struct duptree *dt, struct inode_with_dups *id)
diff --git a/gfs2/fsck/util.h b/gfs2/fsck/util.h
index d93b65d3..d8767247 100644
--- a/gfs2/fsck/util.h
+++ b/gfs2/fsck/util.h
@@ -21,7 +21,7 @@ extern struct inode_with_dups *find_dup_ref_inode(struct duptree *dt,
struct gfs2_inode *ip);
extern void dup_listent_delete(struct duptree *dt, struct inode_with_dups *id);
extern int count_dup_meta_refs(struct duptree *dt);
-extern const char *reftypes[ref_types + 1];
+extern const char *reftypes[REF_TYPES + 1];
#define BLOCKMAP_SIZE1(size) ((size) >> 3)
#define BLOCKMAP_SIZE2(size) ((size) >> 2)
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
2 years, 12 months