Whamcloud - gitweb
LU-216 ldiskfs: use proper arguments for ldiskfs_free_blocks 20/1720/4
authorAndreas Dilger <andreas.dilger@intel.com>
Thu, 20 Feb 2014 22:00:08 +0000 (14:00 -0800)
committerOleg Drokin <oleg.drokin@intel.com>
Tue, 27 May 2014 18:37:59 +0000 (18:37 +0000)
In ldiskfs_ext_new_extent_cb(), the extent length argument
is confusingly converted from le16 using cpu_to_le16() instead
of le16_to_cpu().  While this is functionally correct, it is
semantically incorrect and can confuse static code analysis.

Signed-off-by: Andrew Perepechko <andrew_perepechko@xyratex.com>
Signed-off-by: Andreas Dilger <andreas.dilger@intel.com>
Change-Id: I8b3a684677c66d96fe4828fa771fc309c21755b8
Reviewed-on: http://review.whamcloud.com/1720
Tested-by: Jenkins
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Jian Yu <jian.yu@intel.com>
Reviewed-by: John L. Hammond <john.hammond@intel.com>
config/lustre-build-ldiskfs.m4
lustre/osd-ldiskfs/osd_io.c

index bdcae9a..e34e75a 100644 (file)
@@ -35,6 +35,7 @@ AC_SUBST(LDISKFS_SERIES)
 # LB_EXT_FREE_BLOCKS_WITH_BUFFER_HEAD
 #
 # 2.6.32-rc7 ext4_free_blocks requires struct buffer_head
+# Note that RHEL6 is pre 2.6.32-rc7 so this check is still needed.
 #
 AC_DEFUN([LB_EXT_FREE_BLOCKS_WITH_BUFFER_HEAD], [
 LB_CHECK_COMPILE([if 'ext4_free_blocks' needs 'struct buffer_head'],
index d223585..0a73cb0 100644 (file)
@@ -664,11 +664,12 @@ static int ldiskfs_ext_new_extent_cb(struct inode *inode,
                 * but otherwise we'd need to call it every free() */
                ldiskfs_discard_preallocations(inode);
 #ifdef HAVE_EXT_FREE_BLOCK_WITH_BUFFER_HEAD /* Introduced in 2.6.32-rc7 */
-               ldiskfs_free_blocks(handle, inode, NULL, ldiskfs_ext_pblock(&nex),
-                                   cpu_to_le16(nex.ee_len), 0);
+               ldiskfs_free_blocks(handle, inode, NULL,
+                                   ldiskfs_ext_pblock(&nex),
+                                   le16_to_cpu(nex.ee_len), 0);
 #else
                ldiskfs_free_blocks(handle, inode, ldiskfs_ext_pblock(&nex),
-                                   cpu_to_le16(nex.ee_len), 0);
+                                   le16_to_cpu(nex.ee_len), 0);
 #endif
                goto out;
        }