[lustre-discuss] llapi_file_get_stripe() and lmm_stripe_offset

Ben Evans bevans at cray.com
Mon May 2 05:33:27 PDT 2016


Short answer: You're looking in the wrong place.  What you're looking at is the policy that the file was created under.  For the actual details of the first offset in the file, look at objects[0].l_ost_idx.

-Ben Evans

From: lustre-discuss <lustre-discuss-bounces at lists.lustre.org<mailto:lustre-discuss-bounces at lists.lustre.org>> on behalf of John Bauer <bauerj at iodoctors.com<mailto:bauerj at iodoctors.com>>
Date: Saturday, April 30, 2016 at 4:45 PM
To: "lustre-discuss at lists.lustre.org<mailto:lustre-discuss at lists.lustre.org>" <lustre-discuss at lists.lustre.org<mailto:lustre-discuss at lists.lustre.org>>
Subject: [lustre-discuss] llapi_file_get_stripe() and lmm_stripe_offset


I have noticed some inconsistencies in the lfs setstripe/getstripe commands and llapi_file_get_stripe() function.   Notice in the lfs setstripe/getstripe example below that specifying 7 for the offset with lfs setstripe -i 7 results in lfs getstripe reporting lmm_stripe_offset=7.  That all looks good.  But the simple program below that calls llapi_file_get_stripe() and prints out the lmm_XXX values reports lmm_stripe_offset=0.  Doesn't seem right.

% lfs setstripe -c 4 -i 7 file.dat
% lfs getstripe file.dat
file.dat
lmm_stripe_count:   4
lmm_stripe_size:    1048576
lmm_pattern:        1
lmm_layout_gen:     0
lmm_stripe_offset:  7
        obdidx           objid           objid           group
             7         5611546       0x55a01a                0
             0         5607846       0x5591a6                0
             8         5612725       0x55a4b5                0
            16         5611434       0x559faa                0


But whenever I call llapi_file_get_stripe(), the value lmm_stripe_offset that is returned in the struct lov_user_md is always 0.

% ./main.exe file.dat
0=llapi_file_get_stripe()
lmm_stripe_count=4
lmm_stripe_size=1048576
lmm_pattern=1
lmm_layout_gen=0
lmm_stripe_offset=0
% cat main.c
#include <stdlib.h>
#include <stdio.h>
#include <string.h>

#include "lustre/lustre_user.h"

main(int argc, char **argv){
   if( argc < 2 ) return -1 ;
   char *fileName = argv[1] ;
   struct lov_user_md_v3 lum ;
   memset( &lum, 0, sizeof(lum) ) ;
   int status = llapi_file_get_stripe(fileName, &lum);
   fprintf(stderr,"%d=llapi_file_get_stripe()\n",status);
   if( status != 0 ) return -1 ;
   fprintf(stderr,"lmm_stripe_count=%d\n",lum.lmm_stripe_count);
   fprintf(stderr,"lmm_stripe_size=%lld\n",lum.lmm_stripe_size);
   fprintf(stderr,"lmm_pattern=%d\n",lum.lmm_pattern);
   fprintf(stderr,"lmm_layout_gen=%d\n",lum.lmm_layout_gen);
   fprintf(stderr,"lmm_stripe_offset=%d\n",(int)lum.lmm_stripe_offset);
   exit(0);
}



--
I/O Doctors, LLC
507-766-0378
bauerj at iodoctors.com<mailto:bauerj at iodoctors.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lustre.org/pipermail/lustre-discuss-lustre.org/attachments/20160502/8f450a69/attachment.htm>


More information about the lustre-discuss mailing list