lib/ftl: Fix padding size calculation
Padding size calculation should take into account
already acquired write buffer entries in case
number of blocks left for closing band is less than
write buffer size.
Signed-off-by: Wojciech Malikowski <wojciech.malikowski@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/463525 (master)
(cherry picked from commit b08337c216
)
Change-Id: I0f9c9bc94eb5a4736eede30ec424c81103e1256f
Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/467136
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Wojciech Malikowski <wojciech.malikowski@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
This commit is contained in:
parent
25b669f22a
commit
523b58fc04
@ -758,8 +758,10 @@ ftl_wptr_pad_band(struct ftl_wptr *wptr)
|
||||
size_t blocks_left, rwb_size, pad_size;
|
||||
|
||||
blocks_left = ftl_wptr_user_lbks_left(wptr);
|
||||
assert(size <= blocks_left);
|
||||
assert(blocks_left % dev->xfer_size == 0);
|
||||
rwb_size = ftl_rwb_size(dev->rwb) - size;
|
||||
pad_size = spdk_min(blocks_left, rwb_size);
|
||||
pad_size = spdk_min(blocks_left - size, rwb_size);
|
||||
|
||||
/* Pad write buffer until band is full */
|
||||
ftl_rwb_pad(dev, pad_size);
|
||||
|
Loading…
Reference in New Issue
Block a user