diff mbox

[4/4] Btrfs: code cleanup min/max -> min_t/max_t

Message ID 20161215133828.25791-1-kirkseraph@gmail.com (mailing list archive)
State Accepted
Headers show

Commit Message

Seraphime Kirkovski Dec. 15, 2016, 1:38 p.m. UTC
This cleans up the cases where the min/max macros were used with a cast
rather than using directly min_t/max_t.

Signed-off-by: Seraphime Kirkovski <kirkseraph@gmail.com>
---
 fs/btrfs/file-item.c | 4 ++--
 fs/btrfs/ioctl.c     | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

Comments

David Sterba Dec. 20, 2016, 4:05 p.m. UTC | #1
On Thu, Dec 15, 2016 at 02:38:28PM +0100, Seraphime Kirkovski wrote:
> This cleans up the cases where the min/max macros were used with a cast
> rather than using directly min_t/max_t.
> 
> Signed-off-by: Seraphime Kirkovski <kirkseraph@gmail.com>

Reviewed-by: David Sterba <dsterba@suse.com>

Added to cleanups branch, thanks.
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/fs/btrfs/file-item.c b/fs/btrfs/file-item.c
index 5fd5f45..7ae52cf 100644
--- a/fs/btrfs/file-item.c
+++ b/fs/btrfs/file-item.c
@@ -867,8 +867,8 @@  int btrfs_csum_file_blocks(struct btrfs_trans_handle *trans,
 		tmp = min(tmp, (next_offset - file_key.offset) >>
 					 root->fs_info->sb->s_blocksize_bits);
 
-		tmp = max((u64)1, tmp);
-		tmp = min(tmp, (u64)MAX_CSUM_ITEMS(root, csum_size));
+		tmp = max_t(u64, 1, tmp);
+		tmp = min_t(u64, tmp, MAX_CSUM_ITEMS(root, csum_size));
 		ins_size = csum_size * tmp;
 	} else {
 		ins_size = csum_size;
diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c
index 8bf0d44..fc6dc14 100644
--- a/fs/btrfs/ioctl.c
+++ b/fs/btrfs/ioctl.c
@@ -394,7 +394,7 @@  static noinline int btrfs_ioctl_fitrim(struct file *file, void __user *arg)
 		q = bdev_get_queue(device->bdev);
 		if (blk_queue_discard(q)) {
 			num_devices++;
-			minlen = min((u64)q->limits.discard_granularity,
+			minlen = min_t(u64, q->limits.discard_granularity,
 				     minlen);
 		}
 	}