Skip to content

Commit

Permalink
chore: unwritten block check from current blob during read (#42)
Browse files Browse the repository at this point in the history
Signed-off-by: Hrudaya <[email protected]>
  • Loading branch information
hrudaya21 authored and tiagolobocastro committed Apr 19, 2024
1 parent 0c2995e commit 38ea349
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
3 changes: 3 additions & 0 deletions include/spdk/nvme_spec.h
Original file line number Diff line number Diff line change
Expand Up @@ -4355,6 +4355,9 @@ SPDK_STATIC_ASSERT(sizeof(struct spdk_nvme_ns_streams_status) == 131072, "Incorr
/** When set, reading of unwritten or deallocated block of a thin-provisioned device will fail
* with SPDK_NVME_SC_DEALLOCATED_OR_UNWRITTEN_BLOCK */
#define SPDK_NVME_IO_FLAGS_UNWRITTEN_READ_FAIL (4U << 20)
/** When set, check for allocated blocks from current blob, rather checking from
* complete blob chain while doing read */
#define SPDK_NVME_IO_FLAG_CURRENT_UNWRITTEN_READ_FAIL (4U << 19)
/** Zone append specific, determines the contents of the reference tag written to the media */
#define SPDK_NVME_IO_FLAGS_ZONE_APPEND_PIREMAP (1U << 25)
/** Enable protection information checking of the Logical Block Reference Tag field */
Expand Down
4 changes: 4 additions & 0 deletions lib/blob/blobstore.c
Original file line number Diff line number Diff line change
Expand Up @@ -3322,6 +3322,10 @@ blob_request_submit_rw_iov(struct spdk_blob *blob, struct spdk_io_channel *_chan
if (read) {
spdk_bs_sequence_t *seq;

if (!is_allocated && (ext_io_flags & SPDK_NVME_IO_FLAG_CURRENT_UNWRITTEN_READ_FAIL)) {
cb_fn(cb_arg, -ETXTBSY);
return;
}
if (!is_allocated && (ext_io_flags & SPDK_NVME_IO_FLAGS_UNWRITTEN_READ_FAIL)) {
is_allocated = blob_ancestor_calc_lba_and_lba_count(blob, offset, length, &lba, &lba_count);
if (!is_allocated) {
Expand Down

0 comments on commit 38ea349

Please sign in to comment.