tree-wide: port various pieces of code over to ROUND_UP()

There's probably more than we can convert to this.
This commit is contained in:
Lennart Poettering
2023-06-02 16:43:39 +02:00
parent beda8529b9
commit 4dcaab9c89
3 changed files with 3 additions and 3 deletions
+1 -1
View File
@@ -770,7 +770,7 @@ int unlinkat_deallocate(int fd, const char *name, UnlinkDeallocateFlags flags) {
* punch-hole/truncate this to release the disk space. */
bs = MAX(st.st_blksize, 512);
l = DIV_ROUND_UP(st.st_size, bs) * bs; /* Round up to next block size */
l = ROUND_UP(st.st_size, bs); /* Round up to next block size */
if (fallocate(truncate_fd, FALLOC_FL_PUNCH_HOLE|FALLOC_FL_KEEP_SIZE, 0, l) >= 0)
return 0; /* Successfully punched a hole! 😊 */
+1 -1
View File
@@ -688,7 +688,7 @@ static int journal_file_allocate(JournalFile *f, uint64_t offset, uint64_t size)
}
/* Increase by larger blocks at once */
new_size = DIV_ROUND_UP(new_size, FILE_SIZE_INCREASE) * FILE_SIZE_INCREASE;
new_size = ROUND_UP(new_size, FILE_SIZE_INCREASE);
if (f->metrics.max_size > 0 && new_size > f->metrics.max_size)
new_size = f->metrics.max_size;
+1 -1
View File
@@ -1151,7 +1151,7 @@ static int find_matching_component(
} else if (c->repeat > 0) {
int k;
k = start + c->repeat * DIV_ROUND_UP(*val - start, c->repeat);
k = start + ROUND_UP(*val - start, c->repeat);
if ((!d_set || k < d) && (stop < 0 || k <= stop)) {
d = k;