Skip to contentSkip to conversation

Cluster Project branch, RHEL5, updated. cmirror_1_1_15-173-gfd23d8d

Cluster-devel [email protected] 1 participant 1 message Jul 24, 2008

lore
Share & tools
lore
#0 lore raw

This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Cluster Project".

http://sources.redhat.com/git/gitweb.cgi?p=cluster.git;a=commitdiff;h=fd23d8d2b677fc3116e0fa0ce53b73feea47a06f

The branch, RHEL5 has been updated

       via  fd23d8d2b677fc3116e0fa0ce53b73feea47a06f (commit)
       via  9ec515f67398d63f49724ac1f6f48f5c11a99cec (commit)
       via  697309e6e6039884b733999cade1e847f4c6eb70 (commit)
       via  b54e95b76d01e12c463553ed464a990da1962f0d (commit)
       via  9e261bb6f8edfb1c9db5a30d3bd98375533ef357 (commit)
       via  5f4cd5a9ca316478a17ccdc078dd78f3c511f0ce (commit)
       via  3f95fdad6c0884257c5e247d3319bbf8171ffc85 (commit)
       via  ddbca2d904b28c1c5e1530c7f15543390c1262d3 (commit)
       via  2554501b13047ddd42650eb2dd9875ca57bf0489 (commit)
       via  e8a2e811800d074d8725cc239dafaf2f7ac04783 (commit)
      from  613d97438673200c87e4b07e3c4ee659c01acf65 (commit)

Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below.

- Log ----------------------------------------------------------------- commit fd23d8d2b677fc3116e0fa0ce53b73feea47a06f

Author: Bob Peterson <[email protected]>
Date:   Thu Jul 24 10:15:23 2008 -0500

gfs2_fsck dupl. blocks between EA and data

commit 9ec515f67398d63f49724ac1f6f48f5c11a99cec

Author: Bob Peterson <[email protected]>
Date:   Thu Jul 24 09:49:33 2008 -0500

RGRepair: Account for RG blocks inside journals

commit 697309e6e6039884b733999cade1e847f4c6eb70

Author: Bob Peterson <[email protected]>
Date:   Wed Jul 23 17:36:42 2008 -0500

Better error reporting in gfs2_fsck

commit b54e95b76d01e12c463553ed464a990da1962f0d

Author: Bob Peterson <[email protected]>
Date:   Wed Jul 23 17:18:13 2008 -0500

Shrink memory 3: smaller link counts in inode_info

commit 9e261bb6f8edfb1c9db5a30d3bd98375533ef357

Author: Bob Peterson <[email protected]>
Date:   Thu Jul 24 09:45:16 2008 -0500

Shrink memory 2: get rid of 3 huge in-core bitmaps

commit 5f4cd5a9ca316478a17ccdc078dd78f3c511f0ce

Author: Bob Peterson <[email protected]>
Date:   Wed Jul 23 14:46:55 2008 -0500

Shrink memory 1: eliminate b_size from pseudo-buffer-heads

commit 3f95fdad6c0884257c5e247d3319bbf8171ffc85

Author: Bob Peterson <[email protected]>
Date:   Wed Jul 23 14:17:52 2008 -0500

Deleted unused function print_map

commit ddbca2d904b28c1c5e1530c7f15543390c1262d3

Author: Bob Peterson <[email protected]>
Date:   Wed Jul 23 14:15:16 2008 -0500

Fix some bad references to gfs_tool and gfs_fsck

commit 2554501b13047ddd42650eb2dd9875ca57bf0489

Author: Bob Peterson <[email protected]>
Date:   Wed Jul 23 14:09:19 2008 -0500

gfs_fsck crosswrite for block number sanity checking

commit e8a2e811800d074d8725cc239dafaf2f7ac04783

Author: Bob Peterson <[email protected]>
Date:   Wed Jul 23 14:03:50 2008 -0500

Speed up userspace bitmap manipulation code.

-----------------------------------------------------------------------

Summary of changes:

 gfs2/edit/savemeta.c      |    9 +-
 gfs2/fsck/eattr.c         |   21 ++-
 gfs2/fsck/eattr.h         |   20 +-
 gfs2/fsck/fs_recovery.c   |    4 +-
 gfs2/fsck/fsck.h          |    5 +-
 gfs2/fsck/initialize.c    |   10 +-
 gfs2/fsck/lost_n_found.c  |    5 +-
 gfs2/fsck/main.c          |   35 +----
 gfs2/fsck/metawalk.c      |  177 +++++++++++++-------
 gfs2/fsck/metawalk.h      |   16 ++-
 gfs2/fsck/pass1.c         |  405 +++++++++++++++++++++++++++++----------------
 gfs2/fsck/pass1b.c        |   95 +++++------
 gfs2/fsck/pass1c.c        |   69 +++++---
 gfs2/fsck/pass2.c         |   61 ++++---
 gfs2/fsck/pass3.c         |   20 ++-
 gfs2/fsck/pass4.c         |   11 +-
 gfs2/fsck/pass5.c         |    2 +-
 gfs2/fsck/rgrepair.c      |   58 ++++++-
 gfs2/libgfs2/bitmap.c     |   79 +++++++--
 gfs2/libgfs2/block_list.c |  232 ++++++++++++--------------
 gfs2/libgfs2/buf.c        |    1 -
 gfs2/libgfs2/fs_bits.c    |    2 +-
 gfs2/libgfs2/fs_ops.c     |   38 +++--
 gfs2/libgfs2/libgfs2.h    |   93 +++++++----
 gfs2/libgfs2/recovery.c   |    2 +-
 gfs2/libgfs2/rgrp.c       |    8 +
 26 files changed, 893 insertions(+), 585 deletions(-)
gfs2/edit/savemeta.c +5 -4
index cff2f30..f298dd7 100644
@@ -554,7 +554,7 @@ void save_indirect_blocks(int out_fd, osi_list_t *cur_list,
 		     sizeof(struct gfs2_dinode));
 
 	for (ptr = (uint64_t *)(mybh->b_data + head_size);
-	     (char *)ptr < (mybh->b_data + mybh->b_size); ptr++) {
+	     (char *)ptr < (mybh->b_data + sbd.bsize); ptr++) {
 		if (!*ptr)
 			continue;
 		indir_block = be64_to_cpu(*ptr);
@@ -805,7 +805,8 @@ void savemeta(const char *out_fn, int saveoption)
 		fflush(stdout);
 	}
 	if (!slow) {
-		blocklist = gfs2_block_list_create(last_fs_block + 1, &memreq);
+		blocklist = gfs2_block_list_create(&sbd, last_fs_block + 1,
+						   &memreq);
 		if (!blocklist)
 			slow = TRUE;
 	}
@@ -844,7 +845,7 @@ void savemeta(const char *out_fn, int saveoption)
 			log_debug("RG at %"PRIu64" is %u long\n",
 				  rgd->ri.ri_addr, rgd->ri.ri_length);
 			for (i = 0; i < rgd->ri.ri_length; i++) {
-				if(gfs2_block_set(blocklist,
+				if(gfs2_block_set(&sbd, blocklist,
 						  rgd->ri.ri_addr + i,
 						  gfs2_meta_other))
 					break;
@@ -879,7 +880,7 @@ void savemeta(const char *out_fn, int saveoption)
 	}
 	/* Clean up */
 	if (blocklist)
-		gfs2_block_list_destroy(blocklist);
+		gfs2_block_list_destroy(&sbd, blocklist);
 	/* There may be a gap between end of file system and end of device */
 	/* so we tell the user that we've processed everything. */
 	block = last_fs_block;
gfs2/fsck/eattr.c +11 -10
index 42753ca..5f43ba6 100644
@@ -21,7 +21,7 @@ static int clear_blk_nodup(struct gfs2_sbd *sbp, uint64_t block)
 {
 	struct gfs2_block_query q;
 
-	if(gfs2_block_check(bl, block, &q)) {
+	if(gfs2_block_check(sbp, bl, block, &q)) {
 		stack;
 		return -1;
 	}
@@ -31,7 +31,7 @@ static int clear_blk_nodup(struct gfs2_sbd *sbp, uint64_t block)
 		return 1;
 	}
 
-	gfs2_block_set(bl, block, gfs2_block_free);
+	gfs2_block_set(sbp, bl, block, gfs2_block_free);
 
 	return 0;
 
@@ -39,22 +39,20 @@ static int clear_blk_nodup(struct gfs2_sbd *sbp, uint64_t block)
 
 int clear_eattr_indir(struct gfs2_inode *ip, uint64_t block,
 		      uint64_t parent, struct gfs2_buffer_head **bh,
-		      void *private)
+		      enum update_flags *want_updated, void *private)
 {
+	*want_updated = not_updated;
 	return clear_blk_nodup(ip->i_sbd, block);
 }
 
-
 int clear_eattr_leaf(struct gfs2_inode *ip, uint64_t block,
 		     uint64_t parent, struct gfs2_buffer_head **bh,
-		     void *private)
+		     enum update_flags *want_updated, void *private)
 {
-
+	*want_updated = not_updated;
 	return clear_blk_nodup(ip->i_sbd, block);
-
 }
 
-
 int clear_eattr_entry (struct gfs2_inode *ip,
 		       struct gfs2_buffer_head *leaf_bh,
 		       struct gfs2_ea_header *ea_hdr,
@@ -101,11 +99,14 @@ int clear_eattr_entry (struct gfs2_inode *ip,
 }
 
 int clear_eattr_extentry(struct gfs2_inode *ip, uint64_t *ea_data_ptr,
-			 struct gfs2_buffer_head *leaf_bh, struct gfs2_ea_header *ea_hdr,
-			 struct gfs2_ea_header *ea_hdr_prev, void *private)
+			 struct gfs2_buffer_head *leaf_bh,
+			 struct gfs2_ea_header *ea_hdr,
+			 struct gfs2_ea_header *ea_hdr_prev,
+			 enum update_flags *want_updated, void *private)
 {
 	uint64_t block = be64_to_cpu(*ea_data_ptr);
 
+	*want_updated = not_updated;
 	return clear_blk_nodup(ip->i_sbd, block);
 
 }
gfs2/fsck/eattr.h +10 -10
index 75991c0..674ee27 100644
@@ -13,21 +13,21 @@
 #ifndef _EATTR_H
 #define _EATTR_H
 
-int clear_eattr_indir(struct gfs2_inode *ip, uint64_t block,
-					  uint64_t parent, struct gfs2_buffer_head **bh,
-					  void *private);
-int clear_eattr_leaf(struct gfs2_inode *ip, uint64_t block,
-					 uint64_t parent, struct gfs2_buffer_head **bh,
-					 void *private);
+int clear_eattr_indir(struct gfs2_inode *ip, uint64_t block, uint64_t parent,
+		      struct gfs2_buffer_head **bh,
+		      enum update_flags *want_updated, void *private);
+int clear_eattr_leaf(struct gfs2_inode *ip, uint64_t block, uint64_t parent,
+		     struct gfs2_buffer_head **bh,
+		     enum update_flags *want_updated, void *private);
 int clear_eattr_entry (struct gfs2_inode *ip,
 					   struct gfs2_buffer_head *leaf_bh,
 					   struct gfs2_ea_header *ea_hdr,
 					   struct gfs2_ea_header *ea_hdr_prev,
 					   void *private);
 int clear_eattr_extentry(struct gfs2_inode *ip, uint64_t *ea_data_ptr,
-						 struct gfs2_buffer_head *leaf_bh,
-						 struct gfs2_ea_header *ea_hdr,
-						 struct gfs2_ea_header *ea_hdr_prev,
-						 void *private);
+			 struct gfs2_buffer_head *leaf_bh,
+			 struct gfs2_ea_header *ea_hdr,
+			 struct gfs2_ea_header *ea_hdr_prev,
+			 enum update_flags *want_updated, void *private);
 
 #endif /* _EATTR_H */
gfs2/fsck/fs_recovery.c +2 -2
index 3b25dc6..b21760b 100644
@@ -134,7 +134,7 @@ static int buf_lo_scan_elements(struct gfs2_inode *ip, unsigned int start,
 			return error;
 
 		bh_ip = bget(sdp, blkno);
-		memcpy(bh_ip->b_data, bh_log->b_data, bh_log->b_size);
+		memcpy(bh_ip->b_data, bh_log->b_data, sdp->bsize);
 
 		check_magic = ((struct gfs2_meta_header *)
 			       (bh_ip->b_data))->mh_magic;
@@ -231,7 +231,7 @@ static int databuf_lo_scan_elements(struct gfs2_inode *ip, unsigned int start,
 			return error;
 
 		bh_ip = bget(sdp, blkno);
-		memcpy(bh_ip->b_data, bh_log->b_data, bh_log->b_size);
+		memcpy(bh_ip->b_data, bh_log->b_data, sdp->bsize);
 
 		/* Unescape */
 		if (esc) {
gfs2/fsck/fsck.h +2 -3
index 6220963..e36c3b8 100644
@@ -25,9 +25,9 @@ struct inode_info
 {
         osi_list_t list;
         uint64_t   inode;
-        uint32_t   link_count;   /* the number of links the inode
+        uint16_t   link_count;   /* the number of links the inode
                                   * thinks it has */
-        uint32_t   counted_links; /* the number of links we've found */
+        uint16_t   counted_links; /* the number of links we've found */
 };
 
 struct dir_info
@@ -89,6 +89,5 @@ extern uint64_t last_fs_block, last_reported_block;
 extern int skip_this_pass, fsck_abort, fsck_query;
 extern uint64_t last_data_block;
 extern uint64_t first_data_block;
-extern osi_list_t dup_list;
 
 #endif /* _FSCK_H */
gfs2/fsck/initialize.c +5 -5
index d759b09..7d957ee 100644
@@ -122,7 +122,7 @@ static void empty_super_block(struct gfs2_sbd *sdp)
 		}
 	}
 
-	gfs2_block_list_destroy(bl);
+	gfs2_block_list_destroy(sdp, bl);
 }
 
 
@@ -277,11 +277,11 @@ static int init_system_inodes(struct gfs2_sbd *sdp)
 		goto fail;
 	}
 
-	bl = gfs2_block_list_create(last_fs_block+1, &addl_mem_needed);
+	bl = gfs2_block_list_create(sdp, last_fs_block+1, &addl_mem_needed);
 	if (!bl) {
 		log_crit("This system doesn't have enough memory + swap space to fsck this file system.\n");
 		log_crit("Additional memory needed is approximately: %ldMB\n", addl_mem_needed / 1048576);
-		log_crit("Please increase your swap space by that amount and run gfs_fsck again.\n");
+		log_crit("Please increase your swap space by that amount and run gfs2_fsck again.\n");
 		goto fail;
 	}
 	return 0;
@@ -385,8 +385,8 @@ static void destroy_sbp(struct gfs2_sbd *sbp)
 {
 	if(!opts.no) {
 		if(block_mounters(sbp, 0)) {
-			log_warn("Unable to unblock other mounters - manual intevention required\n");
-			log_warn("Use 'gfs_tool sb <device> proto' to fix\n");
+			log_warn("Unable to unblock other mounters - manual intervention required\n");
+			log_warn("Use 'gfs2_tool sb <device> proto' to fix\n");
 		}
 		log_info("Syncing the device.\n");
 		fsync(sbp->device_fd);
gfs2/fsck/lost_n_found.c +3 -2
index e836539..3990e44 100644
@@ -45,7 +45,7 @@ int add_inode_to_lf(struct gfs2_inode *ip){
 		log_info("Locating/Creating lost and found directory\n");
 
         lf_dip = createi(ip->i_sbd->md.rooti, "lost+found", S_IFDIR | 0700, 0);
-		if(gfs2_block_check(bl, lf_dip->i_di.di_num.no_addr, &q)) {
+	if(gfs2_block_check(ip->i_sbd, bl, lf_dip->i_di.di_num.no_addr, &q)) {
 			stack;
 			return -1;
 		}
@@ -58,7 +58,8 @@ int add_inode_to_lf(struct gfs2_inode *ip){
 			 * directory or just found an old one, and we
 			 * used that instead of the block_type to run
 			 * this */
-			gfs2_block_set(bl, lf_dip->i_di.di_num.no_addr, gfs2_inode_dir);
+			gfs2_block_set(ip->i_sbd, bl,
+				       lf_dip->i_di.di_num.no_addr, gfs2_inode_dir);
 			increment_link(ip->i_sbd,
 						   ip->i_sbd->md.rooti->i_di.di_num.no_addr);
 			increment_link(ip->i_sbd, lf_dip->i_di.di_num.no_addr);
gfs2/fsck/main.c +6 -29
index 8ee1de3..928cd1c 100644
@@ -35,7 +35,6 @@ int skip_this_pass = FALSE, fsck_abort = FALSE;
 const char *pass = "";
 uint64_t last_data_block;
 uint64_t first_data_block;
-osi_list_t dup_list;
 char *prog_name = "gfs2_fsck"; /* needed by libgfs2 */
 
 /* This function is for libgfs2's sake.                                      */
@@ -49,29 +48,6 @@ void print_it(const char *label, const char *fmt, const char *fmt2, ...)
 	va_end(args);
 }
 
-void print_map(struct gfs2_block_list *il, int count)
-{
-	int i, j;
-	struct gfs2_block_query k;
-
-	log_info("Printing map of blocks - 80 blocks per row\n");
-	j = 0;
-	for(i = 0; i < count; i++) {
-		if(j > 79) {
-			log_info("\n");
-			j = 0;
-		}
-		else if(!(j %10) && j != 0) {
-			log_info(" ");
-		}
-		j++;
-		gfs2_block_check(il, i, &k);
-		log_info("%X", k.block_type);
-
-	}
-	log_info("\n");
-}
-
 void usage(char *name)
 {
 	printf("Usage: %s [-hnqvVy] <device> \n", basename(name));
@@ -149,7 +125,7 @@ void interrupt(int sig)
 			PRIu64 "\n", last_reported_block, last_fs_block);
 	
 	response = generic_interrupt("gfs2_fsck", pass, progress,
-				     "Do you want to abort gfs_fsck, skip " \
+				     "Do you want to abort gfs2_fsck, skip " \
 				     "the rest of this pass or continue " \
 				     "(a/s/c)?", "asc");
 	if(tolower(response) == 's') {
@@ -182,7 +158,7 @@ int check_system_inode(struct gfs2_inode *sysinode, const char *filename,
 		
 		/* FIXME: check this block's validity */
 
-		if(gfs2_block_check(bl, iblock, &ds.q)) {
+		if(gfs2_block_check(sysinode->i_sbd, bl, iblock, &ds.q)) {
 			log_crit("Can't get %s inode block %" PRIu64 " (0x%"
 				 PRIx64 ") from block list\n", filename,
 				 iblock, iblock);
@@ -194,7 +170,8 @@ int check_system_inode(struct gfs2_inode *sysinode, const char *filename,
 		/* Just reuse the inode and fix the bitmap.         */
 		if (ds.q.block_type == gfs2_block_free) {
 			log_info("The inode exists but the block is not marked 'in use'; fixing it.\n");
-			gfs2_block_set(bl, sysinode->i_di.di_num.no_addr,
+			gfs2_block_set(sysinode->i_sbd, bl,
+				       sysinode->i_di.di_num.no_addr,
 				       mark);
 			ds.q.block_type = mark;
 			if (mark == gfs2_inode_dir)
@@ -213,7 +190,8 @@ int check_system_inode(struct gfs2_inode *sysinode, const char *filename,
 		if (query(&opts, "Create new %s system inode? (y/n) ",
 			  filename)) {
 			builder(sysinode->i_sbd);
-			gfs2_block_set(bl, sysinode->i_di.di_num.no_addr,
+			gfs2_block_set(sysinode->i_sbd, bl,
+				       sysinode->i_di.di_num.no_addr,
 				       mark);
 			ds.q.block_type = mark;
 			if (mark == gfs2_inode_dir)
@@ -402,7 +380,6 @@ int main(int argc, char **argv)
 	inode_put(sbp->master_dir, update_sys_files);
 	if (lf_dip)
 		inode_put(lf_dip, update_sys_files);
-/*	print_map(sbp->bl, sbp->last_fs_block); */
 
 	if (!opts.no)
 		log_notice("Writing changes to disk\n");
gfs2/fsck/metawalk.c +117 -60

347 lines not on this page · raw message

gfs2/fsck/metawalk.h +12 -4
index 2b0f847..44ac31a 100644
@@ -18,7 +18,8 @@
 
 struct metawalk_fxns;
 
-int check_inode_eattr(struct gfs2_inode *ip, struct metawalk_fxns *pass);
+int check_inode_eattr(struct gfs2_inode *ip, enum update_flags *want_updated,
+		      struct metawalk_fxns *pass);
 int check_metatree(struct gfs2_inode *ip, struct metawalk_fxns *pass);
 int check_dir(struct gfs2_sbd *sbp, uint64_t block,
 			  struct metawalk_fxns *pass);
@@ -53,15 +54,18 @@ struct metawalk_fxns {
 			   void *private);
 	int (*check_eattr_indir) (struct gfs2_inode *ip, uint64_t block,
 				  uint64_t parent,
-				  struct gfs2_buffer_head **bh, void *private);
+				  struct gfs2_buffer_head **bh,
+				  enum update_flags *want_updated,
+				  void *private);
 	int (*check_eattr_leaf) (struct gfs2_inode *ip, uint64_t block,
 				 uint64_t parent, struct gfs2_buffer_head **bh,
+				 enum update_flags *want_updated,
 				 void *private);
 	int (*check_dentry) (struct gfs2_inode *ip, struct gfs2_dirent *de,
 			     struct gfs2_dirent *prev,
 			     struct gfs2_buffer_head *bh,
-			     char *filename, int *update, uint16_t *count,
-			     void *private);
+			     char *filename, enum update_flags *update,
+			     uint16_t *count, void *private);
 	int (*check_eattr_entry) (struct gfs2_inode *ip,
 				  struct gfs2_buffer_head *leaf_bh,
 				  struct gfs2_ea_header *ea_hdr,
@@ -72,7 +76,11 @@ struct metawalk_fxns {
 				     struct gfs2_buffer_head *leaf_bh,
 				     struct gfs2_ea_header *ea_hdr,
 				     struct gfs2_ea_header *ea_hdr_prev,
+				     enum update_flags *want_updated,
 				     void *private);
+	int (*finish_eattr_indir) (struct gfs2_inode *ip, int indir_ok,
+				   enum update_flags *want_updated,
+				   void *private);
 };
 
 #endif /* _METAWALK_H */
gfs2/fsck/pass1.c +264 -141

717 lines not on this page · raw message

gfs2/fsck/pass1b.c +44 -51

252 lines not on this page · raw message

gfs2/fsck/pass1c.c +45 -24

160 lines not on this page · raw message

gfs2/fsck/pass2.c +36 -25

197 lines not on this page · raw message

gfs2/fsck/pass3.c +13 -7
index 58e0009..719d0b1 100644
@@ -85,13 +85,14 @@ struct dir_info *mark_and_return_parent(struct gfs2_sbd *sbp,
 				   PRIu64" (0x%" PRIx64 ")\n", di->dotdot_parent,
 				   di->dotdot_parent, di->treewalk_parent,
 				   di->treewalk_parent);
-		if(gfs2_block_check(bl, di->dotdot_parent, &q_dotdot)) {
+		if(gfs2_block_check(sbp, bl, di->dotdot_parent, &q_dotdot)) {
 			log_err("Unable to find block %"PRIu64
 					" (0x%" PRIx64 ") in block map.\n",
 					di->dotdot_parent, di->dotdot_parent);
 			return NULL;
 		}
-		if(gfs2_block_check(bl, di->treewalk_parent, &q_treewalk)) {
+		if(gfs2_block_check(sbp, bl, di->treewalk_parent,
+				    &q_treewalk)) {
 			log_err("Unable to find block %"PRIu64
 					" (0x%" PRIx64 ") in block map\n",
 					di->treewalk_parent, di->treewalk_parent);
@@ -160,7 +161,7 @@ struct dir_info *mark_and_return_parent(struct gfs2_sbd *sbp,
 		}
 	}
 	else {
-		if(gfs2_block_check(bl, di->dotdot_parent, &q_dotdot)) {
+		if(gfs2_block_check(sbp, bl, di->dotdot_parent, &q_dotdot)) {
 			log_err("Unable to find parent block %"PRIu64
 					" (0x%" PRIx64 ")  in block map\n",
 					di->dotdot_parent, di->dotdot_parent);
@@ -220,7 +221,7 @@ int pass3(struct gfs2_sbd *sbp)
 
 			/* FIXME: Factor this ? */
 			if(!tdi) {
-				if(gfs2_block_check(bl, di->dinode, &q)) {
+				if(gfs2_block_check(sbp, bl, di->dinode, &q)) {
 					stack;
 					return -1;
 				}
@@ -228,7 +229,9 @@ int pass3(struct gfs2_sbd *sbp)
 					log_err("Found unlinked directory containing bad block\n");
 					if(query(&opts,
 					   "Clear unlinked directory with bad blocks? (y/n) ")) {
-						gfs2_block_set(bl, di->dinode, gfs2_block_free);
+						gfs2_block_set(sbp, bl,
+							       di->dinode,
+							       gfs2_block_free);
 						break;
 					} else
 						log_err("Unlinked directory with bad block remains\n");
@@ -241,7 +244,8 @@ int pass3(struct gfs2_sbd *sbp)
 				   q.block_type != gfs2_inode_fifo &&
 				   q.block_type != gfs2_inode_sock) {
 					log_err("Unlinked block marked as inode not an inode\n");
-					gfs2_block_set(bl, di->dinode, gfs2_block_free);
+					gfs2_block_set(sbp, bl, di->dinode,
+						       gfs2_block_free);
 					log_err("Cleared\n");
 					break;
 				}
@@ -254,7 +258,9 @@ int pass3(struct gfs2_sbd *sbp)
 				if(!ip->i_di.di_size && !ip->i_di.di_eattr){
 					log_err("Unlinked directory has zero size.\n");
 					if(query(&opts, "Remove zero-size unlinked directory? (y/n) ")) {
-						gfs2_block_set(bl, di->dinode, gfs2_block_free);
+						gfs2_block_set(sbp, bl,
+							       di->dinode,
+							       gfs2_block_free);
 						fsck_inode_put(ip, not_updated);
 						break;
 					} else {
gfs2/fsck/pass4.c +7 -4
index 8a9e733..583a266 100644
@@ -60,7 +60,7 @@ int scan_inode_list(struct gfs2_sbd *sbp, osi_list_t *list) {
 		if(ii->counted_links == 0) {
 			log_err("Found unlinked inode at %" PRIu64 " (0x%" PRIx64 ")\n",
 					ii->inode, ii->inode);
-			if(gfs2_block_check(bl, ii->inode, &q)) {
+			if(gfs2_block_check(sbp, bl, ii->inode, &q)) {
 				stack;
 				return -1;
 			}
@@ -68,7 +68,8 @@ int scan_inode_list(struct gfs2_sbd *sbp, osi_list_t *list) {
 				log_err("Unlinked inode contains bad blocks\n", ii->inode);
 				if(query(&opts,
 						 "Clear unlinked inode with bad blocks? (y/n) ")) {
-					gfs2_block_set(bl, ii->inode, gfs2_block_free);
+					gfs2_block_set(sbp, bl, ii->inode,
+						       gfs2_block_free);
 					continue;
 				} else
 					log_err("Unlinked inode with bad blocks not cleared\n");
@@ -81,7 +82,8 @@ int scan_inode_list(struct gfs2_sbd *sbp, osi_list_t *list) {
 			   q.block_type != gfs2_inode_fifo &&
 			   q.block_type != gfs2_inode_sock) {
 				log_err("Unlinked block marked as inode not an inode\n");
-				gfs2_block_set(bl, ii->inode, gfs2_block_free);
+				gfs2_block_set(sbp, bl, ii->inode,
+					       gfs2_block_free);
 				log_err("Cleared\n");
 				continue;
 			}
@@ -93,7 +95,8 @@ int scan_inode_list(struct gfs2_sbd *sbp, osi_list_t *list) {
 			if(!ip->i_di.di_size && !ip->i_di.di_eattr){
 				log_err("Unlinked inode has zero size\n");
 				if(query(&opts, "Clear zero-size unlinked inode? (y/n) ")) {
-					gfs2_block_set(bl, ii->inode, gfs2_block_free);
+					gfs2_block_set(sbp, bl, ii->inode,
+						       gfs2_block_free);
 					fsck_inode_put(ip, not_updated);
 					continue;
 				}
gfs2/fsck/pass5.c +1 -1
index 8db2ca7..bc4b859 100644
@@ -84,7 +84,7 @@ int check_block_status(struct gfs2_sbd *sbp, char *buffer, unsigned int buflen,
 		warm_fuzzy_stuff(block);
 		if (skip_this_pass || fsck_abort) /* if asked to skip the rest */
 			return 0;
-		gfs2_block_check(bl, block, &q);
+		gfs2_block_check(sbp, bl, block, &q);
 
 		block_status = convert_mark(&q, count);
 
gfs2/fsck/rgrepair.c +56 -2

88 lines not on this page · raw message

gfs2/libgfs2/bitmap.c +61 -18

114 lines not on this page · raw message

gfs2/libgfs2/block_list.c +103 -129

291 lines not on this page · raw message

gfs2/libgfs2/buf.c +0 -1
index 562e965..7985945 100644
@@ -103,7 +103,6 @@ struct gfs2_buffer_head *bget_generic(struct gfs2_sbd *sdp, uint64_t num,
 	bh->b_count = 1;
 	bh->b_blocknr = num;
 	bh->b_data = (char *)bh + sizeof(struct gfs2_buffer_head);
-	bh->b_size = sdp->bsize;
 	if (read_disk) {
 		do_lseek(sdp->device_fd, num * sdp->bsize);
 		do_read(sdp->device_fd, bh->b_data, sdp->bsize);
gfs2/libgfs2/fs_bits.c +1 -1
index 6e74747..024426f 100644
@@ -51,7 +51,7 @@ uint32_t gfs2_bitfit_core(struct gfs2_sbd *sbp, uint64_t goal, uint64_t start,
 	struct gfs2_block_query q;
 
 	for(block = start+goal; block < start+len; block++) {
-		gfs2_block_check(bl, block, &q);
+		gfs2_block_check(sbp, bl, block, &q);
 		switch(old_state) {
 			/* FIXME Make sure these are handled correctly */
 		case GFS2_BLKST_FREE:
gfs2/libgfs2/fs_ops.c +20 -18
index a48d2ff..e5fc959 100644
@@ -148,20 +148,20 @@ uint64_t dinode_alloc(struct gfs2_sbd *sdp)
 	return blk_alloc_i(sdp, DINODE);
 }
 
-static __inline__ void buffer_clear_tail(struct gfs2_buffer_head *bh, int head)
+static __inline__ void buffer_clear_tail(struct gfs2_sbd *sdp,
+					 struct gfs2_buffer_head *bh, int head)
 {
-	memset(bh->b_data + head, 0, bh->b_size - head);
+	memset(bh->b_data + head, 0, sdp->bsize - head);
 }
 
 static __inline__ void
-buffer_copy_tail(struct gfs2_buffer_head *to_bh, int to_head,
-				 struct gfs2_buffer_head *from_bh, int from_head)
+buffer_copy_tail(struct gfs2_sbd *sdp,
+		 struct gfs2_buffer_head *to_bh, int to_head,
+		 struct gfs2_buffer_head *from_bh, int from_head)
 {
-	memcpy(to_bh->b_data + to_head,
-	       from_bh->b_data + from_head,
-	       from_bh->b_size - from_head);
-	memset(to_bh->b_data + to_bh->b_size + to_head - from_head,
-	       0,
+	memcpy(to_bh->b_data + to_head, from_bh->b_data + from_head,
+	       sdp->bsize - from_head);
+	memset(to_bh->b_data + sdp->bsize + to_head - from_head, 0,
 	       from_head - to_head);
 }
 
@@ -184,7 +184,8 @@ static void unstuff_dinode(struct gfs2_inode *ip)
 				gfs2_meta_header_out(&mh, bh->b_data);
 			}
 
-			buffer_copy_tail(bh, sizeof(struct gfs2_meta_header),
+			buffer_copy_tail(sdp, bh,
+					 sizeof(struct gfs2_meta_header),
 					 ip->i_bh, sizeof(struct gfs2_dinode));
 
 			brelse(bh, updated);
@@ -192,14 +193,14 @@ static void unstuff_dinode(struct gfs2_inode *ip)
 			block = data_alloc(ip);
 			bh = bget(sdp, block);
 
-			buffer_copy_tail(bh, 0,
+			buffer_copy_tail(sdp, bh, 0,
 					 ip->i_bh, sizeof(struct gfs2_dinode));
 
 			brelse(bh, updated);
 		}
 	}
 
-	buffer_clear_tail(ip->i_bh, sizeof(struct gfs2_dinode));
+	buffer_clear_tail(sdp, ip->i_bh, sizeof(struct gfs2_dinode));
 
 	if (ip->i_di.di_size) {
 		*(uint64_t *)(ip->i_bh->b_data + sizeof(struct gfs2_dinode)) = cpu_to_be64(block);
@@ -260,13 +261,14 @@ void build_height(struct gfs2_inode *ip, int height)
 				mh.mh_format = GFS2_FORMAT_IN;
 				gfs2_meta_header_out(&mh, bh->b_data);
 			}
-			buffer_copy_tail(bh, sizeof(struct gfs2_meta_header),
+			buffer_copy_tail(sdp, bh,
+					 sizeof(struct gfs2_meta_header),
 					 ip->i_bh, sizeof(struct gfs2_dinode));
 
 			brelse(bh, updated);
 		}
 
-		buffer_clear_tail(ip->i_bh, sizeof(struct gfs2_dinode));
+		buffer_clear_tail(sdp, ip->i_bh, sizeof(struct gfs2_dinode));
 
 		if (new_block) {
 			*(uint64_t *)(ip->i_bh->b_data + sizeof(struct gfs2_dinode)) = cpu_to_be64(block);
@@ -628,7 +630,7 @@ int gfs2_dirent_next(struct gfs2_inode *dip, struct gfs2_buffer_head *bh,
 	char *bh_end;
 	uint16_t cur_rec_len;
 
-	bh_end = bh->b_data + bh->b_size;
+	bh_end = bh->b_data + dip->i_sbd->bsize;
 	cur_rec_len = be16_to_cpu((*dent)->de_rec_len);
 
 	if ((char *)(*dent) + cur_rec_len >= bh_end)
@@ -661,7 +663,7 @@ dirent_alloc(struct gfs2_inode *dip, struct gfs2_buffer_head *bh, int name_len,
 	}
 
 	if (!entries) {
-		dent->de_rec_len = cpu_to_be16(bh->b_size - offset);
+		dent->de_rec_len = cpu_to_be16(dip->i_sbd->bsize - offset);
 		dent->de_name_len = cpu_to_be16(name_len);
 
 		*dent_out = dent;
@@ -1060,7 +1062,7 @@ dir_make_exhash(struct gfs2_inode *dip)
 	leaf->lf_dirent_format = cpu_to_be32(GFS2_FORMAT_DE);
 	leaf->lf_entries = cpu_to_be16(dip->i_di.di_entries);
 
-	buffer_copy_tail(bh, sizeof(struct gfs2_leaf),
+	buffer_copy_tail(sdp, bh, sizeof(struct gfs2_leaf),
 			 dip->i_bh, sizeof(struct gfs2_dinode));
 
 	x = 0;
@@ -1078,7 +1080,7 @@ dir_make_exhash(struct gfs2_inode *dip)
 
 	brelse(bh, updated);
 
-	buffer_clear_tail(dip->i_bh, sizeof(struct gfs2_dinode));
+	buffer_clear_tail(sdp, dip->i_bh, sizeof(struct gfs2_dinode));
 
 	lp = (uint64_t *)(dip->i_bh->b_data + sizeof(struct gfs2_dinode));
 
gfs2/libgfs2/libgfs2.h +60 -33

124 lines not on this page · raw message

gfs2/libgfs2/recovery.c +1 -1
index 387d4fa..c789078 100644
@@ -233,7 +233,7 @@ int clean_journal(struct gfs2_inode *ip, struct gfs2_log_header *head)
 		return -EIO;
 
 	bh = bread(ip->i_sbd, dblock);
-	memset(bh->b_data, 0, bh->b_size);
+	memset(bh->b_data, 0, ip->i_sbd->bsize);
 
 	lh = (struct gfs2_log_header *)bh->b_data;
 	memset(lh, 0, sizeof(struct gfs2_log_header));
gfs2/libgfs2/rgrp.c +8 -0
index 5728144..461c80e 100644
@@ -31,6 +31,14 @@ int gfs2_compute_bitstructs(struct gfs2_sbd *sdp, struct rgrp_list *rgd)
 	uint32_t bytes_left, bytes;
 	int x;
 
+	/* Max size of an rg is 2GB.  A 2GB RG with (minimum) 512-byte blocks
+	   has 4194304 blocks.  We can represent 4 blocks in one bitmap byte.
+	   Therefore, all 4194304 blocks can be represented in 1048576 bytes.
+	   Subtract a metadata header for each 512-byte block and we get
+	   488 bytes of bitmap per block.  Divide 1048576 by 488 and we can
+	   be assured we should never have more than 2149 of them. */
+	if (length > 2149 || length == 0)
+		return -1;
 	if(!(rgd->bits = (struct gfs2_bitmap *)
 		 malloc(length * sizeof(struct gfs2_bitmap))))
 		return -1;

hooks/post-receive
--
Cluster Project