From cbc53b12c8ace08a407809e6502b7faf441c438b Mon Sep 17 00:00:00 2001 From: Vladislav Bolkhovitin Date: Fri, 5 Jan 2018 05:14:03 +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/trunk@7328 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 3b3047d7c..031c0b972 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,