This should be fixed in cvs now.  For convenience, the attached patch
brings jfsutils-1.1.14 up to the current state of the cvs tree.  I
haven't tested it too extensively, but it fixes this problem and a few
others I encountered.  Unless some other problems show up, I'll probably
create a version 1.1.15 soon.

Thanks,
Shaggy

On Tue, 2010-05-25 at 15:41 -0700, Tim Nufire wrote:
> Hello,
> 
> 
> I think I've found a bug in jfs_mkfs.. On a newly formated
> volume fsck.jfs reports "Incorrect number of free blocks in AG XXX
> detected in Block Map Control Page" and "Discrepancies detected in the
> Block Map Control Page AG free count list". Is this a know issue? Is
> the bug in jfs_mkfs or fsck.jfs?
> 
> 
> Here's an example:
> 
> 
> /sbin/jfs_mkfs -q -L id-0930461  /dev/md10
> /sbin/jfs_mkfs version 1.1.14, 06-Apr-2009
> 
> 
> Format completed successfully.
> 
> 
> 19027657792 kilobytes total disk space.
> 
> 
> fsck.jfs -n -v /dev/md10
> fsck.jfs version 1.1.14, 06-Apr-2009
> processing started: 5/25/2010 15.27.45
> The current device is:  /dev/md10
> Open(...READONLY...) returned rc = 0
> Primary superblock is valid.
> The type of file system for the device is JFS.
> Block size in bytes:  4096
> Filesystem size in blocks:  4756914448
> **Phase 1 - Check Blocks, Files/Directories, and  Directory Entries
> **Phase 2 - Count links
> **Phase 3 - Duplicate Block Rescan and Directory Connectedness
> **Phase 4 - Report Problems
> **Phase 5 - Check Connectivity
> **Phase 6 - Perform Approved Corrections
> **Phase 7 - Verify File/Directory Allocation Maps
> **Phase 8 - Verify Disk Allocation Maps
> Incorrect number of free blocks in AG 6 detected in Block Map Control
> Page.
> Incorrect number of free blocks in AG 7 detected in Block Map Control
> Page.
> Incorrect number of free blocks in AG 8 detected in Block Map Control
> Page.
> Incorrect number of free blocks in AG 9 detected in Block Map Control
> Page.
> Incorrect number of free blocks in AG 10 detected in Block Map Control
> Page.
> Incorrect number of free blocks in AG 11 detected in Block Map Control
> Page.
> Incorrect number of free blocks in AG 12 detected in Block Map Control
> Page.
> Incorrect number of free blocks in AG 13 detected in Block Map Control
> Page.
> Incorrect number of free blocks in AG 14 detected in Block Map Control
> Page.
> Incorrect number of free blocks in AG 15 detected in Block Map Control
> Page.
> Incorrect number of free blocks in AG 16 detected in Block Map Control
> Page.
> Incorrect number of free blocks in AG 17 detected in Block Map Control
> Page.
> Incorrect number of free blocks in AG 18 detected in Block Map Control
> Page.
> Incorrect number of free blocks in AG 19 detected in Block Map Control
> Page.
> Incorrect number of free blocks in AG 20 detected in Block Map Control
> Page.
> Incorrect number of free blocks in AG 21 detected in Block Map Control
> Page.
> Incorrect number of free blocks in AG 22 detected in Block Map Control
> Page.
> Incorrect number of free blocks in AG 23 detected in Block Map Control
> Page.
> Incorrect number of free blocks in AG 24 detected in Block Map Control
> Page.
> Incorrect number of free blocks in AG 25 detected in Block Map Control
> Page.
> Incorrect number of free blocks in AG 26 detected in Block Map Control
> Page.
> Incorrect number of free blocks in AG 27 detected in Block Map Control
> Page.
> Incorrect number of free blocks in AG 28 detected in Block Map Control
> Page.
> Incorrect number of free blocks in AG 29 detected in Block Map Control
> Page.
> Incorrect number of free blocks in AG 30 detected in Block Map Control
> Page.
> Incorrect number of free blocks in AG 31 detected in Block Map Control
> Page.
> Incorrect number of free blocks in AG 32 detected in Block Map Control
> Page.
> Incorrect number of free blocks in AG 33 detected in Block Map Control
> Page.
> Incorrect number of free blocks in AG 34 detected in Block Map Control
> Page.
> Incorrect number of free blocks in AG 35 detected in Block Map Control
> Page.
> Incorrect number of free blocks in AG 36 detected in Block Map Control
> Page.
> Incorrect number of free blocks in AG 37 detected in Block Map Control
> Page.
> Incorrect number of free blocks in AG 38 detected in Block Map Control
> Page.
> Discrepancies detected in the Block Map Control Page AG free count
> list.
> Incorrect data detected in disk allocation control structures.
> Filesystem Summary:
> Blocks in use for inodes:  8
> Inode count:  64
> File count:  0
> Directory count:  1
> Block count:  4756914448
> Free block count:  4756155203
> 19027657792 kilobytes total disk space.
>         0 kilobytes in 1 directories.
>         0 kilobytes in 0 user files.
>         0 kilobytes in extended attributes
>         0 kilobytes in access control lists
>   3036980 kilobytes reserved for system use.
> 19024620812 kilobytes are available for use.
> File system checked READ ONLY.
> Filesystem is dirty.
> Filesystem is dirty but is marked clean.  In its present state,
> the results of accessing /dev/md10 (except by this utility) are
> undefined.
> processing terminated:  5/25/2010 15:28:05  with return code: 0  exit
> code: 4.
> 
> 
> jfs_tune -l /dev/md10
> jfs_tune version 1.1.14, 06-Apr-2009
> 
> 
> JFS filesystem superblock:
> 
> 
> JFS magic number: 'JFS1'
> JFS version: 1
> JFS state: clean
> JFS flags: JFS_LINUX  JFS_COMMIT  JFS_GROUPCOMMIT  JFS_INLINELOG  
> Aggregate block size: 4096 bytes
> Aggregate size: 38053891680 blocks
> Physical block size: 512 bytes
> Allocation group size: 67108864 aggregate blocks
> Log device number: 0x0
> Filesystem creation: Tue May 25 15:27:31 2010
> Volume label: 'id-0930461'
> 
> 
> Running fsck.jfs in read-write mode fixes this problem so I have a
> work around...
> 
> 
> fsck.jfs -f -v /dev/md10
> fsck.jfs version 1.1.14, 06-Apr-2009
> processing started: 5/25/2010 15.28.28
> The current device is:  /dev/md10
> Open(...READ/WRITE EXCLUSIVE...) returned rc = 0
> Primary superblock is valid.
> The type of file system for the device is JFS.
> Block size in bytes:  4096
> Filesystem size in blocks:  4756914448
> **Phase 0 - Replay Journal Log
> LOGREDO:  Log already redone!
> logredo returned rc = 0
> **Phase 1 - Check Blocks, Files/Directories, and  Directory Entries
> **Phase 2 - Count links
> **Phase 3 - Duplicate Block Rescan and Directory Connectedness
> **Phase 4 - Report Problems
> **Phase 5 - Check Connectivity
> **Phase 6 - Perform Approved Corrections
> **Phase 7 - Rebuild File/Directory Allocation Maps
> **Phase 8 - Rebuild Disk Allocation Maps
> Filesystem Summary:
> Blocks in use for inodes:  8
> Inode count:  64
> File count:  0
> Directory count:  1
> Block count:  4756914448
> Free block count:  4756155203
> 19027657792 kilobytes total disk space.
>         0 kilobytes in 1 directories.
>         0 kilobytes in 0 user files.
>         0 kilobytes in extended attributes
>         0 kilobytes in access control lists
>   3036980 kilobytes reserved for system use.
> 19024620812 kilobytes are available for use.
> Filesystem is clean.
> All observed inconsistencies have been repaired.
> Filesystem has been marked clean.
> **** Filesystem was modified. ****
> processing terminated:  5/25/2010 15:28:58  with return code: 0  exit
> code: 0.
> 
> 
> fsck.jfs -n -v /dev/md10
> fsck.jfs version 1.1.14, 06-Apr-2009
> processing started: 5/25/2010 15.29.14
> The current device is:  /dev/md10
> Open(...READONLY...) returned rc = 0
> Primary superblock is valid.
> The type of file system for the device is JFS.
> Block size in bytes:  4096
> Filesystem size in blocks:  4756914448
> **Phase 1 - Check Blocks, Files/Directories, and  Directory Entries
> **Phase 2 - Count links
> **Phase 3 - Duplicate Block Rescan and Directory Connectedness
> **Phase 4 - Report Problems
> **Phase 5 - Check Connectivity
> **Phase 6 - Perform Approved Corrections
> **Phase 7 - Verify File/Directory Allocation Maps
> **Phase 8 - Verify Disk Allocation Maps
> Filesystem Summary:
> Blocks in use for inodes:  8
> Inode count:  64
> File count:  0
> Directory count:  1
> Block count:  4756914448
> Free block count:  4756155203
> 19027657792 kilobytes total disk space.
>         0 kilobytes in 1 directories.
>         0 kilobytes in 0 user files.
>         0 kilobytes in extended attributes
>         0 kilobytes in access control lists
>   3036980 kilobytes reserved for system use.
> 19024620812 kilobytes are available for use.
> File system checked READ ONLY.
> Filesystem is clean.
> processing terminated:  5/25/2010 15:29:33  with return code: 0  exit
> code: 0.
> 
> 
> Tim
> ------------------------------------------------------------------------------
> 
> _______________________________________________
> Jfs-discussion mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/jfs-discussion

-- 
Dave Kleikamp
IBM Linux Technology Center
Index: ChangeLog
===================================================================
RCS file: /cvsroot/jfs/jfsutils/ChangeLog,v
retrieving revision 1.226
retrieving revision 1.230
diff -u -p -r1.226 -r1.230
--- ChangeLog	6 Apr 2009 19:00:42 -0000	1.226
+++ ChangeLog	3 Jun 2010 22:42:12 -0000	1.230
@@ -1,3 +1,18 @@
+2010-06-03 Dave Kleikamp <[email protected]>
+	* fsck/fsckpfs.c: use 64-bit value to address extent length
+	* fsck/fsckwsp.c: use 64-bit values for block map size
+	* mkfs/mkfs.c: use 64-bit values for additional structures
+
+2010-01-07 Dave Kleikamp <[email protected]>
+	* libfs/log_dump.c: handle positive error value from find_log()
+
+2009-11-30 Dave Kleikamp <[email protected]>
+	* mkfs/initmap.c: use 64-bit integers to handle volumes over 32 TB
+	* mkfs/initmap.h: likewise
+
+2009-07-13 Dave Kleikamp <[email protected]>
+	* tune/jfs_tune.8: file systems CAN share an external journal
+
 2009-04-06 Dave Kleikamp <[email protected]>
 	* configure.in: Bumped version to 1.1.14
 	* NEWS: likewise
Index: fsck/fsckpfs.c
===================================================================
RCS file: /cvsroot/jfs/jfsutils/fsck/fsckpfs.c,v
retrieving revision 1.29
retrieving revision 1.30
diff -u -p -r1.29 -r1.30
--- fsck/fsckpfs.c	23 Aug 2007 04:01:40 -0000	1.29
+++ fsck/fsckpfs.c	3 Jun 2010 22:42:12 -0000	1.30
@@ -763,8 +763,8 @@ int blktbl_dmap_get(int64_t for_block, s
 	xad_t *xad_ptr;
 	int8_t offset_found;
 	int which_it;
-	uint32_t bytes_read, ext_bytes_left;
-	int64_t ext_bytes, offset_into_extent;
+	uint32_t bytes_read;
+	int64_t ext_bytes, ext_bytes_left, offset_into_extent;
 	struct dmap *dmap_t_ptr;
 
 	dmp_logical_fsblk_offset =
@@ -844,7 +844,7 @@ int blktbl_dmap_get(int64_t for_block, s
 		 * beyond the end of the extent, and if so, we need to
 		 * ignore the tag-along data.
 		 */
-		ext_bytes = lengthXAD(xad_ptr) * sb_ptr->s_bsize;
+		ext_bytes = (int64_t)lengthXAD(xad_ptr) * sb_ptr->s_bsize;
 		offset_into_extent = dmp_logical_byte_offset -
 		    ext_logical_byte_offset;
 		ext_bytes_left = ext_bytes - offset_into_extent;
Index: fsck/fsckwsp.c
===================================================================
RCS file: /cvsroot/jfs/jfsutils/fsck/fsckwsp.c,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -p -r1.23 -r1.24
--- fsck/fsckwsp.c	5 Jun 2006 19:31:40 -0000	1.23
+++ fsck/fsckwsp.c	3 Jun 2010 22:42:12 -0000	1.24
@@ -262,7 +262,7 @@ int alloc_wsp_extent(uint32_t minimum_le
 {
 	int awe_rc = FSCK_OK;
 	struct wsp_ext_rec *new_fer;
-	int32_t extent_length = MEMSEGSIZE;
+	size_t extent_length = MEMSEGSIZE;
 	char *extent_addr = NULL;
 	int8_t from_high_memory = 0;
 
@@ -1349,9 +1349,9 @@ int establish_io_buffers()
 int establish_wsp_block_map()
 {
 	int ewbm_rc = FSCK_OK;
-	int32_t blkmap_size_bytes;
-	int32_t blkmap_size_in_pages;
-	int32_t idx;
+	int64_t blkmap_size_bytes;
+	int64_t blkmap_size_in_pages;
+	int64_t idx;
 	int64_t this_device_offset;
 
 	int I_am_logredo = 0;
Index: libfs/log_dump.c
===================================================================
RCS file: /cvsroot/jfs/jfsutils/libfs/log_dump.c,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -p -r1.22 -r1.23
--- libfs/log_dump.c	5 Jun 2006 19:31:41 -0000	1.22
+++ libfs/log_dump.c	7 Jan 2010 13:30:31 -0000	1.23
@@ -220,7 +220,7 @@ int jfs_logdump(caddr_t pathname, FILE *
 		LogOpenMode = O_RDONLY;
 		rc = findLog(fp, &in_use);
 
-		if (rc < 0) {
+		if (rc != 0) {
 			printf("JFS_LOGDUMP:Error occurred when open/read device\n");
 			fprintf(outfp, "??????????????????????????????????????????????????????\n");
 			fprintf(outfp, "JFS_LOGDUMP:Error occurred when open/read device\n");
Index: mkfs/initmap.c
===================================================================
RCS file: /cvsroot/jfs/jfsutils/mkfs/initmap.c,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -p -r1.17 -r1.18
--- mkfs/initmap.c	24 May 2006 14:13:33 -0000	1.17
+++ mkfs/initmap.c	30 Nov 2009 13:31:02 -0000	1.18
@@ -48,7 +48,7 @@ static struct dmap **block_map_array;
 static unsigned sz_block_map_array;
 static unsigned cur_dmap_index;
 static struct dbmap *control_page;
-static unsigned last_allocated;
+static int64_t last_allocated;
 static struct dmap *empty_page;
 
 struct xtree_buf {
@@ -232,7 +232,7 @@ static int initctl(FILE *dev_ptr,
 	 * this dmapctl based upon the number of blocks covered by this dmapctl.
 	 */
 	l2cblks = L2BPERDMAP + level * L2LPERCTL;
-	cblks = (1 << l2cblks);
+	cblks = (1LL << l2cblks);
 	nchild = nblocks >> l2cblks;
 	nchild = (nblocks & (cblks - 1)) ? nchild + 1 : nchild;
 	next_page = *start + PSIZE;
@@ -398,7 +398,8 @@ static int alloc_map(int num_dmaps)
  */
 static void initmap(int64_t nblocks, int *ag_size, int aggr_block_size)
 {
-	int index, nb, l2nl, n;
+	int index, l2nl, n;
+	int64_t nb;
 
 	/*
 	 * Initialize base information
@@ -547,7 +548,7 @@ int calc_map_size(int64_t number_of_bloc
  *
  * RETURNS: NONE
  */
-int markit(int block, unsigned flag)
+int markit(int64_t block, unsigned flag)
 {
 	int page, rem, word, bit;
 	struct dmap *p1;
Index: mkfs/initmap.h
===================================================================
RCS file: /cvsroot/jfs/jfsutils/mkfs/initmap.h,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -p -r1.6 -r1.7
--- mkfs/initmap.h	22 Nov 2005 20:43:55 -0000	1.6
+++ mkfs/initmap.h	30 Nov 2009 13:31:02 -0000	1.7
@@ -23,7 +23,7 @@
 #define BADBLOCK	0x4
 
 int calc_map_size(int64_t, struct dinode *, int, int *, unsigned);
-int markit(int, unsigned);
+int markit(int64_t, unsigned);
 int record_LVM_BadBlks( int, int, int, struct dinode *, int64_t );
 int verify_last_blocks( FILE *, int, struct dinode * );
 int write_block_map(FILE *, int64_t, int);
Index: mkfs/mkfs.c
===================================================================
RCS file: /cvsroot/jfs/jfsutils/mkfs/mkfs.c,v
retrieving revision 1.48
retrieving revision 1.49
diff -u -p -r1.48 -r1.49
--- mkfs/mkfs.c	9 Jan 2009 16:00:22 -0000	1.48
+++ mkfs/mkfs.c	3 Jun 2010 22:42:12 -0000	1.49
@@ -216,7 +216,7 @@ static int create_aggregate(FILE *dev_pt
 	int64_t secondary_ait_address, secondary_aimap_address;
 	int64_t secondary_ait_end;
 	int64_t fsck_wspace_address, num_bits;
-	int fsck_wspace_length, fsck_svclog_length, npages;
+	int64_t fsck_wspace_length, fsck_svclog_length, npages;
 	unsigned inostamp;
 	struct dinode fileset_inode;
 
Index: tune/jfs_tune.8
===================================================================
RCS file: /cvsroot/jfs/jfsutils/tune/jfs_tune.8,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -p -r1.6 -r1.7
--- tune/jfs_tune.8	22 Nov 2005 20:43:55 -0000	1.6
+++ tune/jfs_tune.8	13 Jul 2009 20:18:36 -0000	1.7
@@ -26,17 +26,13 @@ on which a JFS file system or JFS extern
 
 .TP
 .BI "\-J device="external-journal
-.B Only supported on JFS versions (1.0.18 or later) that support external journal.
 Attach the JFS external journal located on
 .I external-journal
 to the JFS file system on
 .IR device .
 .IP
-Currently, you may only attach a single JFS file system device to a single
-JFS external journal (i.e. each JFS file system using an external journal
-must have a unique external journal).
-.IP
-The external journal must already have been created using the command
+The external journal must already have been created using the command.
+More than one file system may share the same external journal.
 .IP
 .B mkfs.jfs -J journal_dev
 .I external-journal
------------------------------------------------------------------------------
ThinkGeek and WIRED's GeekDad team up for the Ultimate 
GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the 
lucky parental unit.  See the prize list and enter to win: 
http://p.sf.net/sfu/thinkgeek-promo
_______________________________________________
Jfs-discussion mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jfs-discussion

Reply via email to