Skip to contentSkip to conversation

Cluster Project branch, master, updated. cluster-2.99.06-59-gc9dfb0f

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=c9dfb0f22b3bc20517e008438b1f3cee1d0e2e5e

The branch, master has been updated

       via  c9dfb0f22b3bc20517e008438b1f3cee1d0e2e5e (commit)
       via  768d7f6eb28b73dc207373f2001aeb6f11f28795 (commit)
       via  71a2451d30b83bd87dee51bd08698d86ead3aa37 (commit)
       via  eaed552e911ddc1fbe49b578e8948425e978eca5 (commit)
       via  5008483e04628f9f8f38270e52654e7bad0409d4 (commit)
       via  ce8675dadf002e111c22d0cd36b2dccd9baba6d1 (commit)
       via  4e0d46c5f65f6a6e3f2bf8887ee437b4afa2b48c (commit)
       via  5d4f09c3e08a621b1075092a3eeecbc7ad67a7dd (commit)
       via  5f36f4b437f367faed6ee5c004324754e1fd9b5e (commit)
       via  80cf7851e75c8e0eb535c781cd0ccb98b7c513ef (commit)
      from  cdfef21c7ea49a9ad2af834f92869215b2149338 (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 c9dfb0f22b3bc20517e008438b1f3cee1d0e2e5e

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

gfs2_fsck dupl. blocks between EA and data

commit 768d7f6eb28b73dc207373f2001aeb6f11f28795

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

RGRepair: Account for RG blocks inside journals

commit 71a2451d30b83bd87dee51bd08698d86ead3aa37

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

Better error reporting in gfs2_fsck

commit eaed552e911ddc1fbe49b578e8948425e978eca5

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

Shrink memory 3: smaller link counts in inode_info

commit 5008483e04628f9f8f38270e52654e7bad0409d4

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 ce8675dadf002e111c22d0cd36b2dccd9baba6d1

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 4e0d46c5f65f6a6e3f2bf8887ee437b4afa2b48c

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

Deleted unused function print_map

commit 5d4f09c3e08a621b1075092a3eeecbc7ad67a7dd

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 5f36f4b437f367faed6ee5c004324754e1fd9b5e

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

gfs_fsck crosswrite for block number sanity checking

commit 80cf7851e75c8e0eb535c781cd0ccb98b7c513ef

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  |    7 +-
 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, 894 insertions(+), 586 deletions(-)
gfs2/edit/savemeta.c +5 -4
index 668501f..693ac0f 100644
@@ -542,7 +542,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);
@@ -793,7 +793,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;
 	}
@@ -832,7 +833,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;
@@ -867,7 +868,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 a1d8521..e32a366 100644
@@ -9,7 +9,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;
 	}
@@ -19,7 +19,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;
 
@@ -27,22 +27,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,
@@ -89,11 +87,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 750ec30..b93b50b 100644
@@ -1,21 +1,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 964b51e..ab5e7f1 100644
@@ -122,7 +122,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;
@@ -221,7 +221,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 e17d3c9..3bf618c 100644
@@ -13,9 +13,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
@@ -77,6 +77,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 ac14120..1d2df6a 100644
@@ -109,7 +109,7 @@ static void empty_super_block(struct gfs2_sbd *sdp)
 		}
 	}
 
-	gfs2_block_list_destroy(bl);
+	gfs2_block_list_destroy(sdp, bl);
 }
 
 
@@ -264,11 +264,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;
@@ -372,8 +372,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 +4 -3
index 5b21aae..72c5bbe 100644
@@ -32,7 +32,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;
 		}
@@ -45,7 +45,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);
@@ -140,6 +141,6 @@ int add_inode_to_lf(struct gfs2_inode *ip){
 
 	free(filename);
 	log_notice("Added inode #%"PRIu64" to lost+found dir\n",
-		   ip->i_di.di_num.no_addr);
+			   ip->i_di.di_num.no_addr);
 	return 0;
 }
gfs2/fsck/main.c +6 -29
index 7aeb13d..141fdf3 100644
@@ -23,7 +23,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.                                      */
@@ -37,29 +36,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));
@@ -137,7 +113,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') {
@@ -170,7 +146,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);
@@ -182,7 +158,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)
@@ -201,7 +178,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)
@@ -390,7 +368,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 cec8478..fd8f1b7 100644
@@ -6,7 +6,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);
@@ -41,15 +42,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,
@@ -60,7 +64,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 7b5cce6..aa8d007 100644
@@ -72,13 +72,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);
@@ -147,7 +148,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);
@@ -207,7 +208,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;
 				}
@@ -215,7 +216,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");
@@ -228,7 +231,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;
 				}
@@ -241,7 +245,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 0d895f3..3ec380d 100644
@@ -47,7 +47,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;
 			}
@@ -55,7 +55,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");
@@ -68,7 +69,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;
 			}
@@ -80,7 +82,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 832dd82..28d37e3 100644
@@ -71,7 +71,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 3e8ca1a..b706375 100644
@@ -90,7 +90,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 5d4ba83..0a31b0b 100644
@@ -38,7 +38,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 32e6a8e..4b45b06 100644
@@ -135,20 +135,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);
 }
 
@@ -171,7 +171,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);
@@ -179,14 +180,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);
@@ -247,13 +248,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);
@@ -615,7 +617,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)
@@ -648,7 +650,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;
@@ -1047,7 +1049,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;
@@ -1065,7 +1067,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 a4fcc8e..8e75d24 100644
@@ -224,7 +224,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 187a036..d3b702e 100644
@@ -18,6 +18,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