From: Li Xi Date: Thu, 29 Nov 2018 14:51:44 +0000 (-0500) Subject: LU-11697 ost: do not reuse T10PI guards of unaligned page write X-Git-Tag: 2.12.0-RC1~3 X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=commitdiff_plain;h=6d8a7af1cd65409bdb5a307e76090ed460d5a6f6 LU-11697 ost: do not reuse T10PI guards of unaligned page write If the write is partial page, the guards of RPC checksum should not be reused for bio submission since the data might not be full-sector. The bio guards will be generated later based on the full sectors. If the sector size is 512B rather than 4 KB, or the page size on OST is larger than 4KB, this might drop some useful guards for partial page write, but it will only add minimal extra time of checksum calculation. Change-Id: I868342df87c28ea91f5f8364fe377277595ecf6d Signed-off-by: Li Xi Reviewed-on: https://review.whamcloud.com/33752 Tested-by: Jenkins Tested-by: Maloo Reviewed-by: Andreas Dilger Reviewed-by: Alex Zhuravlev Reviewed-by: Oleg Drokin --- diff --git a/lustre/target/tgt_handler.c b/lustre/target/tgt_handler.c index e60df76..64c0052 100644 --- a/lustre/target/tgt_handler.c +++ b/lustre/target/tgt_handler.c @@ -2034,8 +2034,18 @@ static int tgt_checksum_niobuf_t10pi(struct lu_target *tgt, } LASSERT(used <= MAX_GUARD_NUMBER); - /* If disk support T10PI checksum, copy guards to local_nb */ - if (t10_cksum_type && opc == OST_WRITE) { + /* + * If disk support T10PI checksum, copy guards to local_nb. + * If the write is partial page, do not use the guards for bio + * submission since the data might not be full-sector. The bio + * guards will be generated later based on the full sectors. If + * the sector size is 512B rather than 4 KB, or the page size + * is larger than 4KB, this might drop some useful guards for + * partial page write, but it will only add minimal extra time + * of checksum calculation. + */ + if (t10_cksum_type && opc == OST_WRITE && + local_nb[i].lnb_len == PAGE_SIZE) { local_nb[i].lnb_guard_rpc = 1; memcpy(local_nb[i].lnb_guards, guard_start + used_number,