On 2021/04/14 23:11, Karel Zak wrote:
> On Wed, Apr 14, 2021 at 10:33:36AM +0900, Naohiro Aota wrote:
>> This series implements probing and wiping of the superblock of zoned btrfs.
> I have no disk with zones support, but it seems scsi_debug supports
> it. Do you have any step by step example how to test with btrfs? If
> yes, I will add a test to our test suite.

Yes, scsi_debug does support emulating a ZBC disk. You can setup a disk like 

modprobe scsi_debug \
        max_luns=1 \
        sector_size=4096 \
        zbc=host-managed \
        dev_size_mb=2048 \
        zone_size_mb=64 \

This will create a 2GB capacity disk with 64 MB zones.
Another solution, may be simpler, is to use null_blk. I am attaching a script
that I use to create zoned null block devices.

# nullblk-create.sh --help
Usage: nullblk-create.sh [options]
    -h | --help      : Display this help message and exit
    -v               : Be verbose (display final config)
    -cap <size (GB)> : set device capacity (default: 8)
                       For zoned devices, capacity is determined
                       with zone size and total number of zones
    -bs <size (B)>   : set sector size (default: 512)
    -m               : enable memory backing (default: false)
    -z               : create a zoned device (default: false)
    -qm <mode>       : set queue mode (default: 2)
                       0=bio, 1=rq, 2=multiqueue
    -sq <num>        : set number of submission queues
                       (default: nproc)
    -qd <depth>      : set queue depth (default: 64)
    -im <mode>       : set IRQ mode (default: 0)
                       0=none, 1=softirq, 2=timer
    -c <nsecs>       : set completion time for timer completion
                       (default: 10000 ns)
Options for zoned devices:
    -zs <size (MB)>  : set zone size (default: 8 MB)
    -zc <size (MB)>  : set zone capacity (default: zone size)
    -znc <num>       : set number of conv zones (default: 0)
    -zns <num>       : set number of swr zones (default: 8)
    -zr              : add a smaller runt swr zone (default: none)
    -zmo <num>       : set max open zones (default: no limit)
    -zma <num>       : set max active zones (default: no limit)

Something like this:

# nullblk-create.sh -m -cap 2 -z -zs 64 -znc 0
Created /dev/nullb0

Will also create a 2GB capacity disk with memory backing and 64 MB zones.

For the correct setup of the drive to test btrfs, I will let Naohiro and
Johannes comment.

Damien Le Moal
Western Digital Research

Attachment: nullblk-create.sh
Description: nullblk-create.sh

Reply via email to