scoutfs: fix sparse errors

I was building against a RHEL tree that broke sparse builds.  With that
fixed I can now see and fix sparse errors.

Signed-off-by: Zach Brown <zab@versity.com>
This commit is contained in:
Zach Brown
2016-03-24 21:44:42 -07:00
parent 3755adddd5
commit fbbfac1b27
3 changed files with 7 additions and 3 deletions

View File

@@ -25,12 +25,13 @@
#include "msg.h" #include "msg.h"
#include "block.h" #include "block.h"
#include "ring.h" #include "ring.h"
#include "chunk.h"
void scoutfs_set_chunk_alloc_bits(struct super_block *sb, void scoutfs_set_chunk_alloc_bits(struct super_block *sb,
struct scoutfs_ring_bitmap *bm) struct scoutfs_ring_bitmap *bm)
{ {
struct scoutfs_sb_info *sbi = SCOUTFS_SB(sb); struct scoutfs_sb_info *sbi = SCOUTFS_SB(sb);
u64 off = le64_to_cpu(bm->offset) * ARRAY_SIZE(bm->bits); u64 off = le32_to_cpu(bm->offset) * ARRAY_SIZE(bm->bits);
/* XXX check for corruption */ /* XXX check for corruption */
@@ -66,7 +67,7 @@ int scoutfs_alloc_chunk(struct super_block *sb, u64 *blkno)
clear_bit_le(bit, sbi->chunk_alloc_bits); clear_bit_le(bit, sbi->chunk_alloc_bits);
off = round_down(bit, sizeof(bm.bits) * 8); off = round_down(bit, sizeof(bm.bits) * 8);
bm.offset = le32_to_cpu(off); bm.offset = cpu_to_le32(off);
off *= ARRAY_SIZE(bm.bits); off *= ARRAY_SIZE(bm.bits);
bm.bits[0] = sbi->chunk_alloc_bits[off]; bm.bits[0] = sbi->chunk_alloc_bits[off];

View File

@@ -1,6 +1,8 @@
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/fs.h> #include <linux/fs.h>
#include "msg.h"
void scoutfs_msg(struct super_block *sb, const char *prefix, const char *str, void scoutfs_msg(struct super_block *sb, const char *prefix, const char *str,
const char *fmt, ...) const char *fmt, ...)
{ {

View File

@@ -155,7 +155,8 @@ static int read_supers(struct super_block *sb)
/* Initialize all the sb info fields which depends on the supers. */ /* Initialize all the sb info fields which depends on the supers. */
bytes = DIV_ROUND_UP(sbi->super.total_chunks, 64) * sizeof(u64); bytes = DIV_ROUND_UP(le64_to_cpu(sbi->super.total_chunks), 64) *
sizeof(u64);
sbi->chunk_alloc_bits = vmalloc(bytes); sbi->chunk_alloc_bits = vmalloc(bytes);
if (!sbi->chunk_alloc_bits) if (!sbi->chunk_alloc_bits)
return -ENOMEM; return -ENOMEM;