Skip to contentSkip to conversation

Allow sequential read to start anywhere in a zone (option offset), and have a span smaller than a zone (option size).

PATCH Applied [email protected] 3 participants 3 messages May 15, 2020 – May 18, 2020

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Allow sequential read to start anywhere in a zone (option offset), and have a span smaller than a zone (option size).

From: Pierre Labat <[email protected]>

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.

---
 zbd.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
zbd.c +4 -2
index 8dc3c39..f1f7c5c 100644
@@ -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);
Signature · 1 line
2.9.5
Reviewed-by on v1 1/1
#1 lore raw
Quoted 8 lines · On 2020/05/16 1:22, [email protected] wrote:

From: Pierre Labat <[email protected]>

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.

This looks OK to me.

Quoted 29 lines
---
 zbd.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
zbd.c +4 -2
index 8dc3c39..f1f7c5c 100644
@@ -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);
Signature · 2 lines
Damien Le Moal
Western Digital Research
Applied
#2 lore raw
In reply to [email protected]
Quoted 7 lines · On 5/15/20 10:22 AM, [email protected] wrote:

From: Pierre Labat <[email protected]>

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.

Applied, but I modified your commit message a bit. Don't make the title that long, and especially don't duplicate the title again just below it. The first paragraph and your title are identical.

Signature · 1 line
Jens Axboe