aboutsummaryrefslogtreecommitdiffstats
path: root/fs/f2fs/dir.c
diff options
context:
space:
mode:
authorJaegeuk Kim <jaegeuk.kim@samsung.com>2012-11-28 02:12:41 -0500
committerJaegeuk Kim <jaegeuk.kim@samsung.com>2012-12-10 23:43:42 -0500
commit25ca923b2a766b9c93b63777ead351137533a623 (patch)
tree6414cd58a9573177310a9f0ccfdfaca9cf45eb70 /fs/f2fs/dir.c
parentcf0e3a64cad19acd5904946d0647d751c1671620 (diff)
f2fs: fix endian conversion bugs reported by sparse
This patch should resolve the bugs reported by the sparse tool. Initial reports were written by "kbuild test robot" managed by fengguang.wu. In my local machines, I've tested also by running: > make C=2 CF="-D__CHECK_ENDIAN__" Accordingly, I've found lots of warnings and bugs related to the endian conversion. And I've fixed all at this moment. Signed-off-by: Jaegeuk Kim <jaegeuk.kim@samsung.com>
Diffstat (limited to 'fs/f2fs/dir.c')
-rw-r--r--fs/f2fs/dir.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/fs/f2fs/dir.c b/fs/f2fs/dir.c
index 5975568d03df..5ec7a06120e1 100644
--- a/fs/f2fs/dir.c
+++ b/fs/f2fs/dir.c
@@ -80,7 +80,7 @@ static bool early_match_name(const char *name, int namelen,
80 if (le16_to_cpu(de->name_len) != namelen) 80 if (le16_to_cpu(de->name_len) != namelen)
81 return false; 81 return false;
82 82
83 if (le32_to_cpu(de->hash_code) != namehash) 83 if (de->hash_code != namehash)
84 return false; 84 return false;
85 85
86 return true; 86 return true;
@@ -143,7 +143,7 @@ static struct f2fs_dir_entry *find_in_level(struct inode *dir,
143 nbucket = dir_buckets(level); 143 nbucket = dir_buckets(level);
144 nblock = bucket_blocks(level); 144 nblock = bucket_blocks(level);
145 145
146 bidx = dir_block_index(level, namehash % nbucket); 146 bidx = dir_block_index(level, le32_to_cpu(namehash) % nbucket);
147 end_block = bidx + nblock; 147 end_block = bidx + nblock;
148 148
149 for (; bidx < end_block; bidx++) { 149 for (; bidx < end_block; bidx++) {
@@ -406,7 +406,7 @@ start:
406 nbucket = dir_buckets(level); 406 nbucket = dir_buckets(level);
407 nblock = bucket_blocks(level); 407 nblock = bucket_blocks(level);
408 408
409 bidx = dir_block_index(level, (dentry_hash % nbucket)); 409 bidx = dir_block_index(level, (le32_to_cpu(dentry_hash) % nbucket));
410 410
411 for (block = bidx; block <= (bidx + nblock - 1); block++) { 411 for (block = bidx; block <= (bidx + nblock - 1); block++) {
412 mutex_lock_op(sbi, DENTRY_OPS); 412 mutex_lock_op(sbi, DENTRY_OPS);
@@ -437,7 +437,7 @@ add_dentry:
437 wait_on_page_writeback(dentry_page); 437 wait_on_page_writeback(dentry_page);
438 438
439 de = &dentry_blk->dentry[bit_pos]; 439 de = &dentry_blk->dentry[bit_pos];
440 de->hash_code = cpu_to_le32(dentry_hash); 440 de->hash_code = dentry_hash;
441 de->name_len = cpu_to_le16(namelen); 441 de->name_len = cpu_to_le16(namelen);
442 memcpy(dentry_blk->filename[bit_pos], name, namelen); 442 memcpy(dentry_blk->filename[bit_pos], name, namelen);
443 de->ino = cpu_to_le32(inode->i_ino); 443 de->ino = cpu_to_le32(inode->i_ino);