From: Andreas Dilger Date: Fri, 12 Jun 2020 21:16:09 +0000 (-0600) Subject: LU-13673 misc: quiet compiler warning on armv7l X-Git-Tag: 2.13.55~55 X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=commitdiff_plain;h=57bb3024613831d5d7f8f085bb0c7ebc33796790 LU-13673 misc: quiet compiler warning on armv7l Add AM_CFLAGS when building lfs.c and lfs_project.c. Avoid overflow in jobid_get_from_environ() and lu_prandom_u64_max(). Quiet printk() warning for mismatched type of size_t variables by using %z modifier for those variables. Fixes: 742897a967cf ("LU-13274 uapi: make lnet UAPI headers C99 compliant") Fixes: df21a3b9eb01 ("LU-12790 obdclass: print jobid error message properly") Fixes: 645b72c5c058 ("LU-12495 obdclass: generate random u64 max correctly") Test-Parameters: trivial Signed-off-by: Andreas Dilger Change-Id: Ib424497d1543fd7840d630facf3210b6fa1344c7 Reviewed-on: https://review.whamcloud.com/38927 Reviewed-by: James Simmons Tested-by: jenkins Tested-by: Maloo Reviewed-by: Lai Siyao Reviewed-by: Yang Sheng Reviewed-by: Oleg Drokin --- diff --git a/lustre/llite/vvp_io.c b/lustre/llite/vvp_io.c index 5fb6e13..8d79586 100644 --- a/lustre/llite/vvp_io.c +++ b/lustre/llite/vvp_io.c @@ -829,7 +829,7 @@ static int vvp_io_read_start(const struct lu_env *env, GOTO(out, result); LU_OBJECT_HEADER(D_INODE, env, &obj->co_lu, - "Read ino %lu, %lu bytes, offset %lld, size %llu\n", + "Read ino %lu, %zu bytes, offset %lld, size %llu\n", inode->i_ino, cnt, pos, i_size_read(inode)); /* turn off the kernel's read-ahead */ @@ -1309,9 +1309,8 @@ static int vvp_io_write_start(const struct lu_env *env, } } if (vio->vui_iocb->ki_pos != (pos + io->ci_nob - nob)) { - CDEBUG(D_VFSTRACE, "%s: write position mismatch: " - "ki_pos %lld vs. pos %lld, written %ld, commit %ld " - "rc %ld\n", + CDEBUG(D_VFSTRACE, + "%s: write position mismatch: ki_pos %lld vs. pos %lld, written %zd, commit %zd: rc = %zd\n", file_dentry(file)->d_name.name, vio->vui_iocb->ki_pos, pos + io->ci_nob - nob, written, io->ci_nob - nob, result); diff --git a/lustre/obdclass/jobid.c b/lustre/obdclass/jobid.c index 868f19d..939fec1 100644 --- a/lustre/obdclass/jobid.c +++ b/lustre/obdclass/jobid.c @@ -238,7 +238,7 @@ int jobid_get_from_environ(char *jobid_var, char *jobid, int *jobid_len) if (unlikely(ktime_to_ns(printed) == 0 || ktime_after(ktime_get(), ktime_add_ns(printed, - 3600*24*NSEC_PER_SEC)))) { + 3600ULL * 24 * NSEC_PER_SEC)))) { LCONSOLE_WARN("jobid: '%s' value too large (%d)\n", obd_jobid_var, *jobid_len); printed = ktime_get(); diff --git a/lustre/obdclass/lu_tgt_descs.c b/lustre/obdclass/lu_tgt_descs.c index 22d79a1..f15e18b 100644 --- a/lustre/obdclass/lu_tgt_descs.c +++ b/lustre/obdclass/lu_tgt_descs.c @@ -64,7 +64,7 @@ u64 lu_prandom_u64_max(u64 ep_ro) * 32 bits (truncated to the upper limit, if needed) */ if (ep_ro > 0xffffffffULL) - rand = prandom_u32_max((u32)(ep_ro >> 32)) << 32; + rand = (u64)prandom_u32_max((u32)(ep_ro >> 32)) << 32; if (rand == (ep_ro & 0xffffffff00000000ULL)) rand |= prandom_u32_max((u32)ep_ro); diff --git a/lustre/utils/Makefile.am b/lustre/utils/Makefile.am index 9e3c8a9..0f87553 100644 --- a/lustre/utils/Makefile.am +++ b/lustre/utils/Makefile.am @@ -68,7 +68,7 @@ lctl_LDADD := liblustreapi.la $(PTHREAD_LIBS) -lyaml lctl_DEPENDENCIES := liblustreapi.la lfs_SOURCES = lfs.c lfs_project.c lfs_project.h -lfs_CFLAGS := -fPIC -I $(top_builddir)/lnet/utils +lfs_CFLAGS := -fPIC $(AM_CFLAGS) -I $(top_builddir)/lnet/utils lfs_LDADD := liblustreapi.la -lz lfs_LDADD += $(top_builddir)/lnet/utils/lnetconfig/liblnetconfig.la lfs_DEPENDENCIES := liblustreapi.la