X-Git-Url: https://git.whamcloud.com/?a=blobdiff_plain;ds=sidebyside;f=lustre%2Futils%2Flhsmtool_posix.c;h=0f9c79331e993dfb5ccf02969ae2c1024c672e6e;hb=549c57e77b7f3a4cae5a7381d612a499c2ca3dcc;hp=d19f173091fd1f83f8194d6738bc1d652cca24b8;hpb=adb39ea50c881a9f36d4a9fd2f8693eaec06b5d1;p=fs%2Flustre-release.git diff --git a/lustre/utils/lhsmtool_posix.c b/lustre/utils/lhsmtool_posix.c index d19f173..0f9c793 100644 --- a/lustre/utils/lhsmtool_posix.c +++ b/lustre/utils/lhsmtool_posix.c @@ -45,11 +45,13 @@ #include #include #include +#include #include #include #include #include #include +#include #include #include @@ -517,7 +519,7 @@ static int ct_copy_data(struct hsm_copyaction_private *hcp, const char *src, struct stat dst_st; char *buf = NULL; __u64 write_total = 0; - __u64 length; + __u64 length = hai->hai_extent.length; time_t last_report_time; int rc = 0; double start_ct_now = ct_now(); @@ -559,8 +561,8 @@ static int ct_copy_data(struct hsm_copyaction_private *hcp, const char *src, } /* Don't read beyond a given extent */ - length = min(hai->hai_extent.length, - src_st.st_size - hai->hai_extent.offset); + if (length > src_st.st_size - hai->hai_extent.offset) + length = src_st.st_size - hai->hai_extent.offset; start_time = last_bw_print = last_report_time = time(NULL); @@ -1650,7 +1652,7 @@ static int ct_rebind_list(const char *list) if (line) free(line); - /* return 0 if all rebinds were sucessful */ + /* return 0 if all rebinds were successful */ CT_TRACE("%u lines read from '%s', %u rebind successful", nl, list, ok); return ok == nl ? 0 : -1;