Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
linux
Commits
3ea2b1e1
Commit
3ea2b1e1
authored
Apr 12, 2019
by
Kent Overstreet
Committed by
Kent Overstreet
Oct 22, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bcachefs: cmp_int()
Signed-off-by:
Kent Overstreet
<
kent.overstreet@linux.dev
>
parent
a0e0bda1
Changes
12
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
20 additions
and
18 deletions
+20
-18
fs/bcachefs/alloc_background.c
fs/bcachefs/alloc_background.c
+4
-4
fs/bcachefs/bkey.c
fs/bcachefs/bkey.c
+1
-1
fs/bcachefs/bkey.h
fs/bcachefs/bkey.h
+2
-2
fs/bcachefs/bset.h
fs/bcachefs/bset.h
+1
-1
fs/bcachefs/btree_update_leaf.c
fs/bcachefs/btree_update_leaf.c
+1
-1
fs/bcachefs/ec.c
fs/bcachefs/ec.c
+1
-1
fs/bcachefs/fs.h
fs/bcachefs/fs.h
+1
-1
fs/bcachefs/journal_seq_blacklist.c
fs/bcachefs/journal_seq_blacklist.c
+1
-1
fs/bcachefs/movinggc.c
fs/bcachefs/movinggc.c
+2
-2
fs/bcachefs/replicas.c
fs/bcachefs/replicas.c
+1
-1
fs/bcachefs/sysfs.c
fs/bcachefs/sysfs.c
+3
-3
fs/bcachefs/util.h
fs/bcachefs/util.h
+2
-0
No files found.
fs/bcachefs/alloc_background.c
View file @
3ea2b1e1
...
...
@@ -687,16 +687,16 @@ static inline int bucket_alloc_cmp(alloc_heap *h,
struct
alloc_heap_entry
l
,
struct
alloc_heap_entry
r
)
{
return
(
l
.
key
>
r
.
key
)
-
(
l
.
key
<
r
.
key
)
?:
(
l
.
nr
<
r
.
nr
)
-
(
l
.
nr
>
r
.
nr
)
?:
(
l
.
bucket
>
r
.
bucket
)
-
(
l
.
bucket
<
r
.
bucket
);
return
cmp_int
(
l
.
key
,
r
.
key
)
?:
cmp_int
(
r
.
nr
,
l
.
nr
)
?:
cmp_int
(
l
.
bucket
,
r
.
bucket
);
}
static
inline
int
bucket_idx_cmp
(
const
void
*
_l
,
const
void
*
_r
)
{
const
struct
alloc_heap_entry
*
l
=
_l
,
*
r
=
_r
;
return
(
l
->
bucket
>
r
->
bucket
)
-
(
l
->
bucket
<
r
->
bucket
);
return
cmp_int
(
l
->
bucket
,
r
->
bucket
);
}
static
void
find_reclaimable_buckets_lru
(
struct
bch_fs
*
c
,
struct
bch_dev
*
ca
)
...
...
fs/bcachefs/bkey.c
View file @
3ea2b1e1
...
...
@@ -1024,7 +1024,7 @@ static inline int __bkey_cmp_bits(const u64 *l, const u64 *r,
r_v
=
*
r
;
}
return
(
l_v
>
r_v
)
-
(
l_v
<
r_v
);
return
cmp_int
(
l_v
,
r_v
);
}
#endif
...
...
fs/bcachefs/bkey.h
View file @
3ea2b1e1
...
...
@@ -217,8 +217,8 @@ void bch2_bkey_swab_key(const struct bkey_format *, struct bkey_packed *);
static
__always_inline
int
bversion_cmp
(
struct
bversion
l
,
struct
bversion
r
)
{
return
(
l
.
hi
>
r
.
hi
)
-
(
l
.
hi
<
r
.
hi
)
?:
(
l
.
lo
>
r
.
lo
)
-
(
l
.
lo
<
r
.
lo
);
return
cmp_int
(
l
.
hi
,
r
.
hi
)
?:
cmp_int
(
l
.
lo
,
r
.
lo
);
}
#define ZERO_VERSION ((struct bversion) { .hi = 0, .lo = 0 })
...
...
fs/bcachefs/bset.h
View file @
3ea2b1e1
...
...
@@ -465,7 +465,7 @@ static inline int bkey_iter_cmp(struct btree *b,
{
return
bkey_cmp_packed
(
b
,
l
,
r
)
?:
(
int
)
bkey_deleted
(
r
)
-
(
int
)
bkey_deleted
(
l
)
?:
(
l
>
r
)
-
(
l
<
r
);
?:
cmp_int
(
l
,
r
);
}
static
inline
int
btree_node_iter_cmp
(
struct
btree
*
b
,
...
...
fs/bcachefs/btree_update_leaf.c
View file @
3ea2b1e1
...
...
@@ -55,7 +55,7 @@ static void btree_trans_unlock_write(struct btree_trans *trans)
static
inline
int
btree_trans_cmp
(
struct
btree_insert_entry
l
,
struct
btree_insert_entry
r
)
{
return
(
l
.
deferred
>
r
.
deferred
)
-
(
l
.
deferred
<
r
.
deferred
)
?:
return
cmp_int
(
l
.
deferred
,
r
.
deferred
)
?:
btree_iter_cmp
(
l
.
iter
,
r
.
iter
);
}
...
...
fs/bcachefs/ec.c
View file @
3ea2b1e1
...
...
@@ -951,7 +951,7 @@ static int unsigned_cmp(const void *_l, const void *_r)
unsigned
l
=
*
((
const
unsigned
*
)
_l
);
unsigned
r
=
*
((
const
unsigned
*
)
_r
);
return
(
l
>
r
)
-
(
l
<
r
);
return
cmp_int
(
l
,
r
);
}
/* pick most common bucket size: */
...
...
fs/bcachefs/fs.h
View file @
3ea2b1e1
...
...
@@ -54,7 +54,7 @@ struct bch_inode_info {
static
inline
int
ptrcmp
(
void
*
l
,
void
*
r
)
{
return
(
l
>
r
)
-
(
l
<
r
);
return
cmp_int
(
l
,
r
);
}
#define __bch2_lock_inodes(_lock, ...) \
...
...
fs/bcachefs/journal_seq_blacklist.c
View file @
3ea2b1e1
...
...
@@ -136,7 +136,7 @@ static int journal_seq_blacklist_table_cmp(const void *_l,
const
struct
journal_seq_blacklist_table_entry
*
l
=
_l
;
const
struct
journal_seq_blacklist_table_entry
*
r
=
_r
;
return
(
l
->
start
>
r
->
start
)
-
(
l
->
start
<
r
->
start
);
return
cmp_int
(
l
->
start
,
r
->
start
);
}
bool
bch2_journal_seq_is_blacklisted
(
struct
bch_fs
*
c
,
u64
seq
,
...
...
fs/bcachefs/movinggc.c
View file @
3ea2b1e1
...
...
@@ -54,7 +54,7 @@ static inline int sectors_used_cmp(copygc_heap *heap,
struct
copygc_heap_entry
l
,
struct
copygc_heap_entry
r
)
{
return
(
l
.
sectors
>
r
.
sectors
)
-
(
l
.
sectors
<
r
.
sectors
);
return
cmp_int
(
l
.
sectors
,
r
.
sectors
);
}
static
int
bucket_offset_cmp
(
const
void
*
_l
,
const
void
*
_r
,
size_t
size
)
...
...
@@ -62,7 +62,7 @@ static int bucket_offset_cmp(const void *_l, const void *_r, size_t size)
const
struct
copygc_heap_entry
*
l
=
_l
;
const
struct
copygc_heap_entry
*
r
=
_r
;
return
(
l
->
offset
>
r
->
offset
)
-
(
l
->
offset
<
r
->
offset
);
return
cmp_int
(
l
->
offset
,
r
->
offset
);
}
static
bool
__copygc_pred
(
struct
bch_dev
*
ca
,
...
...
fs/bcachefs/replicas.c
View file @
3ea2b1e1
...
...
@@ -12,7 +12,7 @@ static int bch2_cpu_replicas_to_sb_replicas(struct bch_fs *,
static
inline
int
u8_cmp
(
u8
l
,
u8
r
)
{
return
(
l
>
r
)
-
(
l
<
r
);
return
cmp_int
(
l
,
r
);
}
static
void
verify_replicas_entry_sorted
(
struct
bch_replicas_entry
*
e
)
...
...
fs/bcachefs/sysfs.c
View file @
3ea2b1e1
...
...
@@ -751,10 +751,10 @@ static unsigned bucket_oldest_gen_fn(struct bch_fs *c, struct bch_dev *ca,
static
int
unsigned_cmp
(
const
void
*
_l
,
const
void
*
_r
)
{
unsigned
l
=
*
((
unsigned
*
)
_l
)
;
unsigned
r
=
*
((
unsigned
*
)
_r
)
;
const
unsigned
*
l
=
_l
;
const
unsigned
*
r
=
_r
;
return
(
l
>
r
)
-
(
l
<
r
);
return
cmp_int
(
*
l
,
*
r
);
}
static
ssize_t
show_quantiles
(
struct
bch_fs
*
c
,
struct
bch_dev
*
ca
,
...
...
fs/bcachefs/util.h
View file @
3ea2b1e1
...
...
@@ -743,4 +743,6 @@ static inline void acc_u64s_percpu(u64 *acc, const u64 __percpu *src,
u64
*
bch2_acc_percpu_u64s
(
u64
__percpu
*
,
unsigned
);
#define cmp_int(l, r) ((l > r) - (l < r))
#endif
/* _BCACHEFS_UTIL_H */
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment