20 Jul, 2020

2 commits


05 Jun, 2020

1 commit


03 Jun, 2020

2 commits

  • Pull block updates from Jens Axboe:
    "Core block changes that have been queued up for this release:

    - Remove dead blk-throttle and blk-wbt code (Guoqing)

    - Include pid in blktrace note traces (Jan)

    - Don't spew I/O errors on wouldblock termination (me)

    - Zone append addition (Johannes, Keith, Damien)

    - IO accounting improvements (Konstantin, Christoph)

    - blk-mq hardware map update improvements (Ming)

    - Scheduler dispatch improvement (Salman)

    - Inline block encryption support (Satya)

    - Request map fixes and improvements (Weiping)

    - blk-iocost tweaks (Tejun)

    - Fix for timeout failing with error injection (Keith)

    - Queue re-run fixes (Douglas)

    - CPU hotplug improvements (Christoph)

    - Queue entry/exit improvements (Christoph)

    - Move DMA drain handling to the few drivers that use it (Christoph)

    - Partition handling cleanups (Christoph)"

    * tag 'for-5.8/block-2020-06-01' of git://git.kernel.dk/linux-block: (127 commits)
    block: mark bio_wouldblock_error() bio with BIO_QUIET
    blk-wbt: rename __wbt_update_limits to wbt_update_limits
    blk-wbt: remove wbt_update_limits
    blk-throttle: remove tg_drain_bios
    blk-throttle: remove blk_throtl_drain
    null_blk: force complete for timeout request
    blk-mq: drain I/O when all CPUs in a hctx are offline
    blk-mq: add blk_mq_all_tag_iter
    blk-mq: open code __blk_mq_alloc_request in blk_mq_alloc_request_hctx
    blk-mq: use BLK_MQ_NO_TAG in more places
    blk-mq: rename BLK_MQ_TAG_FAIL to BLK_MQ_NO_TAG
    blk-mq: move more request initialization to blk_mq_rq_ctx_init
    blk-mq: simplify the blk_mq_get_request calling convention
    blk-mq: remove the bio argument to ->prepare_request
    nvme: force complete cancelled requests
    blk-mq: blk-mq: provide forced completion method
    block: fix a warning when blkdev.h is included for !CONFIG_BLOCK builds
    block: blk-crypto-fallback: remove redundant initialization of variable err
    block: reduce part_stat_lock() scope
    block: use __this_cpu_add() instead of access by smp_processor_id()
    ...

    Linus Torvalds
     
  • Use the new readahead operation in iomap. Convert XFS and ZoneFS to use
    it.

    Signed-off-by: Matthew Wilcox (Oracle)
    Signed-off-by: Andrew Morton
    Reviewed-by: Christoph Hellwig
    Reviewed-by: Darrick J. Wong
    Reviewed-by: William Kucharski
    Cc: Chao Yu
    Cc: Cong Wang
    Cc: Dave Chinner
    Cc: Eric Biggers
    Cc: Gao Xiang
    Cc: Jaegeuk Kim
    Cc: John Hubbard
    Cc: Joseph Qi
    Cc: Junxiao Bi
    Cc: Michal Hocko
    Cc: Zi Yan
    Cc: Johannes Thumshirn
    Cc: Miklos Szeredi
    Link: http://lkml.kernel.org/r/20200414150233.24495-26-willy@infradead.org
    Signed-off-by: Linus Torvalds

    Matthew Wilcox (Oracle)
     

22 May, 2020

1 commit


13 May, 2020

1 commit

  • Synchronous direct I/O to a sequential write only zone can be issued using
    the new REQ_OP_ZONE_APPEND request operation. As dispatching multiple
    BIOs can potentially result in reordering, we cannot support asynchronous
    IO via this interface.

    We also can only dispatch up to queue_max_zone_append_sectors() via the
    new zone-append method and have to return a short write back to user-space
    in case an IO larger than queue_max_zone_append_sectors() has been issued.

    Signed-off-by: Johannes Thumshirn
    Acked-by: Damien Le Moal
    Signed-off-by: Jens Axboe

    Johannes Thumshirn
     

27 Apr, 2020

1 commit


25 Mar, 2020

1 commit

  • The write pointer of zones in the read-only consition is defined as
    invalid by the SCSI ZBC and ATA ZAC specifications. It is thus not
    possible to determine the correct size of a read-only zone file on
    mount. Fix this by handling read-only zones in the same manner as
    offline zones by disabling all accesses to the zone (read and write)
    and initializing the inode size of the read-only zone to 0).

    For zones found to be in the read-only condition at runtime, only
    disable write access to the zone and keep the size of the zone file to
    its last updated value to allow the user to recover previously written
    data.

    Also fix zonefs documentation file to reflect this change.

    Signed-off-by: Damien Le Moal
    Reviewed-by: Johannes Thumshirn

    Damien Le Moal
     

26 Feb, 2020

2 commits

  • Zonefs makes use of iomap internally, so it should also select iomap in
    Kconfig.

    Signed-off-by: Johannes Thumshirn
    Signed-off-by: Damien Le Moal

    Johannes Thumshirn
     
  • IOCB_NOWAIT can't just be ignored as it breaks applications expecting
    it not to block. Just refuse the operation as applications must handle
    that (e.g. by falling back to a thread pool).

    Fixes: 8dcc1a9d90c1 ("fs: New zonefs file system")
    Signed-off-by: Christoph Hellwig
    Signed-off-by: Damien Le Moal

    Christoph Hellwig
     

07 Feb, 2020

1 commit

  • zonefs is a very simple file system exposing each zone of a zoned block
    device as a file. Unlike a regular file system with zoned block device
    support (e.g. f2fs), zonefs does not hide the sequential write
    constraint of zoned block devices to the user. Files representing
    sequential write zones of the device must be written sequentially
    starting from the end of the file (append only writes).

    As such, zonefs is in essence closer to a raw block device access
    interface than to a full featured POSIX file system. The goal of zonefs
    is to simplify the implementation of zoned block device support in
    applications by replacing raw block device file accesses with a richer
    file API, avoiding relying on direct block device file ioctls which may
    be more obscure to developers. One example of this approach is the
    implementation of LSM (log-structured merge) tree structures (such as
    used in RocksDB and LevelDB) on zoned block devices by allowing SSTables
    to be stored in a zone file similarly to a regular file system rather
    than as a range of sectors of a zoned device. The introduction of the
    higher level construct "one file is one zone" can help reducing the
    amount of changes needed in the application as well as introducing
    support for different application programming languages.

    Zonefs on-disk metadata is reduced to an immutable super block to
    persistently store a magic number and optional feature flags and
    values. On mount, zonefs uses blkdev_report_zones() to obtain the device
    zone configuration and populates the mount point with a static file tree
    solely based on this information. E.g. file sizes come from the device
    zone type and write pointer offset managed by the device itself.

    The zone files created on mount have the following characteristics.
    1) Files representing zones of the same type are grouped together
    under a common sub-directory:
    * For conventional zones, the sub-directory "cnv" is used.
    * For sequential write zones, the sub-directory "seq" is used.
    These two directories are the only directories that exist in zonefs.
    Users cannot create other directories and cannot rename nor delete
    the "cnv" and "seq" sub-directories.
    2) The name of zone files is the number of the file within the zone
    type sub-directory, in order of increasing zone start sector.
    3) The size of conventional zone files is fixed to the device zone size.
    Conventional zone files cannot be truncated.
    4) The size of sequential zone files represent the file's zone write
    pointer position relative to the zone start sector. Truncating these
    files is allowed only down to 0, in which case, the zone is reset to
    rewind the zone write pointer position to the start of the zone, or
    up to the zone size, in which case the file's zone is transitioned
    to the FULL state (finish zone operation).
    5) All read and write operations to files are not allowed beyond the
    file zone size. Any access exceeding the zone size is failed with
    the -EFBIG error.
    6) Creating, deleting, renaming or modifying any attribute of files and
    sub-directories is not allowed.
    7) There are no restrictions on the type of read and write operations
    that can be issued to conventional zone files. Buffered, direct and
    mmap read & write operations are accepted. For sequential zone files,
    there are no restrictions on read operations, but all write
    operations must be direct IO append writes. mmap write of sequential
    files is not allowed.

    Several optional features of zonefs can be enabled at format time.
    * Conventional zone aggregation: ranges of contiguous conventional
    zones can be aggregated into a single larger file instead of the
    default one file per zone.
    * File ownership: The owner UID and GID of zone files is by default 0
    (root) but can be changed to any valid UID/GID.
    * File access permissions: the default 640 access permissions can be
    changed.

    The mkzonefs tool is used to format zoned block devices for use with
    zonefs. This tool is available on Github at:

    git@github.com:damien-lemoal/zonefs-tools.git.

    zonefs-tools also includes a test suite which can be run against any
    zoned block device, including null_blk block device created with zoned
    mode.

    Example: the following formats a 15TB host-managed SMR HDD with 256 MB
    zones with the conventional zones aggregation feature enabled.

    $ sudo mkzonefs -o aggr_cnv /dev/sdX
    $ sudo mount -t zonefs /dev/sdX /mnt
    $ ls -l /mnt/
    total 0
    dr-xr-xr-x 2 root root 1 Nov 25 13:23 cnv
    dr-xr-xr-x 2 root root 55356 Nov 25 13:23 seq

    The size of the zone files sub-directories indicate the number of files
    existing for each type of zones. In this example, there is only one
    conventional zone file (all conventional zones are aggregated under a
    single file).

    $ ls -l /mnt/cnv
    total 137101312
    -rw-r----- 1 root root 140391743488 Nov 25 13:23 0

    This aggregated conventional zone file can be used as a regular file.

    $ sudo mkfs.ext4 /mnt/cnv/0
    $ sudo mount -o loop /mnt/cnv/0 /data

    The "seq" sub-directory grouping files for sequential write zones has
    in this example 55356 zones.

    $ ls -lv /mnt/seq
    total 14511243264
    -rw-r----- 1 root root 0 Nov 25 13:23 0
    -rw-r----- 1 root root 0 Nov 25 13:23 1
    -rw-r----- 1 root root 0 Nov 25 13:23 2
    ...
    -rw-r----- 1 root root 0 Nov 25 13:23 55354
    -rw-r----- 1 root root 0 Nov 25 13:23 55355

    For sequential write zone files, the file size changes as data is
    appended at the end of the file, similarly to any regular file system.

    $ dd if=/dev/zero of=/mnt/seq/0 bs=4K count=1 conv=notrunc oflag=direct
    1+0 records in
    1+0 records out
    4096 bytes (4.1 kB, 4.0 KiB) copied, 0.000452219 s, 9.1 MB/s

    $ ls -l /mnt/seq/0
    -rw-r----- 1 root root 4096 Nov 25 13:23 /mnt/seq/0

    The written file can be truncated to the zone size, preventing any
    further write operation.

    $ truncate -s 268435456 /mnt/seq/0
    $ ls -l /mnt/seq/0
    -rw-r----- 1 root root 268435456 Nov 25 13:49 /mnt/seq/0

    Truncation to 0 size allows freeing the file zone storage space and
    restart append-writes to the file.

    $ truncate -s 0 /mnt/seq/0
    $ ls -l /mnt/seq/0
    -rw-r----- 1 root root 0 Nov 25 13:49 /mnt/seq/0

    Since files are statically mapped to zones on the disk, the number of
    blocks of a file as reported by stat() and fstat() indicates the size
    of the file zone.

    $ stat /mnt/seq/0
    File: /mnt/seq/0
    Size: 0 Blocks: 524288 IO Block: 4096 regular empty file
    Device: 870h/2160d Inode: 50431 Links: 1
    Access: (0640/-rw-r-----) Uid: ( 0/ root) Gid: ( 0/ root)
    Access: 2019-11-25 13:23:57.048971997 +0900
    Modify: 2019-11-25 13:52:25.553805765 +0900
    Change: 2019-11-25 13:52:25.553805765 +0900
    Birth: -

    The number of blocks of the file ("Blocks") in units of 512B blocks
    gives the maximum file size of 524288 * 512 B = 256 MB, corresponding
    to the device zone size in this example. Of note is that the "IO block"
    field always indicates the minimum IO size for writes and corresponds
    to the device physical sector size.

    This code contains contributions from:
    * Johannes Thumshirn ,
    * Darrick J. Wong ,
    * Christoph Hellwig ,
    * Chaitanya Kulkarni and
    * Ting Yao .

    Signed-off-by: Damien Le Moal
    Reviewed-by: Dave Chinner

    Damien Le Moal