Skip to content

Commit

Permalink
nilfs2: avoid bare use of 'unsigned'
Browse files Browse the repository at this point in the history
This fixes checkpatch.pl warning "WARNING: Prefer 'unsigned int' to
bare use of 'unsigned'".

Link: http://lkml.kernel.org/r/[email protected]
Signed-off-by: Ryusuke Konishi <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
konis authored and torvalds committed May 24, 2016
1 parent 7592ecd commit 0c6c44c
Show file tree
Hide file tree
Showing 27 changed files with 97 additions and 90 deletions.
8 changes: 4 additions & 4 deletions fs/nilfs2/alloc.c
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ nilfs_palloc_groups_count(const struct inode *inode)
* @inode: inode of metadata file using this allocator
* @entry_size: size of the persistent object
*/
int nilfs_palloc_init_blockgroup(struct inode *inode, unsigned entry_size)
int nilfs_palloc_init_blockgroup(struct inode *inode, unsigned int entry_size)
{
struct nilfs_mdt_info *mi = NILFS_MDT(inode);

Expand Down Expand Up @@ -384,7 +384,7 @@ void *nilfs_palloc_block_get_entry(const struct inode *inode, __u64 nr,
*/
static int nilfs_palloc_find_available_slot(unsigned char *bitmap,
unsigned long target,
unsigned bsize,
unsigned int bsize,
spinlock_t *lock)
{
int pos, end = bsize;
Expand Down Expand Up @@ -735,8 +735,8 @@ int nilfs_palloc_freev(struct inode *inode, __u64 *entry_nrs, size_t nitems)
unsigned long group, group_offset;
__u64 group_min_nr, last_nrs[8];
const unsigned long epg = nilfs_palloc_entries_per_group(inode);
const unsigned epb = NILFS_MDT(inode)->mi_entries_per_block;
unsigned entry_start, end, pos;
const unsigned int epb = NILFS_MDT(inode)->mi_entries_per_block;
unsigned int entry_start, end, pos;
spinlock_t *lock;
int i, j, k, ret;
u32 nfree;
Expand Down
2 changes: 1 addition & 1 deletion fs/nilfs2/alloc.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ nilfs_palloc_entries_per_group(const struct inode *inode)
return 1UL << (inode->i_blkbits + 3 /* log2(8 = CHAR_BITS) */);
}

int nilfs_palloc_init_blockgroup(struct inode *, unsigned);
int nilfs_palloc_init_blockgroup(struct inode *, unsigned int);
int nilfs_palloc_get_entry_block(struct inode *, __u64, int,
struct buffer_head **);
void *nilfs_palloc_block_get_entry(const struct inode *, __u64,
Expand Down
2 changes: 1 addition & 1 deletion fs/nilfs2/bmap.c
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ int nilfs_bmap_lookup_at_level(struct nilfs_bmap *bmap, __u64 key, int level,
}

int nilfs_bmap_lookup_contig(struct nilfs_bmap *bmap, __u64 key, __u64 *ptrp,
unsigned maxblocks)
unsigned int maxblocks)
{
int ret;

Expand Down
4 changes: 2 additions & 2 deletions fs/nilfs2/bmap.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ struct nilfs_bmap_stats {
struct nilfs_bmap_operations {
int (*bop_lookup)(const struct nilfs_bmap *, __u64, int, __u64 *);
int (*bop_lookup_contig)(const struct nilfs_bmap *, __u64, __u64 *,
unsigned);
unsigned int);
int (*bop_insert)(struct nilfs_bmap *, __u64, __u64);
int (*bop_delete)(struct nilfs_bmap *, __u64);
void (*bop_clear)(struct nilfs_bmap *);
Expand Down Expand Up @@ -150,7 +150,7 @@ struct nilfs_bmap_store {
int nilfs_bmap_test_and_clear_dirty(struct nilfs_bmap *);
int nilfs_bmap_read(struct nilfs_bmap *, struct nilfs_inode *);
void nilfs_bmap_write(struct nilfs_bmap *, struct nilfs_inode *);
int nilfs_bmap_lookup_contig(struct nilfs_bmap *, __u64, __u64 *, unsigned);
int nilfs_bmap_lookup_contig(struct nilfs_bmap *, __u64, __u64 *, unsigned int);
int nilfs_bmap_insert(struct nilfs_bmap *bmap, __u64 key, unsigned long rec);
int nilfs_bmap_delete(struct nilfs_bmap *bmap, __u64 key);
int nilfs_bmap_seek_key(struct nilfs_bmap *bmap, __u64 start, __u64 *keyp);
Expand Down
3 changes: 2 additions & 1 deletion fs/nilfs2/btree.c
Original file line number Diff line number Diff line change
Expand Up @@ -685,7 +685,8 @@ static int nilfs_btree_lookup(const struct nilfs_bmap *btree,
}

static int nilfs_btree_lookup_contig(const struct nilfs_bmap *btree,
__u64 key, __u64 *ptrp, unsigned maxblocks)
__u64 key, __u64 *ptrp,
unsigned int maxblocks)
{
struct nilfs_btree_path *path;
struct nilfs_btree_node *node;
Expand Down
8 changes: 5 additions & 3 deletions fs/nilfs2/cpfile.c
Original file line number Diff line number Diff line change
Expand Up @@ -431,7 +431,8 @@ static void nilfs_cpfile_checkpoint_to_cpinfo(struct inode *cpfile,
}

static ssize_t nilfs_cpfile_do_get_cpinfo(struct inode *cpfile, __u64 *cnop,
void *buf, unsigned cisz, size_t nci)
void *buf, unsigned int cisz,
size_t nci)
{
struct nilfs_checkpoint *cp;
struct nilfs_cpinfo *ci = buf;
Expand Down Expand Up @@ -482,7 +483,8 @@ static ssize_t nilfs_cpfile_do_get_cpinfo(struct inode *cpfile, __u64 *cnop,
}

static ssize_t nilfs_cpfile_do_get_ssinfo(struct inode *cpfile, __u64 *cnop,
void *buf, unsigned cisz, size_t nci)
void *buf, unsigned int cisz,
size_t nci)
{
struct buffer_head *bh;
struct nilfs_cpfile_header *header;
Expand Down Expand Up @@ -568,7 +570,7 @@ static ssize_t nilfs_cpfile_do_get_ssinfo(struct inode *cpfile, __u64 *cnop,
*/

ssize_t nilfs_cpfile_get_cpinfo(struct inode *cpfile, __u64 *cnop, int mode,
void *buf, unsigned cisz, size_t nci)
void *buf, unsigned int cisz, size_t nci)
{
switch (mode) {
case NILFS_CHECKPOINT:
Expand Down
4 changes: 2 additions & 2 deletions fs/nilfs2/cpfile.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ int nilfs_cpfile_delete_checkpoint(struct inode *, __u64);
int nilfs_cpfile_change_cpmode(struct inode *, __u64, int);
int nilfs_cpfile_is_snapshot(struct inode *, __u64);
int nilfs_cpfile_get_stat(struct inode *, struct nilfs_cpstat *);
ssize_t nilfs_cpfile_get_cpinfo(struct inode *, __u64 *, int, void *, unsigned,
size_t);
ssize_t nilfs_cpfile_get_cpinfo(struct inode *, __u64 *, int, void *,
unsigned int, size_t);

int nilfs_cpfile_read(struct super_block *sb, size_t cpsize,
struct nilfs_inode *raw_inode, struct inode **inodep);
Expand Down
2 changes: 1 addition & 1 deletion fs/nilfs2/dat.c
Original file line number Diff line number Diff line change
Expand Up @@ -424,7 +424,7 @@ int nilfs_dat_translate(struct inode *dat, __u64 vblocknr, sector_t *blocknrp)
return ret;
}

ssize_t nilfs_dat_get_vinfo(struct inode *dat, void *buf, unsigned visz,
ssize_t nilfs_dat_get_vinfo(struct inode *dat, void *buf, unsigned int visz,
size_t nvi)
{
struct buffer_head *entry_bh;
Expand Down
2 changes: 1 addition & 1 deletion fs/nilfs2/dat.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ void nilfs_dat_abort_update(struct inode *, struct nilfs_palloc_req *,
int nilfs_dat_mark_dirty(struct inode *, __u64);
int nilfs_dat_freev(struct inode *, __u64 *, size_t);
int nilfs_dat_move(struct inode *, __u64, sector_t);
ssize_t nilfs_dat_get_vinfo(struct inode *, void *, unsigned, size_t);
ssize_t nilfs_dat_get_vinfo(struct inode *, void *, unsigned int, size_t);

int nilfs_dat_read(struct super_block *sb, size_t entry_size,
struct nilfs_inode *raw_inode, struct inode **inodep);
Expand Down
47 changes: 24 additions & 23 deletions fs/nilfs2/dir.c
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
* nilfs uses block-sized chunks. Arguably, sector-sized ones would be
* more robust, but we have what we have
*/
static inline unsigned nilfs_chunk_size(struct inode *inode)
static inline unsigned int nilfs_chunk_size(struct inode *inode)
{
return inode->i_sb->s_blocksize;
}
Expand All @@ -61,17 +61,18 @@ static inline void nilfs_put_page(struct page *page)
* Return the offset into page `page_nr' of the last valid
* byte in that page, plus one.
*/
static unsigned nilfs_last_byte(struct inode *inode, unsigned long page_nr)
static unsigned int nilfs_last_byte(struct inode *inode, unsigned long page_nr)
{
unsigned last_byte = inode->i_size;
unsigned int last_byte = inode->i_size;

last_byte -= page_nr << PAGE_SHIFT;
if (last_byte > PAGE_SIZE)
last_byte = PAGE_SIZE;
return last_byte;
}

static int nilfs_prepare_chunk(struct page *page, unsigned from, unsigned to)
static int nilfs_prepare_chunk(struct page *page, unsigned int from,
unsigned int to)
{
loff_t pos = page_offset(page) + from;

Expand All @@ -80,12 +81,12 @@ static int nilfs_prepare_chunk(struct page *page, unsigned from, unsigned to)

static void nilfs_commit_chunk(struct page *page,
struct address_space *mapping,
unsigned from, unsigned to)
unsigned int from, unsigned int to)
{
struct inode *dir = mapping->host;
loff_t pos = page_offset(page) + from;
unsigned len = to - from;
unsigned nr_dirty, copied;
unsigned int len = to - from;
unsigned int nr_dirty, copied;
int err;

nr_dirty = nilfs_page_count_clean_buffers(page, from, to);
Expand All @@ -103,10 +104,10 @@ static bool nilfs_check_page(struct page *page)
{
struct inode *dir = page->mapping->host;
struct super_block *sb = dir->i_sb;
unsigned chunk_size = nilfs_chunk_size(dir);
unsigned int chunk_size = nilfs_chunk_size(dir);
char *kaddr = page_address(page);
unsigned offs, rec_len;
unsigned limit = PAGE_SIZE;
unsigned int offs, rec_len;
unsigned int limit = PAGE_SIZE;
struct nilfs_dir_entry *p;
char *error;

Expand Down Expand Up @@ -256,7 +257,6 @@ static int nilfs_readdir(struct file *file, struct dir_context *ctx)
unsigned int offset = pos & ~PAGE_MASK;
unsigned long n = pos >> PAGE_SHIFT;
unsigned long npages = dir_pages(inode);
/* unsigned chunk_mask = ~(nilfs_chunk_size(inode)-1); */

if (pos > inode->i_size - NILFS_DIR_REC_LEN(1))
return 0;
Expand Down Expand Up @@ -318,7 +318,7 @@ nilfs_find_entry(struct inode *dir, const struct qstr *qstr,
{
const unsigned char *name = qstr->name;
int namelen = qstr->len;
unsigned reclen = NILFS_DIR_REC_LEN(namelen);
unsigned int reclen = NILFS_DIR_REC_LEN(namelen);
unsigned long start, n;
unsigned long npages = dir_pages(dir);
struct page *page = NULL;
Expand Down Expand Up @@ -408,8 +408,8 @@ ino_t nilfs_inode_by_name(struct inode *dir, const struct qstr *qstr)
void nilfs_set_link(struct inode *dir, struct nilfs_dir_entry *de,
struct page *page, struct inode *inode)
{
unsigned from = (char *) de - (char *) page_address(page);
unsigned to = from + nilfs_rec_len_from_disk(de->rec_len);
unsigned int from = (char *)de - (char *)page_address(page);
unsigned int to = from + nilfs_rec_len_from_disk(de->rec_len);
struct address_space *mapping = page->mapping;
int err;

Expand All @@ -431,15 +431,15 @@ int nilfs_add_link(struct dentry *dentry, struct inode *inode)
struct inode *dir = d_inode(dentry->d_parent);
const unsigned char *name = dentry->d_name.name;
int namelen = dentry->d_name.len;
unsigned chunk_size = nilfs_chunk_size(dir);
unsigned reclen = NILFS_DIR_REC_LEN(namelen);
unsigned int chunk_size = nilfs_chunk_size(dir);
unsigned int reclen = NILFS_DIR_REC_LEN(namelen);
unsigned short rec_len, name_len;
struct page *page = NULL;
struct nilfs_dir_entry *de;
unsigned long npages = dir_pages(dir);
unsigned long n;
char *kaddr;
unsigned from, to;
unsigned int from, to;
int err;

/*
Expand Down Expand Up @@ -531,13 +531,14 @@ int nilfs_delete_entry(struct nilfs_dir_entry *dir, struct page *page)
struct address_space *mapping = page->mapping;
struct inode *inode = mapping->host;
char *kaddr = page_address(page);
unsigned from = ((char *)dir - kaddr) & ~(nilfs_chunk_size(inode) - 1);
unsigned to = ((char *)dir - kaddr) +
nilfs_rec_len_from_disk(dir->rec_len);
struct nilfs_dir_entry *pde = NULL;
struct nilfs_dir_entry *de = (struct nilfs_dir_entry *)(kaddr + from);
unsigned int from, to;
struct nilfs_dir_entry *de, *pde = NULL;
int err;

from = ((char *)dir - kaddr) & ~(nilfs_chunk_size(inode) - 1);
to = ((char *)dir - kaddr) + nilfs_rec_len_from_disk(dir->rec_len);
de = (struct nilfs_dir_entry *)(kaddr + from);

while ((char *)de < (char *)dir) {
if (de->rec_len == 0) {
nilfs_error(inode->i_sb, __func__,
Expand Down Expand Up @@ -570,7 +571,7 @@ int nilfs_make_empty(struct inode *inode, struct inode *parent)
{
struct address_space *mapping = inode->i_mapping;
struct page *page = grab_cache_page(mapping, 0);
unsigned chunk_size = nilfs_chunk_size(inode);
unsigned int chunk_size = nilfs_chunk_size(inode);
struct nilfs_dir_entry *de;
int err;
void *kaddr;
Expand Down
5 changes: 3 additions & 2 deletions fs/nilfs2/direct.c
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ static int nilfs_direct_lookup(const struct nilfs_bmap *direct,

static int nilfs_direct_lookup_contig(const struct nilfs_bmap *direct,
__u64 key, __u64 *ptrp,
unsigned maxblocks)
unsigned int maxblocks)
{
struct inode *dat = NULL;
__u64 ptr, ptr2;
Expand All @@ -79,7 +79,8 @@ static int nilfs_direct_lookup_contig(const struct nilfs_bmap *direct,
ptr = blocknr;
}

maxblocks = min_t(unsigned, maxblocks, NILFS_DIRECT_KEY_MAX - key + 1);
maxblocks = min_t(unsigned int, maxblocks,
NILFS_DIRECT_KEY_MAX - key + 1);
for (cnt = 1; cnt < maxblocks &&
(ptr2 = nilfs_direct_get_ptr(direct, key + cnt)) !=
NILFS_BMAP_INVALID_PTR;
Expand Down
14 changes: 7 additions & 7 deletions fs/nilfs2/inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ int nilfs_get_block(struct inode *inode, sector_t blkoff,
struct the_nilfs *nilfs = inode->i_sb->s_fs_info;
__u64 blknum = 0;
int err = 0, ret;
unsigned maxblocks = bh_result->b_size >> inode->i_blkbits;
unsigned int maxblocks = bh_result->b_size >> inode->i_blkbits;

down_read(&NILFS_MDT(nilfs->ns_dat)->mi_sem);
ret = nilfs_bmap_lookup_contig(ii->i_bmap, blkoff, &blknum, maxblocks);
Expand Down Expand Up @@ -163,7 +163,7 @@ static int nilfs_readpage(struct file *file, struct page *page)
* @nr_pages - number of pages to be read
*/
static int nilfs_readpages(struct file *file, struct address_space *mapping,
struct list_head *pages, unsigned nr_pages)
struct list_head *pages, unsigned int nr_pages)
{
return mpage_readpages(mapping, pages, nr_pages, nilfs_get_block);
}
Expand Down Expand Up @@ -222,7 +222,7 @@ static int nilfs_set_page_dirty(struct page *page)
int ret = __set_page_dirty_nobuffers(page);

if (page_has_buffers(page)) {
unsigned nr_dirty = 0;
unsigned int nr_dirty = 0;
struct buffer_head *bh, *head;

/*
Expand All @@ -245,7 +245,7 @@ static int nilfs_set_page_dirty(struct page *page)
if (nr_dirty)
nilfs_set_file_dirty(inode, nr_dirty);
} else if (ret) {
unsigned nr_dirty = 1 << (PAGE_SHIFT - inode->i_blkbits);
unsigned int nr_dirty = 1 << (PAGE_SHIFT - inode->i_blkbits);

nilfs_set_file_dirty(inode, nr_dirty);
}
Expand Down Expand Up @@ -287,8 +287,8 @@ static int nilfs_write_end(struct file *file, struct address_space *mapping,
struct page *page, void *fsdata)
{
struct inode *inode = mapping->host;
unsigned start = pos & (PAGE_SIZE - 1);
unsigned nr_dirty;
unsigned int start = pos & (PAGE_SIZE - 1);
unsigned int nr_dirty;
int err;

nr_dirty = nilfs_page_count_clean_buffers(page, start,
Expand Down Expand Up @@ -902,7 +902,7 @@ int nilfs_inode_dirty(struct inode *inode)
return ret;
}

int nilfs_set_file_dirty(struct inode *inode, unsigned nr_dirty)
int nilfs_set_file_dirty(struct inode *inode, unsigned int nr_dirty)
{
struct nilfs_inode_info *ii = NILFS_I(inode);
struct the_nilfs *nilfs = inode->i_sb->s_fs_info;
Expand Down
4 changes: 2 additions & 2 deletions fs/nilfs2/mdt.c
Original file line number Diff line number Diff line change
Expand Up @@ -490,8 +490,8 @@ void nilfs_mdt_destroy(struct inode *inode)
kfree(mdi);
}

void nilfs_mdt_set_entry_size(struct inode *inode, unsigned entry_size,
unsigned header_size)
void nilfs_mdt_set_entry_size(struct inode *inode, unsigned int entry_size,
unsigned int header_size)
{
struct nilfs_mdt_info *mi = NILFS_MDT(inode);

Expand Down
6 changes: 3 additions & 3 deletions fs/nilfs2/mdt.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ struct nilfs_shadow_map {
struct nilfs_mdt_info {
struct rw_semaphore mi_sem;
struct blockgroup_lock *mi_bgl;
unsigned mi_entry_size;
unsigned mi_first_entry_offset;
unsigned int mi_entry_size;
unsigned int mi_first_entry_offset;
unsigned long mi_entries_per_block;
struct nilfs_palloc_cache *mi_palloc_cache;
struct nilfs_shadow_map *mi_shadow;
Expand Down Expand Up @@ -90,7 +90,7 @@ int nilfs_mdt_init(struct inode *inode, gfp_t gfp_mask, size_t objsz);
void nilfs_mdt_clear(struct inode *inode);
void nilfs_mdt_destroy(struct inode *inode);

void nilfs_mdt_set_entry_size(struct inode *, unsigned, unsigned);
void nilfs_mdt_set_entry_size(struct inode *, unsigned int, unsigned int);

int nilfs_mdt_setup_shadow_map(struct inode *inode,
struct nilfs_shadow_map *shadow);
Expand Down
2 changes: 1 addition & 1 deletion fs/nilfs2/namei.c
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ static int nilfs_symlink(struct inode *dir, struct dentry *dentry,
{
struct nilfs_transaction_info ti;
struct super_block *sb = dir->i_sb;
unsigned l = strlen(symname)+1;
unsigned int l = strlen(symname) + 1;
struct inode *inode;
int err;

Expand Down
2 changes: 1 addition & 1 deletion fs/nilfs2/nilfs.h
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ extern void nilfs_write_failed(struct address_space *mapping, loff_t to);
int nilfs_permission(struct inode *inode, int mask);
int nilfs_load_inode_block(struct inode *inode, struct buffer_head **pbh);
extern int nilfs_inode_dirty(struct inode *);
int nilfs_set_file_dirty(struct inode *inode, unsigned nr_dirty);
int nilfs_set_file_dirty(struct inode *inode, unsigned int nr_dirty);
extern int __nilfs_mark_inode_dirty(struct inode *, int);
extern void nilfs_dirty_inode(struct inode *, int flags);
int nilfs_fiemap(struct inode *inode, struct fiemap_extent_info *fieinfo,
Expand Down
Loading

0 comments on commit 0c6c44c

Please sign in to comment.