Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

block/rnbd-proto: Check and retain the NOUNMAP flag for requests

The NOUNMAP flag is in combination with WRITE_ZEROES flag to indicate
that the upper layers wants the sectors zeroed, but does not want it to
get freed. This instruction is especially important for storage stacks
which involves a layer capable of thin provisioning.

This commit makes RNBD block device transfer and retain this NOUNMAP flag
for requests, so it can be passed onto the backend device on the server
side.

Since it is a change in the wire protocol, bump the minor version of
protocol.

Signed-off-by: Md Haris Iqbal <haris.iqbal@ionos.com>
Signed-off-by: Jack Wang <jinpu.wang@ionos.com>
Signed-off-by: Grzegorz Prajsner <grzegorz.prajsner@ionos.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>

authored by

Md Haris Iqbal and committed by
Jens Axboe
ef63e9ef 581cf833

+10 -2
+10 -2
drivers/block/rnbd/rnbd-proto.h
··· 18 18 #include <rdma/ib.h> 19 19 20 20 #define RNBD_PROTO_VER_MAJOR 2 21 - #define RNBD_PROTO_VER_MINOR 1 21 + #define RNBD_PROTO_VER_MINOR 2 22 22 23 23 /* The default port number the RTRS server is listening on. */ 24 24 #define RTRS_PORT 1234 ··· 198 198 * @RNBD_F_SYNC: request is sync (sync write or read) 199 199 * @RNBD_F_FUA: forced unit access 200 200 * @RNBD_F_PREFLUSH: request for cache flush 201 + * @RNBD_F_NOUNMAP: do not free blocks when zeroing 201 202 */ 202 203 enum rnbd_io_flags { 203 204 ··· 213 212 /* Flags */ 214 213 RNBD_F_SYNC = 1<<(RNBD_OP_BITS + 0), 215 214 RNBD_F_FUA = 1<<(RNBD_OP_BITS + 1), 216 - RNBD_F_PREFLUSH = 1<<(RNBD_OP_BITS + 2) 215 + RNBD_F_PREFLUSH = 1<<(RNBD_OP_BITS + 2), 216 + RNBD_F_NOUNMAP = 1<<(RNBD_OP_BITS + 3) 217 217 }; 218 218 219 219 static inline u32 rnbd_op(u32 flags) ··· 249 247 break; 250 248 case RNBD_OP_WRITE_ZEROES: 251 249 bio_opf = REQ_OP_WRITE_ZEROES; 250 + 251 + if (rnbd_opf & RNBD_F_NOUNMAP) 252 + bio_opf |= REQ_NOUNMAP; 252 253 break; 253 254 default: 254 255 WARN(1, "Unknown RNBD type: %d (flags %d)\n", ··· 290 285 break; 291 286 case REQ_OP_WRITE_ZEROES: 292 287 rnbd_opf = RNBD_OP_WRITE_ZEROES; 288 + 289 + if (rq->cmd_flags & REQ_NOUNMAP) 290 + rnbd_opf |= RNBD_F_NOUNMAP; 293 291 break; 294 292 case REQ_OP_FLUSH: 295 293 rnbd_opf = RNBD_OP_FLUSH;