From b7a56cfa1221a97659f1b03ad1ba039a90599b54 Mon Sep 17 00:00:00 2001 From: Bart Van Assche Date: Thu, 1 Nov 2018 04:39:36 +0000 Subject: [PATCH] scst_vdisk: lower severity of message about not supported fallocate(FALLOC_FL_PUNCH_HOLE|FALLOC_FL_KEEP_SIZE) and print it only once git-svn-id: http://svn.code.sf.net/p/scst/svn/branches/3.3.x@7582 d57e44dd-8a1f-0410-8b47-8ef2f437770f --- scst/include/scst_debug.h | 9 +++++++++ scst/src/dev_handlers/scst_vdisk.c | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/scst/include/scst_debug.h b/scst/include/scst_debug.h index de8f50d7e..9c075c3f0 100644 --- a/scst/include/scst_debug.h +++ b/scst/include/scst_debug.h @@ -399,4 +399,13 @@ do { \ #define SCST_SLAB_FLAGS 0L #endif +#define PRINT_WARNING_ONCE(format, args...) \ +do { \ + static bool __warned; \ + if (!__warned) { \ + __warned = true; \ + PRINT_WARNING(format, ## args); \ + } \ +} while(0) + #endif /* __SCST_DEBUG_H */ diff --git a/scst/src/dev_handlers/scst_vdisk.c b/scst/src/dev_handlers/scst_vdisk.c index 8d3379424..bd7fae752 100644 --- a/scst/src/dev_handlers/scst_vdisk.c +++ b/scst/src/dev_handlers/scst_vdisk.c @@ -3847,7 +3847,7 @@ static int vdisk_unmap_file_range(struct scst_cmd *cmd, res = fd->f_op->fallocate(fd, FALLOC_FL_PUNCH_HOLE | FALLOC_FL_KEEP_SIZE, off, len); if (unlikely(res != 0)) { - PRINT_ERROR("fallocate() for %lld, len %lld " + PRINT_WARNING_ONCE("fallocate() for %lld, len %lld " "failed: %d", (unsigned long long)off, (unsigned long long)len, res); scst_set_cmd_error(cmd,