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>
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))
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