public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
* REVIEW: fix up xfs_repair I/O size for filesystems with >= 16KB filesystem blocksize
@ 2008-05-29  6:09 Barry Naujok
  2008-05-31  8:04 ` Christoph Hellwig
  0 siblings, 1 reply; 2+ messages in thread
From: Barry Naujok @ 2008-05-29  6:09 UTC (permalink / raw)
  To: xfs@oss.sgi.com

[-- Attachment #1: Type: text/plain, Size: 3108 bytes --]

For 4KB block size filesystems (the default), inode chunks are read and  
written
in 8KB "clusters". With a 16KB block size (possible on ia64 boxes), the  
inode
chunks are read/written in 16KB I/Os (matches the filesystem block size).

This patch fixes up the I/Os for filesystems with a blocksize greater than  
8KB.

Barry.



===========================================================================
xfsprogs/repair/prefetch.c
===========================================================================

--- a/xfsprogs/repair/prefetch.c	2008-05-29 16:00:34.000000000 +1000
+++ b/xfsprogs/repair/prefetch.c	2008-05-29 15:52:00.405480826 +1000
@@ -600,7 +600,6 @@ pf_queuing_worker(
  	ino_tree_node_t		*irec;
  	ino_tree_node_t		*cur_irec;
  	int			blks_per_cluster;
-	int			inos_per_cluster;
  	xfs_agblock_t		bno;
  	int			i;
  	int			err;
@@ -608,7 +607,6 @@ pf_queuing_worker(
  	blks_per_cluster =  XFS_INODE_CLUSTER_SIZE(mp) >> mp->m_sb.sb_blocklog;
  	if (blks_per_cluster == 0)
  		blks_per_cluster = 1;
-	inos_per_cluster = blks_per_cluster * mp->m_sb.sb_inopblock;

  	for (i = 0; i < PF_THREAD_COUNT; i++) {
  		err = pthread_create(&args->io_threads[i], NULL,
@@ -661,7 +659,7 @@ pf_queuing_worker(
  					(cur_irec->ino_isa_dir != 0) ?
  						B_DIR_INODE : B_INODE);
  			bno += blks_per_cluster;
-			num_inos += inos_per_cluster;
+			num_inos += inodes_per_cluster;
  		} while (num_inos < XFS_IALLOC_INODES(mp));
  	}

@@ -738,6 +736,7 @@ start_inode_prefetch(
  	prefetch_args_t		*prev_args)
  {
  	prefetch_args_t		*args;
+	long			max_queue;

  	if (!do_prefetch || agno >= mp->m_sb.sb_agcount)
  		return NULL;
@@ -757,8 +756,12 @@ start_inode_prefetch(
  	 * and not any other associated metadata like directories
  	 */

-	sem_init(&args->ra_count, 0, libxfs_bcache->c_maxcount / thread_count /
-		(XFS_IALLOC_BLOCKS(mp) / (XFS_INODE_CLUSTER_SIZE(mp) >>  
mp->m_sb.sb_blocklog)) / 8);
+	max_queue = libxfs_bcache->c_maxcount / thread_count / 8;
+	if (XFS_INODE_CLUSTER_SIZE(mp) > mp->m_sb.sb_blocksize)
+		max_queue = max_queue * (XFS_INODE_CLUSTER_SIZE(mp) >>
+				mp->m_sb.sb_blocklog) / XFS_IALLOC_BLOCKS(mp);
+
+	sem_init(&args->ra_count, 0, max_queue);

  	if (!prev_args) {
  		if (!pf_create_prefetch_thread(args))

===========================================================================
xfsprogs/repair/xfs_repair.c
===========================================================================

--- a/xfsprogs/repair/xfs_repair.c	2008-05-29 16:00:34.000000000 +1000
+++ b/xfsprogs/repair/xfs_repair.c	2008-05-29 15:49:06.100019069 +1000
@@ -572,7 +572,8 @@ main(int argc, char **argv)

  	chunks_pblock = mp->m_sb.sb_inopblock / XFS_INODES_PER_CHUNK;
  	max_symlink_blocks = howmany(MAXPATHLEN - 1, mp->m_sb.sb_blocksize);
-	inodes_per_cluster = XFS_INODE_CLUSTER_SIZE(mp) >> mp->m_sb.sb_inodelog;
+	inodes_per_cluster = MAX(mp->m_sb.sb_inopblock,
+			XFS_INODE_CLUSTER_SIZE(mp) >> mp->m_sb.sb_inodelog);

  	if (ag_stride) {
  		thread_count = (glob_agcount + ag_stride - 1) / ag_stride;

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: fix_16k_fsb_repair.patch --]
[-- Type: text/x-patch; name=fix_16k_fsb_repair.patch, Size: 2744 bytes --]


===========================================================================
xfsprogs/repair/prefetch.c
===========================================================================

--- a/xfsprogs/repair/prefetch.c	2008-05-29 16:00:34.000000000 +1000
+++ b/xfsprogs/repair/prefetch.c	2008-05-29 15:52:00.405480826 +1000
@@ -600,7 +600,6 @@ pf_queuing_worker(
 	ino_tree_node_t		*irec;
 	ino_tree_node_t		*cur_irec;
 	int			blks_per_cluster;
-	int			inos_per_cluster;
 	xfs_agblock_t		bno;
 	int			i;
 	int			err;
@@ -608,7 +607,6 @@ pf_queuing_worker(
 	blks_per_cluster =  XFS_INODE_CLUSTER_SIZE(mp) >> mp->m_sb.sb_blocklog;
 	if (blks_per_cluster == 0)
 		blks_per_cluster = 1;
-	inos_per_cluster = blks_per_cluster * mp->m_sb.sb_inopblock;
 
 	for (i = 0; i < PF_THREAD_COUNT; i++) {
 		err = pthread_create(&args->io_threads[i], NULL,
@@ -661,7 +659,7 @@ pf_queuing_worker(
 					(cur_irec->ino_isa_dir != 0) ?
 						B_DIR_INODE : B_INODE);
 			bno += blks_per_cluster;
-			num_inos += inos_per_cluster;
+			num_inos += inodes_per_cluster;
 		} while (num_inos < XFS_IALLOC_INODES(mp));
 	}
 
@@ -738,6 +736,7 @@ start_inode_prefetch(
 	prefetch_args_t		*prev_args)
 {
 	prefetch_args_t		*args;
+	long			max_queue;
 
 	if (!do_prefetch || agno >= mp->m_sb.sb_agcount)
 		return NULL;
@@ -757,8 +756,12 @@ start_inode_prefetch(
 	 * and not any other associated metadata like directories
 	 */
 
-	sem_init(&args->ra_count, 0, libxfs_bcache->c_maxcount / thread_count /
-		(XFS_IALLOC_BLOCKS(mp) / (XFS_INODE_CLUSTER_SIZE(mp) >> mp->m_sb.sb_blocklog)) / 8);
+	max_queue = libxfs_bcache->c_maxcount / thread_count / 8;
+	if (XFS_INODE_CLUSTER_SIZE(mp) > mp->m_sb.sb_blocksize)
+		max_queue = max_queue * (XFS_INODE_CLUSTER_SIZE(mp) >>
+				mp->m_sb.sb_blocklog) / XFS_IALLOC_BLOCKS(mp);
+
+	sem_init(&args->ra_count, 0, max_queue);
 
 	if (!prev_args) {
 		if (!pf_create_prefetch_thread(args))

===========================================================================
xfsprogs/repair/xfs_repair.c
===========================================================================

--- a/xfsprogs/repair/xfs_repair.c	2008-05-29 16:00:34.000000000 +1000
+++ b/xfsprogs/repair/xfs_repair.c	2008-05-29 15:49:06.100019069 +1000
@@ -572,7 +572,8 @@ main(int argc, char **argv)
 
 	chunks_pblock = mp->m_sb.sb_inopblock / XFS_INODES_PER_CHUNK;
 	max_symlink_blocks = howmany(MAXPATHLEN - 1, mp->m_sb.sb_blocksize);
-	inodes_per_cluster = XFS_INODE_CLUSTER_SIZE(mp) >> mp->m_sb.sb_inodelog;
+	inodes_per_cluster = MAX(mp->m_sb.sb_inopblock,
+			XFS_INODE_CLUSTER_SIZE(mp) >> mp->m_sb.sb_inodelog);
 
 	if (ag_stride) {
 		thread_count = (glob_agcount + ag_stride - 1) / ag_stride;

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: REVIEW: fix up xfs_repair I/O size for filesystems with >= 16KB filesystem blocksize
  2008-05-29  6:09 REVIEW: fix up xfs_repair I/O size for filesystems with >= 16KB filesystem blocksize Barry Naujok
@ 2008-05-31  8:04 ` Christoph Hellwig
  0 siblings, 0 replies; 2+ messages in thread
From: Christoph Hellwig @ 2008-05-31  8:04 UTC (permalink / raw)
  To: Barry Naujok; +Cc: xfs@oss.sgi.com

On Thu, May 29, 2008 at 04:09:41PM +1000, Barry Naujok wrote:
> For 4KB block size filesystems (the default), inode chunks are read and 
> written
> in 8KB "clusters". With a 16KB block size (possible on ia64 boxes), the 
> inode
> chunks are read/written in 16KB I/Os (matches the filesystem block size).
>
> This patch fixes up the I/Os for filesystems with a blocksize greater than 
> 8KB.

Looks good.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2008-05-31  8:04 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-05-29  6:09 REVIEW: fix up xfs_repair I/O size for filesystems with >= 16KB filesystem blocksize Barry Naujok
2008-05-31  8:04 ` Christoph Hellwig

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox