diff mbox series

[2/3] aio-dio-write-verify: print more info on the error case

Message ID e4d570e6f5c0e5da4824d196810fd7d56e0cc393.1692688971.git.naohiro.aota@wdc.com (mailing list archive)
State New, archived
Headers show
Series generic/551: improve error reporting and handling | expand

Commit Message

Naohiro Aota Aug. 22, 2023, 7:28 a.m. UTC
When short read or corruption happened, it is difficult to locate which IO
event failed. Print the address to make it identifiable.

Signed-off-by: Naohiro Aota <naohiro.aota@wdc.com>
---
 src/aio-dio-regress/aio-dio-write-verify.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

Comments

Zorro Lang Aug. 29, 2023, 3:48 a.m. UTC | #1
On Tue, Aug 22, 2023 at 04:28:51PM +0900, Naohiro Aota wrote:
> When short read or corruption happened, it is difficult to locate which IO
> event failed. Print the address to make it identifiable.
> 
> Signed-off-by: Naohiro Aota <naohiro.aota@wdc.com>
> ---

Good to me,
Reviewed-by: Zorro Lang <zlang@redhat.com>

>  src/aio-dio-regress/aio-dio-write-verify.c | 7 ++++---
>  1 file changed, 4 insertions(+), 3 deletions(-)
> 
> diff --git a/src/aio-dio-regress/aio-dio-write-verify.c b/src/aio-dio-regress/aio-dio-write-verify.c
> index 90e41b391289..dabbfacde3f8 100644
> --- a/src/aio-dio-regress/aio-dio-write-verify.c
> +++ b/src/aio-dio-regress/aio-dio-write-verify.c
> @@ -267,13 +267,14 @@ static int io_verify(int fd)
>  			perror("pread");
>  			return 1;
>  		} else if (sret != p->param->buf_size) {
> -			fprintf(stderr, "short read %zd was less than %zu\n",
> -			        sret, p->param->buf_size);
> +			fprintf(stderr, "short read %zd was less than %zu at %zu\n",
> +			        sret, p->param->buf_size, p->param->offset);
>  			return 1;
>  		}
>  		if (memcmp(p->param->buf,
>  		           p->param->cmp_buf, p->param->buf_size)) {
> -			printf("Find corruption\n");
> +			printf("Find corruption at %zu length %zu\n", p->param->offset,
> +			       p->param->buf_size);
>  			dump_buffer(p->param->buf, p->param->offset,
>  			            p->param->buf_size);
>  			corrupted++;
> -- 
> 2.41.0
>
diff mbox series

Patch

diff --git a/src/aio-dio-regress/aio-dio-write-verify.c b/src/aio-dio-regress/aio-dio-write-verify.c
index 90e41b391289..dabbfacde3f8 100644
--- a/src/aio-dio-regress/aio-dio-write-verify.c
+++ b/src/aio-dio-regress/aio-dio-write-verify.c
@@ -267,13 +267,14 @@  static int io_verify(int fd)
 			perror("pread");
 			return 1;
 		} else if (sret != p->param->buf_size) {
-			fprintf(stderr, "short read %zd was less than %zu\n",
-			        sret, p->param->buf_size);
+			fprintf(stderr, "short read %zd was less than %zu at %zu\n",
+			        sret, p->param->buf_size, p->param->offset);
 			return 1;
 		}
 		if (memcmp(p->param->buf,
 		           p->param->cmp_buf, p->param->buf_size)) {
-			printf("Find corruption\n");
+			printf("Find corruption at %zu length %zu\n", p->param->offset,
+			       p->param->buf_size);
 			dump_buffer(p->param->buf, p->param->offset,
 			            p->param->buf_size);
 			corrupted++;