bdev: fix alignment math in spdk_bdev_io_set_buf()
Rather than adding the full alignment size (512), add one less than the alignment so that already-aligned buffers don't get rounded up again. Change-Id: I96323b848bfb90f2aa1774b869e2b8a81d253077 Reported-by: Shuhei Matsumoto Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com> Reviewed-on: https://review.gerrithub.io/418879 Tested-by: SPDK Automated Test System <sys_sgsw@intel.com> Reviewed-by: Ben Walker <benjamin.walker@intel.com> Reviewed-by: Jim Harris <james.r.harris@intel.com> Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
This commit is contained in:
parent
58d8a4564b
commit
d53545eff7
@ -393,7 +393,7 @@ spdk_bdev_io_set_buf(struct spdk_bdev_io *bdev_io, void *buf, size_t len)
|
||||
}
|
||||
|
||||
if (buf != NULL) {
|
||||
aligned_buf = (void *)(((uintptr_t)buf + 512) & ~511UL);
|
||||
aligned_buf = (void *)(((uintptr_t)buf + 511) & ~511UL);
|
||||
len = len - ((uintptr_t)aligned_buf - (uintptr_t)buf);
|
||||
} else {
|
||||
aligned_buf = NULL;
|
||||
|
Loading…
x
Reference in New Issue
Block a user