Hi Geert, On Thu, 2012-09-06 at 19:18 +0200, Geert Jansen wrote: > Hi, > > i'm doing some testing with WRITE_SAME / UNMAP but i do not have any > real hardware that supports these commands. I have configured a LIO > target with a file backend. However when i try to use these commands > with sg_unmap and sg_write_same, i get the following kernel messages: > > [ 2279.544606] UNMAP emulation not supported for: fileio > [ 2299.480649] WRITE_SAME w/o UNMAP bit not supported for Block > Discard Emulation > [ 2303.320805] WRITE_SAME emulation not supported for: fileio > > Is there any way i can have it emulate UNMAP and WRITE_SAME? I don't > require e.g. UNMAP to really unmap a block should the file backing > store be on an SSD. Basically i'm just looking for a way to test these > commands from an initiator point of view. > You can test UNMAP + WRITE_SAME w/ UNMAP=1 using scsi_debug.ko, which enables these features with the following module params: # modprobe scsi_debug lbpu=1 lbpws=1 # sg_inq --page=bl /dev/sdf VPD INQUIRY: Block limits page (SBC) Maximum compare and write length: 0 blocks Optimal transfer length granularity: 1 blocks Maximum transfer length: 16384 blocks Optimal transfer length: 64 blocks Maximum prefetch, xdread, xdwrite transfer length: 0 blocks Maximum unmap LBA count: 4294967295 Maximum unmap block descriptor count: 256 Optimal unmap granularity: 1 Unmap granularity alignment valid: 0 Unmap granularity alignment: 0 # sg_unmap -vv --lba=0 --num=1 /dev/sdf open /dev/sdf with flags=0x802 unmap cdb: 42 00 00 00 00 00 00 00 18 00 unmap parameter list: 00 16 00 10 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01 00 00 00 00 >From there you should be able to import the scsi_debug LUN into IBLOCK + enable emulate_tp[u,ws]=1, or export directly via pSCSI. --nab -- To unsubscribe from this list: send the line "unsubscribe target-devel" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html