Skip to content

Commit

Permalink
lib/ftl: Do not check busy flag when appending
Browse files Browse the repository at this point in the history
In append case checking if zone is not busy before
submitting to it is unnecessary. This patch improves
append performance.

Signed-off-by: Wojciech Malikowski <[email protected]>
Change-Id: I42f3b31815aa10aed6b0374c2247f857683822f3
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/1923
Tested-by: SPDK CI Jenkins <[email protected]>
Reviewed-by: Konrad Sztyber <[email protected]>
Reviewed-by: Jim Harris <[email protected]>
Reviewed-by: Shuhei Matsumoto <[email protected]>
  • Loading branch information
wmalikow authored and tomzawadzki committed Jun 4, 2020
1 parent 4ebe50f commit 074cdb4
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
8 changes: 5 additions & 3 deletions lib/ftl/ftl_band.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@

#include "ftl_io.h"
#include "ftl_addr.h"
#include "ftl_io.h"
#include "ftl_core.h"

/* Number of LBAs that could be stored in a single block */
#define FTL_NUM_LBA_IN_BLOCK (FTL_BLOCK_SIZE / sizeof(uint64_t))
Expand Down Expand Up @@ -275,11 +275,13 @@ ftl_band_zone_is_first(struct ftl_band *band, struct ftl_zone *zone)
}

static inline int
ftl_zone_is_writable(const struct ftl_zone *zone)
ftl_zone_is_writable(const struct spdk_ftl_dev *dev, const struct ftl_zone *zone)
{
bool busy = ftl_is_append_supported(dev) ? false : zone->busy;

return (zone->info.state == SPDK_BDEV_ZONE_STATE_OPEN ||
zone->info.state == SPDK_BDEV_ZONE_STATE_EMPTY) &&
!zone->busy;
!busy;
}

#endif /* FTL_BAND_H */
2 changes: 1 addition & 1 deletion lib/ftl/ftl_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -820,7 +820,7 @@ ftl_wptr_ready(struct ftl_wptr *wptr)

/* TODO: add handling of empty bands */

if (spdk_unlikely(!ftl_zone_is_writable(wptr->zone))) {
if (spdk_unlikely(!ftl_zone_is_writable(wptr->dev, wptr->zone))) {
/* Erasing band may fail after it was assigned to wptr. */
if (spdk_unlikely(wptr->zone->info.state == SPDK_BDEV_ZONE_STATE_OFFLINE)) {
ftl_wptr_advance(wptr, wptr->dev->xfer_size);
Expand Down

0 comments on commit 074cdb4

Please sign in to comment.