Whamcloud - gitweb
LU-9657 pfl: llapi_layout_comp_usei should handle non-pfl file 65/27865/4
authorEmoly Liu <emoly.liu@intel.com>
Tue, 15 Aug 2017 08:41:39 +0000 (16:41 +0800)
committerOleg Drokin <oleg.drokin@intel.com>
Mon, 28 Aug 2017 06:25:14 +0000 (06:25 +0000)
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 <emoly.liu@intel.com>
Change-Id: I3ba4f07ec843d9b61273af331060d5f8827c2f8b
Reviewed-on: https://review.whamcloud.com/27865
Tested-by: Jenkins
Reviewed-by: Niu Yawei <yawei.niu@intel.com>
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Fan Yong <fan.yong@intel.com>
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
lustre/utils/liblustreapi_layout.c

index 5df0ae6..f02bf44 100644 (file)
@@ -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);