vxlan: move GBP header parsing to a separate function
[cascardo/linux.git] / drivers / target / target_core_sbc.c
index 98698d8..a9057aa 100644 (file)
@@ -141,9 +141,17 @@ sbc_emulate_readcapacity_16(struct se_cmd *cmd)
         * Set Thin Provisioning Enable bit following sbc3r22 in section
         * READ CAPACITY (16) byte 14 if emulate_tpu or emulate_tpws is enabled.
         */
-       if (dev->dev_attrib.emulate_tpu || dev->dev_attrib.emulate_tpws)
+       if (dev->dev_attrib.emulate_tpu || dev->dev_attrib.emulate_tpws) {
                buf[14] |= 0x80;
 
+               /*
+                * LBPRZ signifies that zeroes will be read back from an LBA after
+                * an UNMAP or WRITE SAME w/ unmap bit (sbc3r36 5.16.2)
+                */
+               if (dev->dev_attrib.unmap_zeroes_data)
+                       buf[14] |= 0x40;
+       }
+
        rbuf = transport_kmap_data_sg(cmd);
        if (rbuf) {
                memcpy(rbuf, buf, min_t(u32, sizeof(buf), cmd->data_length));