Allow more flexibility in zone start and span
authorPierre Labat <plabat@micron.com>
Fri, 15 May 2020 16:22:13 +0000 (11:22 -0500)
committerJens Axboe <axboe@kernel.dk>
Mon, 18 May 2020 22:56:00 +0000 (16:56 -0600)
Allow sequential read to start anywhere in a zone (option
offset), and have a span smaller than a zone (option size).

A use case is a Key Value Store reading a set of keys or values
starting somewhere in a zone.

Reviewed-by: Damien Le Moal <damien.lemoal@wdc.com>
Signed-off-by: Pierre Labat <plabat@micron.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
zbd.c

diff --git a/zbd.c b/zbd.c
index d8fc7ef57a89ebfee58a77af2f0c56c55572eea2..36de29fbd2fd6399aa81c8757d240274a805df47 100644 (file)
--- a/zbd.c
+++ b/zbd.c
@@ -262,7 +262,8 @@ static bool zbd_verify_sizes(void)
 
                        zone_idx = zbd_zone_idx(f, f->file_offset);
                        z = &f->zbd_info->zone_info[zone_idx];
-                       if (f->file_offset != z->start) {
+                       if ((f->file_offset != z->start) &&
+                           (td->o.td_ddir != TD_DDIR_READ)) {
                                new_offset = (z+1)->start;
                                if (new_offset >= f->file_offset + f->io_size) {
                                        log_info("%s: io_size must be at least one zone\n",
@@ -278,7 +279,8 @@ static bool zbd_verify_sizes(void)
                        zone_idx = zbd_zone_idx(f, f->file_offset + f->io_size);
                        z = &f->zbd_info->zone_info[zone_idx];
                        new_end = z->start;
-                       if (f->file_offset + f->io_size != new_end) {
+                       if ((td->o.td_ddir != TD_DDIR_READ) &&
+                           (f->file_offset + f->io_size != new_end)) {
                                if (new_end <= f->file_offset) {
                                        log_info("%s: io_size must be at least one zone\n",
                                                 f->file_name);