]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commitdiff
repair: fix prefetch queue limiting
authorDave Chinner <dchinner@redhat.com>
Mon, 3 Mar 2014 01:17:46 +0000 (12:17 +1100)
committerDave Chinner <david@fromorbit.com>
Mon, 3 Mar 2014 01:17:46 +0000 (12:17 +1100)
The length of the prefetch queue is limited by a semaphore. To avoid
a ABBA deadlock, we only trywait on the semaphore so if we fail to
get it we can kick the IO queues before sleeping. Unfortunately,
the "need to sleep" detection is just a little wrong - it needs to
lok at errno, not err for the EAGAIN value.

Hence this queue throttling has not been working for a long time.

Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Dave Chinner <david@fromorbit.com>
repair/phase6.c
repair/prefetch.c

index 7be68b3f5f4c4a8af48dba13c2547171c7c8bd32..63359d1c010ac0b8ac3fe71a5a36d2254913a16c 100644 (file)
@@ -2999,8 +2999,15 @@ traverse_function(
                if (irec->ino_isa_dir == 0)
                        continue;
 
-               if (pf_args)
+               if (pf_args) {
                        sem_post(&pf_args->ra_count);
+#ifdef XR_PF_TRACE
+                       sem_getvalue(&pf_args->ra_count, &i);
+                       pftrace(
+               "processing inode chunk %p in AG %d (sem count = %d)",
+                               irec, agno, i);
+#endif
+               }
 
                for (i = 0; i < XFS_INODES_PER_CHUNK; i++)  {
                        if (inode_isadir(irec, i))
index 984bedaaa589d36490ea630e6c86db948aa97f26..f4f3d71c28f869f7e8f7f3984df999ef3926f006 100644 (file)
@@ -723,7 +723,7 @@ pf_queuing_worker(
                        irec, args->agno, i);
 #endif
                err = sem_trywait(&args->ra_count);
-               if (err == EAGAIN) {
+               if (err < 0 && errno == EAGAIN) {
                        /*
                         * Kick the queue once we have reached the limit;
                         * without this the threads processing the inodes