diff mbox

[2/3] xfs_repair: add prefetch trace calls to debug thread creation failures

Message ID 1484627973-11535-3-git-send-email-jeffm@suse.com (mailing list archive)
State Accepted
Headers show

Commit Message

Jeff Mahoney Jan. 17, 2017, 4:39 a.m. UTC
From: Jeff Mahoney <jeffm@suse.com>

When debugging prefetch failures, it's useful to have thread creation
failure messages that are output as warnings on stderr in the trace
log as well.  It's also helpful to see when an AG gets queued behind
another one rather than having the thread started directly, which
has a separate trace line.

Signed-off-by: Jeff Mahoney <jeffm@suse.com>
---
 repair/prefetch.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

Comments

Eric Sandeen June 15, 2017, 7:11 p.m. UTC | #1
On 1/16/17 10:39 PM, jeffm@suse.com wrote:
> From: Jeff Mahoney <jeffm@suse.com>
> 
> When debugging prefetch failures, it's useful to have thread creation
> failure messages that are output as warnings on stderr in the trace
> log as well.  It's also helpful to see when an AG gets queued behind
> another one rather than having the thread started directly, which
> has a separate trace line.
> 
> Signed-off-by: Jeff Mahoney <jeffm@suse.com>

Reviewed-by: Eric Sandeen <sandeen@redhat.com>

> ---
>  repair/prefetch.c | 9 ++++++++-
>  1 file changed, 8 insertions(+), 1 deletion(-)
> 
> diff --git a/repair/prefetch.c b/repair/prefetch.c
> index 044fab2..37d60d6 100644
> --- a/repair/prefetch.c
> +++ b/repair/prefetch.c
> @@ -703,6 +703,8 @@ pf_queuing_worker(
>  		if (err != 0) {
>  			do_warn(_("failed to create prefetch thread: %s\n"),
>  				strerror(err));
> +			pftrace("failed to create prefetch thread for AG %d: %s",
> +				args->agno, strerror(err));
>  			args->io_threads[i] = 0;
>  			if (i == 0) {
>  				pf_start_processing(args);
> @@ -817,6 +819,8 @@ pf_create_prefetch_thread(
>  	if (err != 0) {
>  		do_warn(_("failed to create prefetch thread: %s\n"),
>  			strerror(err));
> +		pftrace("failed to create prefetch thread for AG %d: %s",
> +			args->agno, strerror(err));
>  		args->queuing_thread = 0;
>  		cleanup_inode_prefetch(args);
>  	}
> @@ -882,8 +886,11 @@ start_inode_prefetch(
>  		if (prev_args->prefetch_done) {
>  			if (!pf_create_prefetch_thread(args))
>  				args = NULL;
> -		} else
> +		} else {
>  			prev_args->next_args = args;
> +			pftrace("queued AG %d after AG %d",
> +				args->agno, prev_args->agno);
> +		}
>  		pthread_mutex_unlock(&prev_args->lock);
>  	}
>  
> 
--
To unsubscribe from this list: send the line "unsubscribe linux-xfs" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/repair/prefetch.c b/repair/prefetch.c
index 044fab2..37d60d6 100644
--- a/repair/prefetch.c
+++ b/repair/prefetch.c
@@ -703,6 +703,8 @@  pf_queuing_worker(
 		if (err != 0) {
 			do_warn(_("failed to create prefetch thread: %s\n"),
 				strerror(err));
+			pftrace("failed to create prefetch thread for AG %d: %s",
+				args->agno, strerror(err));
 			args->io_threads[i] = 0;
 			if (i == 0) {
 				pf_start_processing(args);
@@ -817,6 +819,8 @@  pf_create_prefetch_thread(
 	if (err != 0) {
 		do_warn(_("failed to create prefetch thread: %s\n"),
 			strerror(err));
+		pftrace("failed to create prefetch thread for AG %d: %s",
+			args->agno, strerror(err));
 		args->queuing_thread = 0;
 		cleanup_inode_prefetch(args);
 	}
@@ -882,8 +886,11 @@  start_inode_prefetch(
 		if (prev_args->prefetch_done) {
 			if (!pf_create_prefetch_thread(args))
 				args = NULL;
-		} else
+		} else {
 			prev_args->next_args = args;
+			pftrace("queued AG %d after AG %d",
+				args->agno, prev_args->agno);
+		}
 		pthread_mutex_unlock(&prev_args->lock);
 	}