From 3d013806d52dd8c89d4114df68dbd19c7e721744 Mon Sep 17 00:00:00 2001 From: "John L. Hammond" Date: Fri, 14 Mar 2014 11:01:32 -0500 Subject: [PATCH] LU-4738 lmv: access lum_stripe_offset as little endian By the time that a struct lmv_user_md reaches lmv_placement_policy() it has already been converted to little endian. Therefore use the appropriate macros around accesses to this this field. This issue was found by rewriting the definition of struct lmv_user_md to use the __leXX typedefs and running sparse. Signed-off-by: John L. Hammond Change-Id: If641375eabd22cc3e935a2e8f1327c48081c6ed1 Reviewed-on: http://review.whamcloud.com/9671 Tested-by: Jenkins Tested-by: Maloo Reviewed-by: Dmitry Eremin Reviewed-by: Swapnil Pimpale Reviewed-by: Oleg Drokin --- lustre/lmv/lmv_obd.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lustre/lmv/lmv_obd.c b/lustre/lmv/lmv_obd.c index b6397d4..8f26e6c 100644 --- a/lustre/lmv/lmv_obd.c +++ b/lustre/lmv/lmv_obd.c @@ -1358,13 +1358,13 @@ static int lmv_placement_policy(struct obd_device *obd, lum = op_data->op_data; - if (lum->lum_stripe_offset != (__u32)-1) { - *mds = lum->lum_stripe_offset; + if (le32_to_cpu(lum->lum_stripe_offset) != (__u32)-1) { + *mds = le32_to_cpu(lum->lum_stripe_offset); } else { /* -1 means default, which will be in the same MDT with * the stripe */ *mds = op_data->op_mds; - lum->lum_stripe_offset = op_data->op_mds; + lum->lum_stripe_offset = cpu_to_le32(op_data->op_mds); } } else { /* Allocate new fid on target according to operation type and -- 1.8.3.1