Skip to contentSkip to conversation

Btrfs: coding style fixes

PATCH In review Seraphime Kirkovski 2 participants 2 messages Dec 15, 2016 – Dec 20, 2016 Btrfs file system

lore
Share & tools
lore
#0 lore raw

PATCH 2/4 Btrfs: coding style fixes

This eliminates the rare uses of unsigned instead of unsigned int.

---
 fs/btrfs/dir-item.c         |  6 ++---
 fs/btrfs/extent-tree.c      | 20 ++++++++---------
 fs/btrfs/extent_io.c        | 55 +++++++++++++++++++++++----------------------
 fs/btrfs/free-space-cache.c |  4 ++--
 fs/btrfs/inode.c            | 12 +++++-----
 fs/btrfs/send.c             |  6 ++---
 fs/btrfs/super.c            |  4 ++--
 fs/btrfs/volumes.c          |  6 ++---
 8 files changed, 57 insertions(+), 56 deletions(-)
fs/btrfs/dir-item.c +3 -3
index ae496fd..2d68c17 100644
@@ -466,7 +466,7 @@ int verify_dir_item(struct btrfs_root *root,
 
 	if (btrfs_dir_name_len(leaf, dir_item) > namelen) {
 		btrfs_crit(root->fs_info, "invalid dir item name len: %u",
-		       (unsigned)btrfs_dir_data_len(leaf, dir_item));
+		       (unsigned int)btrfs_dir_data_len(leaf, dir_item));
 		return 1;
 	}
 
@@ -475,8 +475,8 @@ int verify_dir_item(struct btrfs_root *root,
 	     btrfs_dir_name_len(leaf, dir_item)) > BTRFS_MAX_XATTR_SIZE(root)) {
 		btrfs_crit(root->fs_info,
 			   "invalid dir item name + data len: %u + %u",
-			   (unsigned)btrfs_dir_name_len(leaf, dir_item),
-			   (unsigned)btrfs_dir_data_len(leaf, dir_item));
+			   (unsigned int)btrfs_dir_name_len(leaf, dir_item),
+			   (unsigned int)btrfs_dir_data_len(leaf, dir_item));
 		return 1;
 	}
 
fs/btrfs/extent-tree.c +10 -10
index e5c19d9..cc82eae 100644
@@ -4106,7 +4106,7 @@ static u64 btrfs_reduce_alloc_profile(struct btrfs_root *root, u64 flags)
 
 static u64 get_alloc_profile(struct btrfs_root *root, u64 orig_flags)
 {
-	unsigned seq;
+	unsigned int seq;
 	u64 flags;
 
 	do {
@@ -5863,13 +5863,13 @@ void btrfs_subvolume_release_metadata(struct btrfs_root *root,
  * reserved extents that need to be freed.  This must be called with
  * BTRFS_I(inode)->lock held.
  */
-static unsigned drop_outstanding_extent(struct inode *inode, u64 num_bytes)
+static unsigned int drop_outstanding_extent(struct inode *inode, u64 num_bytes)
 {
-	unsigned drop_inode_space = 0;
-	unsigned dropped_extents = 0;
-	unsigned num_extents = 0;
+	unsigned int drop_inode_space = 0;
+	unsigned int dropped_extents = 0;
+	unsigned int num_extents = 0;
 
-	num_extents = (unsigned)div64_u64(num_bytes +
+	num_extents = (unsigned int)div64_u64(num_bytes +
 					  BTRFS_MAX_EXTENT_SIZE - 1,
 					  BTRFS_MAX_EXTENT_SIZE);
 	ASSERT(num_extents);
@@ -5947,12 +5947,12 @@ int btrfs_delalloc_reserve_metadata(struct inode *inode, u64 num_bytes)
 	struct btrfs_block_rsv *block_rsv = &root->fs_info->delalloc_block_rsv;
 	u64 to_reserve = 0;
 	u64 csum_bytes;
-	unsigned nr_extents = 0;
+	unsigned int nr_extents = 0;
 	enum btrfs_reserve_flush_enum flush = BTRFS_RESERVE_FLUSH_ALL;
 	int ret = 0;
 	bool delalloc_lock = true;
 	u64 to_free = 0;
-	unsigned dropped;
+	unsigned int dropped;
 	bool release_extra = false;
 
 	/* If we are a free space inode we need to not flush since we will be in
@@ -5980,7 +5980,7 @@ int btrfs_delalloc_reserve_metadata(struct inode *inode, u64 num_bytes)
 	num_bytes = ALIGN(num_bytes, root->sectorsize);
 
 	spin_lock(&BTRFS_I(inode)->lock);
-	nr_extents = (unsigned)div64_u64(num_bytes +
+	nr_extents = (unsigned int)div64_u64(num_bytes +
 					 BTRFS_MAX_EXTENT_SIZE - 1,
 					 BTRFS_MAX_EXTENT_SIZE);
 	BTRFS_I(inode)->outstanding_extents += nr_extents;
@@ -6108,7 +6108,7 @@ void btrfs_delalloc_release_metadata(struct inode *inode, u64 num_bytes)
 {
 	struct btrfs_root *root = BTRFS_I(inode)->root;
 	u64 to_free = 0;
-	unsigned dropped;
+	unsigned int dropped;
 
 	num_bytes = ALIGN(num_bytes, root->sectorsize);
 	spin_lock(&BTRFS_I(inode)->lock);
fs/btrfs/extent_io.c +28 -27

209 lines not on this page · raw message

fs/btrfs/free-space-cache.c +2 -2
index 63ef463..4ed604d 100644
@@ -464,7 +464,7 @@ static void io_ctl_set_crc(struct btrfs_io_ctl *io_ctl, int index)
 {
 	u32 *tmp;
 	u32 crc = ~(u32)0;
-	unsigned offset = 0;
+	unsigned int offset = 0;
 
 	if (!io_ctl->check_crcs) {
 		io_ctl_unmap_page(io_ctl);
@@ -487,7 +487,7 @@ static int io_ctl_check_crc(struct btrfs_io_ctl *io_ctl, int index)
 {
 	u32 *tmp, val;
 	u32 crc = ~(u32)0;
-	unsigned offset = 0;
+	unsigned int offset = 0;
 
 	if (!io_ctl->check_crcs) {
 		io_ctl_map_page(io_ctl, 0);
fs/btrfs/inode.c +6 -6
index 14784a2..681ac57 100644
@@ -1785,7 +1785,7 @@ static void btrfs_set_bit_hook(struct inode *inode,
  */
 static void btrfs_clear_bit_hook(struct inode *inode,
 				 struct extent_state *state,
-				 unsigned *bits)
+				 unsigned int *bits)
 {
 	u64 len = state->end + 1 - state->start;
 	u64 num_extents = div64_u64(len + BTRFS_MAX_EXTENT_SIZE - 1,
@@ -4715,7 +4715,7 @@ int btrfs_truncate_block(struct inode *inode, loff_t from, loff_t len,
 	char *kaddr;
 	u32 blocksize = root->sectorsize;
 	pgoff_t index = from >> PAGE_SHIFT;
-	unsigned offset = from & (blocksize - 1);
+	unsigned int offset = from & (blocksize - 1);
 	struct page *page;
 	gfp_t mask = btrfs_alloc_write_mask(mapping);
 	int ret = 0;
@@ -7649,9 +7649,9 @@ static void adjust_dio_outstanding_extents(struct inode *inode,
 					   struct btrfs_dio_data *dio_data,
 					   const u64 len)
 {
-	unsigned num_extents;
+	unsigned int num_extents;
 
-	num_extents = (unsigned) div64_u64(len + BTRFS_MAX_EXTENT_SIZE - 1,
+	num_extents = (unsigned int)div64_u64(len + BTRFS_MAX_EXTENT_SIZE - 1,
 					   BTRFS_MAX_EXTENT_SIZE);
 	/*
 	 * If we have an outstanding_extents count still set then we're
@@ -8643,7 +8643,7 @@ static ssize_t check_direct_IO(struct btrfs_root *root, struct kiocb *iocb,
 {
 	int seg;
 	int i;
-	unsigned blocksize_mask = root->sectorsize - 1;
+	unsigned int blocksize_mask = root->sectorsize - 1;
 	ssize_t retval = -EINVAL;
 
 	if (offset & blocksize_mask)
@@ -8831,7 +8831,7 @@ static int btrfs_writepages(struct address_space *mapping,
 
 static int
 btrfs_readpages(struct file *file, struct address_space *mapping,
-		struct list_head *pages, unsigned nr_pages)
+		struct list_head *pages, unsigned int nr_pages)
 {
 	struct extent_io_tree *tree;
 
fs/btrfs/send.c +3 -3
index cceadff..42a6a66 100644
@@ -4604,7 +4604,7 @@ static ssize_t fill_read_buf(struct send_ctx *sctx, u64 offset, u32 len)
 	struct btrfs_key key;
 	pgoff_t index = offset >> PAGE_SHIFT;
 	pgoff_t last_index;
-	unsigned pg_offset = offset & ~PAGE_MASK;
+	unsigned int pg_offset = offset & ~PAGE_MASK;
 	ssize_t ret = 0;
 
 	key.objectid = sctx->cur_ino;
@@ -4633,7 +4633,7 @@ static ssize_t fill_read_buf(struct send_ctx *sctx, u64 offset, u32 len)
 		       last_index - index + 1);
 
 	while (index <= last_index) {
-		unsigned cur_len = min_t(unsigned, len,
+		unsigned int cur_len = min_t(unsigned int, len,
 					 PAGE_SIZE - pg_offset);
 		page = find_or_create_page(inode->i_mapping, index, GFP_KERNEL);
 		if (!page) {
@@ -6160,7 +6160,7 @@ long btrfs_ioctl_send(struct file *mnt_file, void __user *arg_)
 	u32 i;
 	u64 *clone_sources_tmp = NULL;
 	int clone_sources_to_rollback = 0;
-	unsigned alloc_size;
+	unsigned int alloc_size;
 	int sort_clone_roots = 0;
 	int index;
 
fs/btrfs/super.c +2 -2
index 5a58f8a..3e25cfe 100644
@@ -1724,7 +1724,7 @@ static int btrfs_remount(struct super_block *sb, int *flags, char *data)
 {
 	struct btrfs_fs_info *fs_info = btrfs_sb(sb);
 	struct btrfs_root *root = fs_info->tree_root;
-	unsigned old_flags = sb->s_flags;
+	unsigned int old_flags = sb->s_flags;
 	unsigned long old_opts = fs_info->mount_opt;
 	unsigned long old_compress_type = fs_info->compress_type;
 	u64 old_max_inline = fs_info->max_inline;
@@ -2087,7 +2087,7 @@ static int btrfs_statfs(struct dentry *dentry, struct kstatfs *buf)
 	u64 total_free_meta = 0;
 	int bits = dentry->d_sb->s_blocksize_bits;
 	__be32 *fsid = (__be32 *)fs_info->fsid;
-	unsigned factor = 1;
+	unsigned int factor = 1;
 	struct btrfs_block_rsv *block_rsv = &fs_info->global_block_rsv;
 	int ret;
 	u64 thresh = 0;
fs/btrfs/volumes.c +3 -3
index 9240b78..fe1cfeb 100644
@@ -1786,7 +1786,7 @@ static int btrfs_check_raid_min_devices(struct btrfs_fs_info *fs_info,
 		u64 num_devices)
 {
 	u64 all_avail;
-	unsigned seq;
+	unsigned int seq;
 	int i;
 
 	do {
@@ -3769,7 +3769,7 @@ int btrfs_balance(struct btrfs_balance_control *bctl,
 	int mixed = 0;
 	int ret;
 	u64 num_devices;
-	unsigned seq;
+	unsigned int seq;
 
 	if (btrfs_fs_closing(fs_info) ||
 	    atomic_read(&fs_info->balance_pause_req) ||
@@ -5675,7 +5675,7 @@ static int __btrfs_map_block(struct btrfs_fs_info *fs_info, int op,
 	    ((op == REQ_OP_WRITE || op == REQ_GET_READ_MIRRORS) ||
 	    mirror_num > 1)) {
 		u64 tmp;
-		unsigned rot;
+		unsigned int rot;
 
 		bbio->raid_map = (u64 *)((void *)bbio->stripes +
 				 sizeof(struct btrfs_bio_stripe) *
Signature · 1 line
2.10.2
#1 lore raw
Quoted 1 line · Seraphime Kirkovski

This eliminates the rare uses of unsigned instead of unsigned int.

As far as I'm concerned, I don't like this change. It's fine to encourage 'unsigned int' in new code, but changing the existing ones does not sound very useful to me as there's no common preference among the developers.