From: Emoly Liu Date: Tue, 15 Aug 2017 08:41:39 +0000 (+0800) Subject: LU-9657 pfl: llapi_layout_comp_usei should handle non-pfl file X-Git-Tag: 2.10.53~65 X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=commitdiff_plain;h=4f349ddde3567c19a522c707fc5ef2271016bfe6 LU-9657 pfl: llapi_layout_comp_usei should handle non-pfl file This patch improves llapi_layout_comp_use() to treat non-composite file as single component file. When doing "is composite" check, "1" is returned when LLAPI_LAYOUT_COMP_USE_NEXT/PREV is specified. Signed-off-by: Emoly Liu Change-Id: I3ba4f07ec843d9b61273af331060d5f8827c2f8b Reviewed-on: https://review.whamcloud.com/27865 Tested-by: Jenkins Reviewed-by: Niu Yawei Tested-by: Maloo Reviewed-by: Fan Yong Reviewed-by: Andreas Dilger --- diff --git a/lustre/utils/liblustreapi_layout.c b/lustre/utils/liblustreapi_layout.c index 5df0ae6..f02bf44 100644 --- a/lustre/utils/liblustreapi_layout.c +++ b/lustre/utils/liblustreapi_layout.c @@ -1841,8 +1841,11 @@ int llapi_layout_comp_use(struct llapi_layout *layout, return -1; if (!layout->llot_is_composite) { - errno = EINVAL; - return -1; + if (pos == LLAPI_LAYOUT_COMP_USE_FIRST || + pos == LLAPI_LAYOUT_COMP_USE_LAST) + return 0; + errno = ENOENT; + return 1; } head = list_entry(layout->llot_comp_list.next, typeof(*head), llc_list);