This series introduces a new ioctl that makes it possible to atomically configure a loop device. Previously, if you wanted to set parameters such as the offset on a loop device, this required calling LOOP_SET_FD to set the backing file, and then LOOP_SET_STATUS to set the offset. However, in between these two calls, the loop device is available and would accept requests, which is generally not desirable. There are also performance benefits with combining these two ioctls into one, which is described in more detail in the last change in the series. Note that this series depends on "loop: Call loop_config_discard() only after new config is applied." [0], which I sent as a separate patch as it fixes an unrelated bug. [0]: https://lkml.org/lkml/2020/3/31/755 Martijn Coenen (4): loop: Refactor size calculation. loop: Factor out configuring loop from status. loop: Move loop_set_from_status() and friends up. loop: Add LOOP_SET_FD_AND_STATUS ioctl. drivers/block/loop.c | 309 ++++++++++++++++++++++---------------- include/uapi/linux/loop.h | 6 + 2 files changed, 189 insertions(+), 126 deletions(-) -- 2.26.1.301.g55bc3eb7cb9-goog