From bcdb4a285f33f83ca51ec0eb6945ef95a3164f7a Mon Sep 17 00:00:00 2001 From: Mr NeilBrown Date: Thu, 21 Nov 2019 15:26:04 +1100 Subject: [PATCH] LU-13004 net: discard LNET_MD_IOVEC This flag is now never set, so discard it. lnet_md memory descriptors are either a single virtual address, or a list of bvec. Signed-off-by: Mr NeilBrown Change-Id: I9b2280f801108e5d9fc718c90c83692042991f12 Reviewed-on: https://review.whamcloud.com/36974 Reviewed-by: James Simmons Reviewed-by: Serguei Smirnov Reviewed-by: Shaun Tancheff Tested-by: jenkins Tested-by: Maloo Reviewed-by: Oleg Drokin --- lnet/include/lnet/lib-lnet.h | 3 +-- lnet/include/uapi/linux/lnet/lnet-types.h | 13 +++---------- lnet/lnet/lib-md.c | 30 +++--------------------------- lustre/ptlrpc/pers.c | 3 +-- 4 files changed, 8 insertions(+), 41 deletions(-) diff --git a/lnet/include/lnet/lib-lnet.h b/lnet/include/lnet/lib-lnet.h index c7ec6d1..d01439c 100644 --- a/lnet/include/lnet/lib-lnet.h +++ b/lnet/include/lnet/lib-lnet.h @@ -223,8 +223,7 @@ lnet_md_alloc(struct lnet_md *umd) niov = umd->length; size = offsetof(struct lnet_libmd, md_iov.kiov[niov]); } else { - niov = ((umd->options & LNET_MD_IOVEC) != 0) ? - umd->length : 1; + niov = 1; size = offsetof(struct lnet_libmd, md_iov.iov[niov]); } diff --git a/lnet/include/uapi/linux/lnet/lnet-types.h b/lnet/include/uapi/linux/lnet/lnet-types.h index 3134f38..e488e7d 100644 --- a/lnet/include/uapi/linux/lnet/lnet-types.h +++ b/lnet/include/uapi/linux/lnet/lnet-types.h @@ -407,11 +407,6 @@ struct lnet_md { * the number of entries in the array. The length can't be bigger * than LNET_MAX_IOV. The struct bio_vec is used to describe page-based * fragments that are not necessarily mapped in virtal memory. - * - LNET_MD_IOVEC bit set: The start field points to the starting - * address of an array of struct kvec and the length field specifies - * the number of entries in the array. The length can't be bigger - * than LNET_MAX_IOV. The struct kvec is used to describe fragments - * that have virtual addresses. * - Otherwise: The memory region is contiguous. The start field * specifies the starting address for the memory region and the * length field specifies its length. @@ -466,14 +461,12 @@ struct lnet_md { * The data sent in the REPLY serves as an implicit acknowledgment. * - LNET_MD_KIOV: The start and length fields specify an array of * struct bio_vec. - * - LNET_MD_IOVEC: The start and length fields specify an array of - * struct iovec. * - LNET_MD_MAX_SIZE: The max_size field is valid. * - LNET_MD_BULK_HANDLE: The bulk_handle field is valid. * * Note: - * - LNET_MD_KIOV or LNET_MD_IOVEC allows for a scatter/gather - * capability for memory descriptors. They can't be both set. + * - LNET_MD_KIOV allows for a scatter/gather capability for memory + * descriptors. * - When LNET_MD_MAX_SIZE is set, the total length of the memory * region (i.e. sum of all fragment lengths) must not be less than * \a max_size. @@ -523,7 +516,7 @@ struct lnet_md { /** See struct lnet_md::options. */ #define LNET_MD_ACK_DISABLE (1 << 5) /** See struct lnet_md::options. */ -#define LNET_MD_IOVEC (1 << 6) +/* deprecated #define LNET_MD_IOVEC (1 << 6) */ /** See struct lnet_md::options. */ #define LNET_MD_MAX_SIZE (1 << 7) /** See struct lnet_md::options. */ diff --git a/lnet/lnet/lib-md.c b/lnet/lnet/lib-md.c index b7b0939..46b9c5c 100644 --- a/lnet/lnet/lib-md.c +++ b/lnet/lnet/lib-md.c @@ -208,31 +208,7 @@ lnet_md_build(struct lnet_libmd *lmd, struct lnet_md *umd, int unlink) lmd->md_flags = (unlink == LNET_UNLINK) ? LNET_MD_FLAG_AUTO_UNLINK : 0; lmd->md_bulk_handle = umd->bulk_handle; - if ((umd->options & LNET_MD_IOVEC) != 0) { - - if ((umd->options & LNET_MD_KIOV) != 0) /* Can't specify both */ - return -EINVAL; - - lmd->md_niov = niov = umd->length; - memcpy(lmd->md_iov.iov, umd->start, - niov * sizeof(lmd->md_iov.iov[0])); - - for (i = 0; i < (int)niov; i++) { - /* We take the base address on trust */ - if (lmd->md_iov.iov[i].iov_len <= 0) /* invalid length */ - return -EINVAL; - - total_length += lmd->md_iov.iov[i].iov_len; - } - - lmd->md_length = total_length; - - if ((umd->options & LNET_MD_MAX_SIZE) != 0 && /* max size used */ - (umd->max_size < 0 || - umd->max_size > total_length)) // illegal max_size - return -EINVAL; - - } else if ((umd->options & LNET_MD_KIOV) != 0) { + if ((umd->options & LNET_MD_KIOV) != 0) { lmd->md_niov = niov = umd->length; memcpy(lmd->md_iov.kiov, umd->start, niov * sizeof(lmd->md_iov.kiov[0])); @@ -308,7 +284,7 @@ lnet_md_deconstruct(struct lnet_libmd *lmd, struct lnet_md *umd) * and that's all. */ umd->start = lmd->md_start; - umd->length = ((lmd->md_options & (LNET_MD_IOVEC | LNET_MD_KIOV)) == 0) ? + umd->length = ((lmd->md_options & LNET_MD_KIOV) == 0) ? lmd->md_length : lmd->md_niov; umd->threshold = lmd->md_threshold; umd->max_size = lmd->md_max_size; @@ -325,7 +301,7 @@ lnet_md_validate(struct lnet_md *umd) return -EINVAL; } - if ((umd->options & (LNET_MD_KIOV | LNET_MD_IOVEC)) != 0 && + if ((umd->options & LNET_MD_KIOV) && umd->length > LNET_MAX_IOV) { CERROR("Invalid option: too many fragments %u, %d max\n", umd->length, LNET_MAX_IOV); diff --git a/lustre/ptlrpc/pers.c b/lustre/ptlrpc/pers.c index 4566d88..7183e37 100644 --- a/lustre/ptlrpc/pers.c +++ b/lustre/ptlrpc/pers.c @@ -48,8 +48,7 @@ void ptlrpc_fill_bulk_md(struct lnet_md *md, struct ptlrpc_bulk_desc *desc, LASSERT(mdidx < desc->bd_md_max_brw); LASSERT(desc->bd_iov_count <= PTLRPC_MAX_BRW_PAGES); - LASSERT(!(md->options & (LNET_MD_IOVEC | LNET_MD_KIOV | - LNET_MD_PHYS))); + LASSERT(!(md->options & (LNET_MD_KIOV | LNET_MD_PHYS))); md->length = max(0, desc->bd_iov_count - mdidx * LNET_MAX_IOV); md->length = min_t(unsigned int, LNET_MAX_IOV, md->length); -- 1.8.3.1