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,