From: Maxim Storchak <[email protected]>

It's safe to enable discard on the devices that don't support it.
In such case kernel ignores the discard flags.

Signed-off-by: Maxim Storchak <[email protected]>
---
 block.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/block.c b/block.c
index 0d9129b..37ff809 100644
--- a/block.c
+++ b/block.c
@@ -1883,7 +1883,7 @@ static int main_swapon(int argc, char **argv)
                        list_for_each_entry(pr, &devices, list) {
                                if (strcmp(pr->type, "swap"))
                                        continue;
-                               if (swapon(pr->dev, 0))
+                               if (swapon(pr->dev, SWAP_FLAG_DISCARD))
                                        ULOG_ERR("failed to swapon %s\n", 
pr->dev);
                        }
                        return 0;
-- 
2.50.0


_______________________________________________
openwrt-devel mailing list
[email protected]
https://lists.openwrt.org/mailman/listinfo/openwrt-devel

Reply via email to