]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
loop-util: explain why we propagate discard_max_bytes from backing block device to...
authorLennart Poettering <lennart@poettering.net>
Mon, 20 Oct 2025 10:59:02 +0000 (12:59 +0200)
committerLuca Boccassi <luca.boccassi@gmail.com>
Mon, 20 Oct 2025 11:33:50 +0000 (12:33 +0100)
Follow-up for: 29ee9c6fb7c75c421f887c8579c65eb04d4f634d

src/shared/loop-util.c

index 690f6aeb2a710f9d66e5b9f4978574a057382c20..e9064c291053ea3d52beb2400a4995c3a691a204 100644 (file)
@@ -611,6 +611,10 @@ static int loop_device_make_internal(
         }
 
         if (S_ISBLK(st.st_mode)) {
+                /* Propagate backing device's discard byte limit to our loopback block device. We do this in
+                 * order to avoid that (supposedly quick) discard requests on the loopback device get turned
+                 * into (likely slow) zero-out requests on backing devices that do not support discarding
+                 * natively, but do support zero-out. */
                 uint64_t discard_max_bytes;
 
                 r = fd_get_max_discard(fd, &discard_max_bytes);