summaryrefslogtreecommitdiff
path: root/fs/bcachefs/fifo.h
diff options
context:
space:
mode:
authorTim Schlueter <schlueter.tim@linux.com>2018-11-05 07:14:46 +0300
committerKent Overstreet <kent.overstreet@linux.dev>2023-10-23 00:08:11 +0300
commita420eea6890d709b7b9b33222d4fecc7a7ad9bd4 (patch)
tree612681209b6d00b2b287a523693406471eb200fc /fs/bcachefs/fifo.h
parent4628529f152782933865257796000f1f6702a9ee (diff)
downloadlinux-a420eea6890d709b7b9b33222d4fecc7a7ad9bd4.tar.xz
bcachefs: Set the last mount time using the realtime clock
This way the last mount time is actually meaningful instead of just being various times from 1970 (which happens with the monotonic clock). Also, roundup_pow_of_two() is undefined when passed in 0, so check before calling it. Signed-off-by: Tim Schlueter <schlueter.tim@linux.com> Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'fs/bcachefs/fifo.h')
-rw-r--r--fs/bcachefs/fifo.h4
1 files changed, 3 insertions, 1 deletions
diff --git a/fs/bcachefs/fifo.h b/fs/bcachefs/fifo.h
index 00d245efe72a..0cd5f1931aac 100644
--- a/fs/bcachefs/fifo.h
+++ b/fs/bcachefs/fifo.h
@@ -13,7 +13,9 @@ struct { \
#define DECLARE_FIFO(type, name) FIFO(type) name
#define fifo_buf_size(fifo) \
- (roundup_pow_of_two((fifo)->size) * sizeof((fifo)->data[0]))
+ ((fifo)->size \
+ ? roundup_pow_of_two((fifo)->size) * sizeof((fifo)->data[0]) \
+ : 0)
#define init_fifo(fifo, _size, _gfp) \
({ \