xfs
[Top] [All Lists]

REVIEW: fix up xfs_repair I/O size for filesystems with >= 16KB filesyst

To: "xfs@xxxxxxxxxxx" <xfs@xxxxxxxxxxx>
Subject: REVIEW: fix up xfs_repair I/O size for filesystems with >= 16KB filesystem blocksize
From: "Barry Naujok" <bnaujok@xxxxxxx>
Date: Thu, 29 May 2008 16:09:41 +1000
Organization: SGI
Sender: xfs-bounce@xxxxxxxxxxx
User-agent: Opera Mail/9.24 (Win32)
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;

Attachment: fix_16k_fsb_repair.patch
Description: Text Data

<Prev in Thread] Current Thread [Next in Thread>