On Mar 12, 2014, at 5:23 PM, Dan Mossor <dan.mossor(a)outlook.com> wrote:
The issue I believe that is going to stop me is that tgtadm expects a block device as the
target, and btrfs does not provide that. Is there a workaround, other than using a file in
the subvolume as the target? Is there work in progress to enable this feature, either in
the scsi-target-utils package or within the btrfs framework?
A btrfs subvolume is a separate file tree, but it's not a block device. It has no
fixed size or number of sectors, which is the case for a block device. I don't think
there's a plan to change this.
https://btrfs.wiki.kernel.org/index.php/SysadminGuide#Subvolumes
Using a file is unlikely to be a good work around because Btrfs is COW, so it writes new
blocks even for overwriting files. For a large file with a lot of active re-writes, it
causes a lot of fragmentation. This includes VM images. There's a lot of work still
being done in the autodefrag code, but right now the emphasis is for smaller files like
small databases and log files that are constantly being written to with random writes. The
workaround is to set xattr +C on the file, either setting it on a containing folder which
will cause any new file to inherit +C, or to set it on an empty file. This turns off
datacow for the file, which as a consequence also turns off data checksumming.
So I think you're better off using LVM LV to export the iSCSI target and format it
Btrfs, if Linux is what's going to use the iSCSI target. Sparse usage can be done with
LVM thin provisioning.
Chris Murphy