[Cluster-devel] [PATCH 02/42] libgfs2: allow dir_split_leaf to receive a leaf buffer

2013-04-08 Thread rpeterso
From: Bob Peterson rpete...@redhat.com This is a small performance improvement. Rather than having function dir_split_leaf read in the leaf to be split, this patch lets the buffer_head to be passed in from the calling function, which has it read in anyway. rhbz#902920 --- gfs2/libgfs2/fs_ops.c

[Cluster-devel] [PATCH 05/42] fsck.gfs2: Split out function to make sure lost+found exists

2013-04-08 Thread rpeterso
From: Bob Peterson rpete...@redhat.com This patch extracts a section of code from the lost+found functions and makes a new make_sure_lf_exists function that can be called from more places. --- gfs2/fsck/lost_n_found.c | 130 +++

[Cluster-devel] [PATCH 04/42] fsck.gfs2: Move function find_free_blk to util.c

2013-04-08 Thread rpeterso
From: Bob Peterson rpete...@redhat.com In a future patch to fsck, function find_free_blk will be called in order to correctly report blocks that will need to be allocated for things such as leaf splits. This patch moves function find_free_blk to a more centralized place, util.c, to that end.

[Cluster-devel] [PATCH 00/42] fsck.gfs2 fixes and improvements

2013-04-08 Thread rpeterso
Hi, Here is a set of patches I wrote for fsck.gfs2. These are mostly bug fixes, but there are some cleanups as well. The two biggest bug fixes are: (1) Directory hash tables and leaf blocks are now properly checked and fixed, rather than patched up. (2) Handling of duplicate block references

[Cluster-devel] [PATCH 17/42] fsck.gfs2: check leaf depth when validating leaf blocks

2013-04-08 Thread rpeterso
From: Bob Peterson rpete...@redhat.com Now that fsck.gfs2 can validate the hash table is relatively sane without actually reading the leaf blocks, when it does need to read in those leaf blocks, we need to check the leaf depth is appropriate for the (now sane) number of pointers we encountered in

[Cluster-devel] [PATCH 06/42] fsck.gfs2: Check for formal inode mismatch when adding to lost+found

2013-04-08 Thread rpeterso
From: Bob Peterson rpete...@redhat.com This patch adds a check to the code that adds inodes to lost+found so that dinodes with formal inode mismatches are logged, but not added. rhbz#902920 --- gfs2/fsck/lost_n_found.c | 44 1 file changed, 28

[Cluster-devel] [PATCH 22/42] fsck.gfs2: Add clarifying message to duplicate processing

2013-04-08 Thread rpeterso
From: Bob Peterson rpete...@redhat.com This patch adds a message to the fsck output that indicates which block reference is acceptable. That helps to determine if fsck made the right decision when a duplicate is resolved. rhbz#902920 --- gfs2/fsck/pass1b.c | 9 + 1 file changed, 9

[Cluster-devel] [PATCH 13/42] fsck.gfs2: Misc cleanups

2013-04-08 Thread rpeterso
From: Bob Peterson rpete...@redhat.com This patch contains some trivial cleanups. --- gfs2/fsck/metawalk.c | 6 ++ gfs2/fsck/pass1.c| 4 ++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/gfs2/fsck/metawalk.c b/gfs2/fsck/metawalk.c index 5a13c6f..ce6bdbe 100644 ---

[Cluster-devel] [PATCH 12/42] fsck.gfs2: Move function to read directory hash table to util.c

2013-04-08 Thread rpeterso
From: Bob Peterson rpete...@redhat.com This patch moves function get_dir_hash from metawalk.c to util.c. This was done because a future patch will need access to the function. --- gfs2/fsck/metawalk.c | 18 -- gfs2/fsck/util.c | 19 +++ gfs2/fsck/util.h |

[Cluster-devel] [PATCH 14/42] fsck.gfs2: Verify dirent hash values correspond to proper leaf block

2013-04-08 Thread rpeterso
From: Bob Peterson rpete...@redhat.com This patch checks to make sure all the dirents on a leaf block have hash values that are actually appropriate to the leaf block. With extended hashing, the file name is used to generate a hash value. Today's fsck checks that the hash value is proper to the

[Cluster-devel] [PATCH 25/42] fsck.gfs2: Check for interrupt when resolving duplicates

2013-04-08 Thread rpeterso
From: Bob Peterson rpete...@redhat.com This patch adds another check for interrupts while resolving duplicate block references in pass1b. rhbz#902920 --- gfs2/fsck/pass1b.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/gfs2/fsck/pass1b.c b/gfs2/fsck/pass1b.c index 56b77f5..7108bb4

[Cluster-devel] [PATCH 18/42] fsck.gfs2: small cleanups

2013-04-08 Thread rpeterso
From: Bob Peterson rpete...@redhat.com This patch just fixes some messages that were wrong, adds comments, and so forth. rhbz#902920 --- gfs2/fsck/metawalk.c | 24 +--- gfs2/fsck/pass2.c| 9 +++-- gfs2/fsck/util.h | 2 +- 3 files changed, 17 insertions(+), 18

[Cluster-devel] [PATCH 07/42] fsck.gfs2: shorten some debug messages in lost+found

2013-04-08 Thread rpeterso
From: Bob Peterson rpete...@redhat.com This patch changes the debug output of lost+found such that it only prints the block number in hexadecimal. This shortens the output and makes debug output easier to read. rhbz#902920 --- gfs2/fsck/lost_n_found.c | 12 1 file changed, 4

[Cluster-devel] [PATCH 29/42] fsck.gfs2: print block count values when fixing them

2013-04-08 Thread rpeterso
From: Bob Peterson rpete...@redhat.com Before this patch, block counts were fixed, but it didn't log what the new value was changed to. That made it very difficult to track down block count problems. This patch changes the logging so that it prints the new block count, and a breakdown of how many

[Cluster-devel] [PATCH 21/42] fsck.gfs2: link dinodes that only have extended attribute problems

2013-04-08 Thread rpeterso
From: Bob Peterson rpete...@redhat.com The job of pass1b is to resolve duplicate references to the same block. Eventually it does a fair job of determining the rightful owner of the block, and then it has to deal with the other dinode(s) that referenced the block improperly. If another dinode

[Cluster-devel] [PATCH 27/42] fsck.gfs2: Keep proper counts when duplicates are found

2013-04-08 Thread rpeterso
From: Bob Peterson rpete...@redhat.com When fsck.gfs2 discovered a duplicate reference to the same block, it was not properly incrementing the block counters for data and metadata. Therefore, when the duplicate situation is resolved, the resulting dinode is likely to have the wrong block count.

[Cluster-devel] [PATCH 16/42] fsck.gfs2: fix leaf blocks, don't try to patch the hash table

2013-04-08 Thread rpeterso
From: Bob Peterson rpete...@redhat.com Before this patch, when we detected a bad leaf block, fsck.gfs2 would try to patch the hash table. That's very wrong, because the hash table needs to be on nice power-of-two boundaries. This patch changes the code so that the hash table is actually repaired.

[Cluster-devel] [PATCH 10/42] fsck.gfs2: Add new function to check dir hash tables

2013-04-08 Thread rpeterso
From: Bob Peterson rpete...@redhat.com It's very important that fsck.gfs2 checks for a valid directory hash table before operating further on the directory. Before this patch, we were doing some incomplete testing, after we had already operated on the directory, with function check_num_ptrs. This

[Cluster-devel] [PATCH 15/42] fsck.gfs2: re-read hash table if directory height or depth changes

2013-04-08 Thread rpeterso
From: Bob Peterson rpete...@redhat.com There may be times when fsck.gfs2 wants to move things around. For example, if it finds dirents entries on the wrong leaf block, it may want to move them to a different leaf. If it does, it may need to split the leaf, which means we're adding another block.

[Cluster-devel] [PATCH 03/42] libgfs2: let dir_split_leaf receive a broken lindex

2013-04-08 Thread rpeterso
From: Bob Peterson rpete...@redhat.com For ordinary leaf blocks, the hash table must follow the rules, which means it needs to follow a power-of-two boundary. In other words, it needs to enforce that: start = (lindex ~(len - 1)); But when doing repairs, fsck will need to detect when hash tables

[Cluster-devel] [PATCH 37/42] fsck.gfs2: don't invalidate files with duplicate data block refs

2013-04-08 Thread rpeterso
From: Bob Peterson rpete...@redhat.com Before this patch, whenever pass1 encountered a duplicated data block pointer, it would mark the file as invalid. But if reason the block was duplicated was due to a different bad inode, the inode with the valid data block reference was still punished and

[Cluster-devel] [PATCH 24/42] fsck.gfs2: Rework the undo functions

2013-04-08 Thread rpeterso
From: Bob Peterson rpete...@redhat.com In pass1, it traverses the metadata free, processing each dinode and marking which blocks are used by that dinode. If a dinode is found to have unrecoverable errors, it does a bunch of work to undo the things it did. This is especially important for the

[Cluster-devel] [PATCH 19/42] fsck.gfs2: reprocess inodes when blocks are added

2013-04-08 Thread rpeterso
From: Bob Peterson rpete...@redhat.com This patch adds several calls to reprocess_inode when functions may have potentially added blocks to a dinode. This happens, for example, when leaf blocks are split or new leaf blocks are added. The purpose of reprocessing the inode is to properly mark the

[Cluster-devel] [PATCH 20/42] fsck.gfs2: Remove redundant leaf depth check

2013-04-08 Thread rpeterso
From: Bob Peterson rpete...@redhat.com A previous patch changed the way we check leaf block depth. This patch removes the redundant check from pass1. rhbz#902920 --- gfs2/fsck/pass1.c | 16 1 file changed, 16 deletions(-) diff --git a/gfs2/fsck/pass1.c b/gfs2/fsck/pass1.c

[Cluster-devel] [PATCH 32/42] fsck.gfs2: don't remove buffers from the list when errors are found

2013-04-08 Thread rpeterso
From: Bob Peterson rpete...@redhat.com Before this patch, if an error was encountered while marking the data blocks, the blocks would be removed from the linked list. Now that we've got undo functions, we need to be able to undo the designations of those blocks, which means we need to keep those

[Cluster-devel] [PATCH 34/42] fsck.gfs2: externalize check_leaf

2013-04-08 Thread rpeterso
From: Bob Peterson rpete...@redhat.com This patch makes metawalk function check_leaf external so that it may be called in a future patch for fixing hash tables. rhbz#902920 --- gfs2/fsck/metawalk.c | 5 ++--- gfs2/fsck/metawalk.h | 3 +++ gfs2/fsck/pass1.c| 6 +++--- gfs2/fsck/pass1b.c |

[Cluster-devel] [PATCH 28/42] fsck.gfs2: print metadata block reference on data errors

2013-04-08 Thread rpeterso
From: Bob Peterson rpete...@redhat.com Before this patch, fsck.gfs2 would cite data block errors, but it wouldn't tell you which metadata block referenced the bad data block. That's fine, but it makes it very difficult to backtrack problems. This patch prints out which metadata block referenced

[Cluster-devel] [PATCH 38/42] fsck.gfs2: check for duplicate first references

2013-04-08 Thread rpeterso
From: Bob Peterson rpete...@redhat.com Before this patch, fsck.gfs2 could get into situations where it's in pass1b searching for the first reference to a block that it knows has been referenced twice. However, for one reason or another, the first reference has been deleted. It may seem unlikely

[Cluster-devel] [PATCH 23/42] fsck.gfs2: separate function to calculate metadata block header size

2013-04-08 Thread rpeterso
From: Bob Peterson rpete...@redhat.com This patch creates a new function hdr_size that calculates the size of a GFS2 metadata header depending on the height and type of block. rhbz#902920 --- gfs2/fsck/metawalk.c | 44 +++- 1 file changed, 23

[Cluster-devel] [PATCH 31/42] fsck.gfs2: Log when unrecoverable data block errors are encountered

2013-04-08 Thread rpeterso
From: Bob Peterson rpete...@redhat.com This patch adds a log message whenever unrecoverable data block errors are found. Otherwise the output doesn't say why it stopped processing data, and which block had the problem. rhbz#902920 --- gfs2/fsck/metawalk.c | 9 +++-- 1 file changed, 7

[Cluster-devel] [PATCH 33/42] fsck.gfs2: Don't flag GFS1 non-dinode blocks as duplicates

2013-04-08 Thread rpeterso
From: Bob Peterson rpete...@redhat.com Before this patch, fsck.gfs2 could get into problems when processing a GFS1 file system. The issue goes back to the fact that all GFS1 metadata is marked as Meta in the bitmap, whereas that bitmap designation is reserved for dinodes in GFS2. For example,

[Cluster-devel] [PATCH 35/42] fsck.gfs2 pass2: check leaf blocks when fixing hash table

2013-04-08 Thread rpeterso
From: Bob Peterson rpete...@redhat.com Before this patch, pass2 would attempt to fix the hash table without first checking the basic integrity of the leaf blocks it was checking. A misplaced leaf might have its entries relocated as a matter of course. But if that leaf block had a problem, it

[Cluster-devel] [PATCH 08/42] fsck.gfs2: Move basic directory entry checks to separate function

2013-04-08 Thread rpeterso
From: Bob Peterson rpete...@redhat.com This patch moves a huge chunk of code from bloated function check_dentry. The moved section of code performs basic directory entry checks. The code is basically unchanged, but I made clear_eattrs metawalk functions global. rhbz#902920 --- gfs2/fsck/pass2.c

[Cluster-devel] [PATCH 42/42] fsck.gfs2: Remove unused variable

2013-04-08 Thread rpeterso
From: Bob Peterson rpete...@redhat.com This patch removes a variable that wasn't being used. --- gfs2/fsck/pass1b.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/gfs2/fsck/pass1b.c b/gfs2/fsck/pass1b.c index b6f03bd..47c4694 100644 --- a/gfs2/fsck/pass1b.c +++ b/gfs2/fsck/pass1b.c @@

[Cluster-devel] [PATCH 39/42] fsck.gfs2: When flagging a duplicate reference, show valid or invalid

2013-04-08 Thread rpeterso
From: Bob Peterson rpete...@redhat.com This patch changes the logging when duplicate block references are flagged. The idea is to print whether or not the inode with the reference is valid or invalid, which helps in diagnosing problems when duplicate block references are resolved. rhbz#902920

[Cluster-devel] [PATCH 36/42] fsck.gfs2: standardize check_metatree return codes

2013-04-08 Thread rpeterso
From: Bob Peterson rpete...@redhat.com This patch aims to not change functionality at all. What it does is adds a standard set of three return codes with the following meanings: meta_is_good - all is well, keep processing metadata normally meta_skip_further - an non-fatal error occurred, so

[Cluster-devel] [PATCH 01/42] libgfs2: externalize dir_split_leaf

2013-04-08 Thread rpeterso
From: Bob Peterson rpete...@redhat.com This patch makes libgfs2 externalize function dir_split_leaf so that fsck.gfs2 can split leafs in a future patch. rhbz#902920 --- gfs2/libgfs2/fs_ops.c | 3 +-- gfs2/libgfs2/libgfs2.h | 2 ++ 2 files changed, 3 insertions(+), 2 deletions(-) diff --git

[Cluster-devel] [PATCH 26/42] fsck.gfs2: Consistent naming of struct duptree variables

2013-04-08 Thread rpeterso
From: Bob Peterson rpete...@redhat.com There were several places in the fsck.gfs2 code that referenced variables of type struct duptree, but sometimes they were called dt, d, b or even data. This patch achieves a level of consistency and calls them all dt. This helps readability: when you see a

[Cluster-devel] [PATCH 30/42] fsck.gfs2: Do not invalidate metablocks of dinodes with invalid mode

2013-04-08 Thread rpeterso
From: Bob Peterson rpete...@redhat.com Before this patch, when fsck.gfs2 encountered a dinode with an invalid mode, it would take steps to invalidate its metadata. That's wrong because if the mode is invalid, you don't know how to treat it. It's especially wrong if its metadata references the

[Cluster-devel] [PATCH 6/6] GFS2: Eliminate unnecessary check for state 3 in bitfit

2012-08-09 Thread rpeterso
From: Bob Peterson rpete...@redhat.com Function gfs2_bitfit was checking for state 3, but that's impossible since it is only called from rgblk_search, which receives only GFS2_BLKST_ constants. --- fs/gfs2/rgrp.c |2 -- 1 files changed, 0 insertions(+), 2 deletions(-) diff --git

[Cluster-devel] [PATCH 2/6] GFS2: inline __gfs2_glock_schedule_for_reclaim

2012-08-09 Thread rpeterso
From: Bob Peterson rpete...@redhat.com Since function gfs2_glock_schedule_for_reclaim is only two significant lines, we can eliminate it, simplifying the code and making it more readable. --- fs/gfs2/glock.c | 19 +++ 1 files changed, 3 insertions(+), 16 deletions(-) diff

[Cluster-devel] [PATCH 0/6] GFS2: Misc minor optimizations

2012-08-09 Thread rpeterso
I've taken Steve Whitehouse's advice and broken the previous set of changes into six individual patches. In some cases, the patches are not so much for optimization as they are for readability and to make GFS2 easier to understand. The patches are as follows: [PATCH 1/6] GFS2: change function

[Cluster-devel] [PATCH 4/6] GFS2: Combine functions gfs2_glock_dq_wait and wait_on_demote

2012-08-09 Thread rpeterso
From: Bob Peterson rpete...@redhat.com Function gfs2_glock_dq_wait called two-line function wait_on_demote, so they were combined. --- fs/gfs2/glock.c |9 ++--- 1 files changed, 2 insertions(+), 7 deletions(-) diff --git a/fs/gfs2/glock.c b/fs/gfs2/glock.c index 5c87909..fca6a87 100644

[Cluster-devel] [PATCH 3/6] GFS2: Combine functions gfs2_glock_wait and wait_on_holder

2012-08-09 Thread rpeterso
From: Bob Peterson rpete...@redhat.com Function gfs2_glock_wait only called function wait_on_holder and returned its return code, so they were combined for readability. --- fs/gfs2/glock.c | 23 +-- 1 files changed, 9 insertions(+), 14 deletions(-) diff --git

[Cluster-devel] [PATCH 1/6] GFS2: change function gfs2_direct_IO to use a normal gfs2_glock_dq

2012-08-09 Thread rpeterso
From: Bob Peterson rpete...@redhat.com This patch changes function gfs2_direct_IO so that it uses a normal call to gfs2_glock_dq rather than a call to a multiple-dq of one item. --- fs/gfs2/aops.c |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/fs/gfs2/aops.c

[Cluster-devel] [PATCH 00/66] fsck.gfs2: add ability to fix GFS (gfs1) file systems

2012-01-20 Thread rpeterso
This big set of 66 patches are cross-written from upstream to RHEL6. It allows RHEL6's fsck.gfs2 to operate on GFS1 file systems. There are many reasons to do that. This is for bugzilla #675723. Regards, Bob Peterson Red Hat File Systems [PATCH 01/66] fsck.gfs2: Make functions use sdp rather

[Cluster-devel] [PATCH 04/66] libgfs2: Make check_sb and read_sb operate on gfs1

2012-01-20 Thread rpeterso
From: Bob Peterson rpete...@redhat.com This patch adds allow_gfs1 parameters to the read_sb and check_sb functions. This will allow gfs2-utils to read and operate on gfs1 file systems in follow-up patches. rhbz#675723 --- gfs2/edit/savemeta.c | 38 +---

[Cluster-devel] [PATCH 14/66] fsck.gfs2: fsck.gfs2: Ask to reclaim unlinked meta per-rgrp only

2012-01-20 Thread rpeterso
From: Bob Peterson rpete...@redhat.com Before this patch, fsck.gfs2 would ask for every unlinked metadata bit whether you wanted to reclaim it as free space. This patch makes it ask only once per resource group, and reports which resource group so that the user doesn't think it's stuck in an

[Cluster-devel] [PATCH 15/66] fsck.gfs2: fsck.gfs2: Refactor add_dotdot function in lost+found

2012-01-20 Thread rpeterso
From: Bob Peterson rpete...@redhat.com This function factors out a section of code from function add_inode_to_lf. This makes it easier to read and gives it the ability to print better messages regarding where the block was previously linked. rhbz#675723 --- gfs2/fsck/lost_n_found.c | 113

[Cluster-devel] [PATCH 12/66] fsck.gfs2: get rid of triple negative logic

2012-01-20 Thread rpeterso
From: Bob Peterson rpete...@redhat.com This patch changes the logic of the code from being triple-negative to single-negative so it won't twist your brain into knots. rhbz#675723 --- gfs2/fsck/metawalk.c |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git

[Cluster-devel] [PATCH 13/66] dirent_repair needs to mark the buffer as modified

2012-01-20 Thread rpeterso
From: Bob Peterson rpete...@redhat.com This patch adds a call to bmodified to function dirent_repair. Without setting the modified bit, directory repairs may be forgotten and never written back to disk, leaving the damage in place. rhbz#675723 --- gfs2/fsck/metawalk.c |1 + 1 files

[Cluster-devel] [PATCH 26/66] fsck.gfs2 pass2: Don't delete invalid inode metadata

2012-01-20 Thread rpeterso
From: Bob Peterson rpete...@redhat.com In pass2, all metadata was deleted for inodes that were marked either bad or invalid but that is wrong, and here is why: Blocks marked invalid were invalidated due to duplicate block references. Pass1b should have already taken care of deleting their

[Cluster-devel] [PATCH 16/66] libgfs2: libgfs2: Use __FUNCTION__ rather than __FILE__

2012-01-20 Thread rpeterso
From: Bob Peterson rpete...@redhat.com This patch changes the debug output of gfs2-utils to use __FUNCTION__ rather than __FILE__. The output file is much smaller. Digging through a 6.5GB output is better and faster than a 9GB output file. rhbz#675723 --- gfs2/fsck/metawalk.c | 13

[Cluster-devel] [PATCH 23/66] fsck.gfs2: Make output messages more sensible

2012-01-20 Thread rpeterso
From: Bob Peterson rpete...@redhat.com This patch changes several fsck output messages so that they make more sense. Digging through very big and complex fsck.gfs2 output, I found myself lost in many occasions. This patch makes it a lot easier to see what decisions are made by fsck.gfs2 and

[Cluster-devel] [PATCH 09/66] fsck.gfs2: fsck.gfs2: Rename nlink functions to be intuitive

2012-01-20 Thread rpeterso
From: Bob Peterson rpete...@redhat.com Part of fsck's checks is to verify the count of links for directories, but the variable names and function names are too confusing to understand without in-depth analysis of what the code is doing. This patch renames the structure variable link_count to

[Cluster-devel] [PATCH 22/66] fsck.gfs2: Shorten output

2012-01-20 Thread rpeterso
From: Bob Peterson rpete...@redhat.com This patch shortens some of the output of fsck.gfs2, thereby making the output files smaller and more manageable. rhbz#675723 --- gfs2/fsck/lost_n_found.c |6 +++--- gfs2/fsck/metawalk.c |7 --- gfs2/fsck/pass5.c| 13 +++--

[Cluster-devel] [PATCH 25/66] fsck.gfs2 pass2: Delete extended attributes with inode

2012-01-20 Thread rpeterso
From: Bob Peterson rpete...@redhat.com When pass2 decided to delete a bad/corrupt dinode from disk, it was not deleting extended attributes associated with that dinode. Oops. This patch corrects the situation and allows it to delete them. rhbz#675723 --- gfs2/fsck/pass2.c | 55

[Cluster-devel] [PATCH 18/66] fsck.gfs2: fsck.gfs2: Find and clear duplicate leaf blocks refs

2012-01-20 Thread rpeterso
From: Bob Peterson rpete...@redhat.com Duplicate references that were in leaf blocks were never found nor cleared. This patch adds that capability. rhbz#675723 --- gfs2/fsck/pass1b.c | 15 +-- 1 files changed, 13 insertions(+), 2 deletions(-) diff --git a/gfs2/fsck/pass1b.c

[Cluster-devel] [PATCH 24/66] fsck.gfs pass2: Refactor function set_dotdot_dir

2012-01-20 Thread rpeterso
From: Bob Peterson rpete...@redhat.com This patch refactors function set_dotdot_dir to make it more readable. rhbz#675723 --- gfs2/fsck/pass2.c | 46 ++ 1 files changed, 26 insertions(+), 20 deletions(-) diff --git a/gfs2/fsck/pass2.c

[Cluster-devel] [PATCH 07/66] fsck.gfs2: Rename check_leaf to check_ealeaf_block

2012-01-20 Thread rpeterso
From: Bob Peterson rpete...@redhat.com This patch renames function check_leaf_block to check_ealeaf_block to avoid confusion between directory leaf block handling and extended attribute leaf block handling. rhbz#675723 --- gfs2/fsck/pass1.c | 11 +++ 1 files changed, 7 insertions(+),

[Cluster-devel] [PATCH 36/66] libgfs2: eliminate gfs1_rindex_read

2012-01-20 Thread rpeterso
From: Bob Peterson rpete...@redhat.com Now that function rindex_read is able to handle gfs1 file reading, this patch eliminates the gfs1-specific function gfs1_rindex_read. rhbz#675723 --- gfs2/edit/hexedit.c | 13 +++--- gfs2/libgfs2/gfs1.c | 62

[Cluster-devel] [PATCH 45/66] fsck.gfs2: Remove bad inodes from duplicate tree

2012-01-20 Thread rpeterso
From: Bob Peterson rpete...@redhat.com The problem was that if an inode was determined to be bad (lots of corruption) and its metadata blocks were invalidated in pass1, the bad block for the inode was set as data in the bitmap. Later, that caused duplicate reference processing (pass1b) to not

[Cluster-devel] [PATCH 43/66] fsck.gfs2: four-step duplicate elimination process

2012-01-20 Thread rpeterso
From: Bob Peterson rpete...@redhat.com This patch reforms the duplicate block reference processing by introducing a new four-step duplicate elimination process. Step 1. Delete inodes that reference the block and were previously marked invalid. Step 2. Delete inodes that reference the

[Cluster-devel] [PATCH 41/66] libgfs2: expand capabilities to operate on gfs1

2012-01-20 Thread rpeterso
From: Bob Peterson rpete...@redhat.com This patch expands many of the libgfs2 functions so that they may operate on gfs1 file systems, depending on the sdp-gfs1 variable. rhbz#675723 --- gfs2/libgfs2/fs_ops.c | 113 +++ gfs2/libgfs2/gfs1.c| 126

[Cluster-devel] [PATCH 48/66] libgfs2: Make rebuild functions not re-read ip

2012-01-20 Thread rpeterso
From: Bob Peterson rpete...@redhat.com Before this patch, the libgfs2 rebuild functions in structures.c were not consistent about reading in the gfs2_inode in-core struct. Some of the functions did and some didn't. The previous patch to make fsck.gfs2 operate on gfs1 introduced a problem because

[Cluster-devel] [PATCH 47/66] fsck.gfs2: Bad extended attributes not deleted properly

2012-01-20 Thread rpeterso
From: Bob Peterson rpete...@redhat.com This patch fixes a couple of problems fsck.gfs2 when it discovered corrupt extended attributes and tried to delete them. First, in check_eattr_entries it wasn't reporting the corruption. Second, when the EA block was freed, it wasn't returning a proper

[Cluster-devel] [PATCH 51/66] fsck.gfs2: system dinodes take priority over user dinodes

2012-01-20 Thread rpeterso
From: Bob Peterson rpete...@redhat.com In testing fsck.gfs2 I noticed some incorrect behavior: If a block was referenced incorrectly by two dinodes, fsck deleted which ever reference it found first. Therefore, if a system dinode and a user dinode referenced the same block, fsck.gfs2 could

[Cluster-devel] [PATCH 62/66] fsck.gfs2: Fix initialization error return codes

2012-01-20 Thread rpeterso
From: Bob Peterson rpete...@redhat.com In initialize.c there are several places where it can exit with an error. These places return with -1 where they should return the standard fsck error FSCK_ERROR. rhbz#675723 --- gfs2/fsck/initialize.c | 12 ++-- 1 files changed, 6 insertions(+),

[Cluster-devel] [PATCH 11/66] fsck.gfs2: fsck.gfs2: Make dir entry count 32 bits

2012-01-20 Thread rpeterso
From: Bob Peterson rpete...@redhat.com When counting directory links, fsck.gfs2 was using a 16-bit integer. Therefore, if a directory had more than 65535 links, it would wrap to zero and the counts would be damaged by fsck.gfs2. Subsequent runs would not find the corruption, but it was there

[Cluster-devel] [PATCH 27/66] fsck.gfs2 pass3: Refactor mark_and_return_parent

2012-01-20 Thread rpeterso
From: Bob Peterson rpete...@redhat.com This patch refactors pass3 function mark_and_return_parent. Before it was so complex and indented you could hardly interpret it. Now you can actually follow the logic. rhbz#675723 --- gfs2/fsck/pass3.c | 162

[Cluster-devel] [PATCH 30/66] fsck.gfs2: Add find_remove_dup, free_block_if_notdup

2012-01-20 Thread rpeterso
From: Bob Peterson rpete...@redhat.com This patch adds a couple new functions to util.c: find_remove_dup and free_block_if_notdup. This is a centralized function that is used to remove a duplicate reference. Each reference needs to be removed to determine when all duplicate references have been

[Cluster-devel] [PATCH 65/66] fsck.gfs2: Add return code checks and initializations

2012-01-20 Thread rpeterso
From: Bob Peterson rpete...@redhat.com This patch fixes several problems detected by the coverity tool whereby variables could be accessed without being initialized, and where return codes should be checked and were not. rhbz#675723 --- gfs2/fsck/fs_recovery.c |9

[Cluster-devel] [PATCH 08/66] fsck.gfs2: fsck.gfs2: Delete vestigial buffer_head in check_leaf

2012-01-20 Thread rpeterso
From: Bob Peterson rpete...@redhat.com This patch eliminates a variable bh from all the check_leaf metawalk functions because it is no longer referenced. rhbzs#675723 --- gfs2/fsck/metawalk.c | 10 -- gfs2/fsck/metawalk.h |5 ++--- gfs2/fsck/pass1.c| 14 ++ 3

[Cluster-devel] [PATCH 52/66] fsck.gfs2: Recognize partially gfs2-converted dinodes

2012-01-20 Thread rpeterso
From: Bob Peterson rpete...@redhat.com In testing fsck.gfs2 I noticed that if a file system had some leftover gfs2 dinodes (due to an interrupted gfs2_convert or in my case, because I had previously loaded gfs2 metadata that left gfs2 blocks laying around the gfs1 file system) those gfs2 dinodes

[Cluster-devel] [PATCH 29/66] fsck.gfs2: Don't use old_leaf if it was a duplicate

2012-01-20 Thread rpeterso
From: Bob Peterson rpete...@redhat.com In function check_leaf_blks fsck.gfs2 keeps track of the current leaf and the previous leaf. It can only check the number of pointers is correct for the old leaf after it finds a new leaf block. However, it was getting confused if the old leaf was a

[Cluster-devel] [PATCH 35/66] libgfs2: move block_map functions to fsck.gfs2

2012-01-20 Thread rpeterso
From: Bob Peterson rpete...@redhat.com Since the blockmap functions were only used in fsck.gfs2 they don't have a place in libgfs2. This patch moves them to fsck.gfs2. rhbz#675723 --- gfs2/fsck/metawalk.h |2 + gfs2/fsck/util.c | 72 ++

[Cluster-devel] [PATCH 66/66] libgfs2: Fix null pointer dereference in linked_leaf_search

2012-01-20 Thread rpeterso
From: Bob Peterson rpete...@redhat.com Fix a null pointer dereference by checking the value of the bh set by get_first_leaf(). Looking down the call tree the bh is set to NULL when __bread fails to allocate memory so we can use errno as the return value here. rhbz#675723 ---

[Cluster-devel] [PATCH 20/66] fsck.gfs2: fsck.gfs2: Duplicate ref processing for leaf blocks

2012-01-20 Thread rpeterso
From: Bob Peterson rpete...@redhat.com This patch adds checks for duplicate block references to the leaf block processing. rhbz#675723 --- gfs2/fsck/pass1.c | 20 1 files changed, 20 insertions(+), 0 deletions(-) diff --git a/gfs2/fsck/pass1.c b/gfs2/fsck/pass1.c index

[Cluster-devel] [PATCH 05/66] libgfs2: move gfs1 structures to libgfs2

2012-01-20 Thread rpeterso
From: Bob Peterson rpete...@redhat.com This patch moves a number of gfs1-specific structures from gfs2_edit to libgfs2 so other utils can reference them. It also changes function rindex_read so it can operate on gfs1 or gfs2 rindex files. rhbz#675723 --- gfs2/edit/extended.c | 11 +++--

[Cluster-devel] [PATCH 21/66] fsck.gfs2: fsck.gfs2: split check_leaf_blks to be more readable

2012-01-20 Thread rpeterso
From: Bob Peterson rpete...@redhat.com This patch splits function check_leaf_blks into two functions to make it more understandable. Before, it had way too many levels of indentation and spanned multiple screens. This makes it a lot more clear. rhbz#675723 --- gfs2/fsck/metawalk.c | 255

[Cluster-devel] [PATCH 50/66] fsck.gfs2: Increment link count reporting wrong dinode

2012-01-20 Thread rpeterso
From: Bob Peterson rpete...@redhat.com The output from fsck.gfs2 was wrong when it reported about a link count change for lost+found. This patch fixes the message so it reports the correct dinode block number. rhbz#675723 --- gfs2/fsck/lost_n_found.c |2 +- 1 files changed, 1

[Cluster-devel] [PATCH 64/66] fsck.gfs2: Fix memory leak in initialize.c

2012-01-20 Thread rpeterso
From: Bob Peterson rpete...@redhat.com This patch fixes a memory leak whereby dinodes were not being freed under certain conditions. rhbz#675723 --- gfs2/fsck/initialize.c | 25 - 1 files changed, 16 insertions(+), 9 deletions(-) diff --git a/gfs2/fsck/initialize.c

[Cluster-devel] [PATCH 17/66] fsck.gfs2: fsck.gfs2: Don't stop invalidating blocks on invalid

2012-01-20 Thread rpeterso
From: Bob Peterson rpete...@redhat.com When fsck found a duplicate reference to a block it invalidated the dinode's metadata. But if it encountered an invalid block, for example, out of range, the invalidating would stop. If we encounter a block that isn't valid, we obviously can't invalidate

[Cluster-devel] [PATCH 33/66] libgfs2: Mark buffer modified adding a new GFS1 block

2012-01-20 Thread rpeterso
From: Bob Peterson rpete...@redhat.com When adding new blocks to the file system for GFS1, function gfs1_lookup_block was not marking the buffer and dinode buffer as modified like gfs2_lookup_block does. This patch fixes that. rhbz#675723 --- gfs2/libgfs2/gfs1.c |2 ++ 1 files changed, 2

[Cluster-devel] [PATCH 37/66] libgfs2: combine ri_update and gfs1_ri_update

2012-01-20 Thread rpeterso
From: Bob Peterson rpete...@redhat.com Since gfs1_ri_update is nearly identical to ri_update, I decided to combine the main logic into a common function. That simplifies the code and if one gets fixed, they both get fixed automatically. rhbz#675723 --- gfs2/libgfs2/gfs1.c | 49

[Cluster-devel] [PATCH 40/66] gfs2_edit savemeta: save_inode_data backward for gfs1

2012-01-20 Thread rpeterso
From: Bob Peterson rpete...@redhat.com The logic in gfs2_edit savemeta was wrong for saving inode blocks. This patch fixes the logic. rhbz#675723 --- gfs2/edit/savemeta.c |8 1 files changed, 4 insertions(+), 4 deletions(-) diff --git a/gfs2/edit/savemeta.c b/gfs2/edit/savemeta.c

[Cluster-devel] [PATCH 31/66] fsck.gfs2: don't free prev rgrp list repairing rgrps

2012-01-20 Thread rpeterso
From: Bob Peterson rpete...@redhat.com In cases where fsck.gfs2 is trying to repair damaged resource groups or rindex, it tries several levels of repair. Some of those levels build a list of expected resource groups and check them against the actual ones, and the previous list is freed before

[Cluster-devel] [PATCH 54/66] fsck.gfs2: pass1c counts percentage backward

2012-01-20 Thread rpeterso
From: Bob Peterson rpete...@redhat.com In testing I noticed that pass1c, which checks all extended attributes, counted percent-complete backwards. It's better to count forward because disk block seeks will be more efficient. This patch changes the special_list functions of block_list to add

[Cluster-devel] [PATCH 06/66] fsck.gfs2: Check for blocks wrongly inside resource groups

2012-01-20 Thread rpeterso
From: Bob Peterson rpete...@redhat.com It's not enough to range_check blocks in order to call them valid. We also need to check whether those block collide with resource groups. We don't want a bitmap block to ever be referenced unless it's part of the rgrp and rindex functions. This patch

[Cluster-devel] [PATCH 61/66] fsck.gfs2: Rearrange block types to group all inode types

2012-01-20 Thread rpeterso
From: Bob Peterson rpete...@redhat.com This patch rearranges the declares in util.h such that all the inode types are grouped together. There's a place in fsck.gfs2 that checks whether a block is an inode by checking the range of block types. But that's only valid if they are all grouped

[Cluster-devel] [PATCH 39/66] libgfs2: move gfs1 functions from edit to libgfs2

2012-01-20 Thread rpeterso
From: Bob Peterson rpete...@redhat.com This patch moves some gfs1-specific functions from gfs2_edit to libgfs2 so that other utils can eventually operate on gfs1 file systems. rhbz#675723 --- gfs2/edit/hexedit.c| 47 --- gfs2/edit/hexedit.h|

[Cluster-devel] [PATCH 10/66] fsck.gfs2: fsck.gfs2: Sync di_nlink adding links for lost+found

2012-01-20 Thread rpeterso
From: Bob Peterson rpete...@redhat.com When adding a .. entry to a directory newly linked to lost+found fsck.gfs2 needs to update its di_nlink value to account for the new link. If not, it can correct the di_nlink value to the wrong value and not find the error until a second fsck.gfs2 is done.

[Cluster-devel] [PATCH 49/66] fsck.gfs2: Shorten debug output

2012-01-20 Thread rpeterso
From: Bob Peterson rpete...@redhat.com This patch considerably shortens the debug output of fsck.gfs2 by doing a few things. First, if fsck is just reporting the setting of block types, it abbreviates the output by just listing other blocks in parenthesis. Second, some of the key debug messages

[Cluster-devel] [PATCH 63/66] fsck.gfs2: Don't use strerror for libgfs2 errors

2012-01-20 Thread rpeterso
From: Bob Peterson rpete...@redhat.com This patch removes the calls to strerror from initialize.c. The errors returned by libgfs2 currently don't conform to system errors. For example, they can return positive or negative numbers. Therefore, strerror could segfault or give nonsense messages. I

[Cluster-devel] [PATCH 46/66] fsck.gfs2: Handle duplicate reference to dinode blocks

2012-01-20 Thread rpeterso
From: Bob Peterson rpete...@redhat.com The fsck.gfs2 tool was not properly handling cases where dinode blocks were referenced by other dinodes as another type. For example, if some dinode wrongly thought that another dinode was one of its metadata blocks or data blocks. This patch fixes that

[Cluster-devel] [PATCH 38/66] libgfs2: combine gfs_inode_read and gfs_inode_get

2012-01-20 Thread rpeterso
From: Bob Peterson rpete...@redhat.com Functions gfs_inode_read and gfs_inode_get were nearly identical. They did the same exact thing, but one operated on a buffer passed in while the other read the buffer from the media. This patch combines the two into a common function and two replacement

[Cluster-devel] [PATCH 28/66] fsck.gfs2: misc cosmetic changes

2012-01-20 Thread rpeterso
From: Bob Peterson rpete...@redhat.com This patch is just cosmetic changes. It cleans up comments and code but there should be no logic changes. rhbz#675723 --- gfs2/fsck/metawalk.c | 17 +++-- gfs2/fsck/pass1.c|8 gfs2/fsck/pass1b.c |9 +

[Cluster-devel] [PATCH 34/66] libgfs2: Use dinode buffer to map gfs1 dinode blocks

2012-01-20 Thread rpeterso
From: Bob Peterson rpete...@redhat.com When function gfs1_block_map found a block for a stuffed file it wasn't returning the dinode buffer, it was returning the block as a new buffer. The problem is, if changes are made to the block, they will be overwritten by the dinode buffer when that is

[Cluster-devel] [PATCH 59/66] gfs2_edit: Fix memory leaks

2012-01-20 Thread rpeterso
From: Bob Peterson rpete...@redhat.com This patch plugs a couple memory leaks found by valgrind. rhbz#675723 --- gfs2/edit/savemeta.c | 10 -- 1 files changed, 8 insertions(+), 2 deletions(-) diff --git a/gfs2/edit/savemeta.c b/gfs2/edit/savemeta.c index 33f2970..1b9d0a8 100644 ---

[Cluster-devel] [PATCH 01/66] fsck.gfs2: Make functions use sdp rather than sbp

2012-01-20 Thread rpeterso
From: Bob Peterson rpete...@redhat.com For years, the fsck.gfs2 tool used two different variable names to refer to the same structure: sdp and sbp. This patch changes them all to sdp so they are now consistent with the kernel code. rhbz#675723 --- gfs2/fsck/fsck.h | 20 ++--

  1   2   >