summaryrefslogtreecommitdiff
path: root/fs/ntfs3/bitmap.c
diff options
context:
space:
mode:
authorKari Argillander <kari.argillander@gmail.com>2021-09-07 17:28:42 +0300
committerKonstantin Komarov <almaz.alexandrovich@paragon-software.com>2021-09-16 17:01:37 +0300
commit6e3331ee34461be37f50912295a2e924a673dbc6 (patch)
tree4e38e7bbcf3cd099ebdfb6b1e546c82f9eeef6b9 /fs/ntfs3/bitmap.c
parentb5322eb1ae94572f5a52e804857e641b846059f4 (diff)
downloadlinux-rpi-6e3331ee34461be37f50912295a2e924a673dbc6.tar.gz
linux-rpi-6e3331ee34461be37f50912295a2e924a673dbc6.tar.bz2
linux-rpi-6e3331ee34461be37f50912295a2e924a673dbc6.zip
fs/ntfs3: Use min/max macros instated of ternary operators
We can make code little bit more readable by using min/max macros. These were found with Coccinelle. Signed-off-by: Kari Argillander <kari.argillander@gmail.com> Signed-off-by: Konstantin Komarov <almaz.alexandrovich@paragon-software.com>
Diffstat (limited to 'fs/ntfs3/bitmap.c')
-rw-r--r--fs/ntfs3/bitmap.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/fs/ntfs3/bitmap.c b/fs/ntfs3/bitmap.c
index a03584674fea..aa184407520f 100644
--- a/fs/ntfs3/bitmap.c
+++ b/fs/ntfs3/bitmap.c
@@ -12,6 +12,7 @@
#include <linux/buffer_head.h>
#include <linux/fs.h>
+#include <linux/kernel.h>
#include "ntfs.h"
#include "ntfs_fs.h"
@@ -432,7 +433,7 @@ static void wnd_remove_free_ext(struct wnd_bitmap *wnd, size_t bit, size_t len)
;
} else {
n3 = rb_next(&e->count.node);
- max_new_len = len > new_len ? len : new_len;
+ max_new_len = max(len, new_len);
if (!n3) {
wnd->extent_max = max_new_len;
} else {
@@ -728,7 +729,7 @@ int wnd_set_free(struct wnd_bitmap *wnd, size_t bit, size_t bits)
wbits = wnd->bits_last;
tail = wbits - wbit;
- op = tail < bits ? tail : bits;
+ op = min_t(u32, tail, bits);
bh = wnd_map(wnd, iw);
if (IS_ERR(bh)) {
@@ -781,7 +782,7 @@ int wnd_set_used(struct wnd_bitmap *wnd, size_t bit, size_t bits)
wbits = wnd->bits_last;
tail = wbits - wbit;
- op = tail < bits ? tail : bits;
+ op = min_t(u32, tail, bits);
bh = wnd_map(wnd, iw);
if (IS_ERR(bh)) {
@@ -831,7 +832,7 @@ static bool wnd_is_free_hlp(struct wnd_bitmap *wnd, size_t bit, size_t bits)
wbits = wnd->bits_last;
tail = wbits - wbit;
- op = tail < bits ? tail : bits;
+ op = min_t(u32, tail, bits);
if (wbits != wnd->free_bits[iw]) {
bool ret;
@@ -923,7 +924,7 @@ use_wnd:
wbits = wnd->bits_last;
tail = wbits - wbit;
- op = tail < bits ? tail : bits;
+ op = min_t(u32, tail, bits);
if (wnd->free_bits[iw]) {
bool ret;