struct xfs_trans *tp;
char *p;
unsigned long long nextents = 0;
- unsigned long long dirty_bytes = 60U << 20; /* 60MiB */
+ unsigned long long dirty_bytes = MEGABYTES(60);
unsigned long long dirty_blocks;
unsigned int resblks;
bool estimate = false;
return i;
}
-#define EXABYTES(x) ((long long)(x) << 60)
-#define PETABYTES(x) ((long long)(x) << 50)
-#define TERABYTES(x) ((long long)(x) << 40)
-#define GIGABYTES(x) ((long long)(x) << 30)
-#define MEGABYTES(x) ((long long)(x) << 20)
-#define KILOBYTES(x) ((long long)(x) << 10)
-
long long
cvtnum(
size_t blksize,
extern gid_t gid_from_string(char *group);
extern prid_t prid_from_string(char *project);
+#define EXABYTES(x) ((unsigned long long)(x) << 60)
+#define PETABYTES(x) ((unsigned long long)(x) << 50)
+#define TERABYTES(x) ((unsigned long long)(x) << 40)
+#define GIGABYTES(x) ((unsigned long long)(x) << 30)
+#define MEGABYTES(x) ((unsigned long long)(x) << 20)
+#define KILOBYTES(x) ((unsigned long long)(x) << 10)
+
#endif /* __LIBFROG_CONVERT_H__ */
#include "xfs_metadump.h"
#include <libfrog/platform.h>
#include "libfrog/div64.h"
+#include "libfrog/convert.h"
union mdrestore_headers {
__be32 magic;
if (!mdrestore.show_progress)
goto done;
- if (bytes_read <= (*cursor << 20))
+ if (bytes_read <= MEGABYTES(*cursor))
goto done;
- print_progress("%lld MB read", howmany_64(bytes_read, 1U << 20));
+ print_progress("%lld MB read", howmany_64(bytes_read, MEGABYTES(1)));
done:
if (mdrestore.progress_since_warning)
#include "libfrog/dahashselftest.h"
#include "libfrog/fsproperties.h"
#include "libfrog/zones.h"
+#include "libfrog/convert.h"
#include "proto.h"
#include <ini.h>
.conflicts = { { NULL, LAST_CONFLICT } },
.convert = true,
.minval = 1,
- .maxval = 1ULL << 30, /* 1GiB */
+ .maxval = GIGABYTES(1),
.defaultval = SUBOPT_NEEDS_VAL,
},
},
{
uint64_t offset = 0;
/* Discard the device 2G at a time */
- const uint64_t step = 2ULL << 30;
+ const uint64_t step = GIGABYTES(2);
const uint64_t count = BBTOB(nsectors);
/*
#include <libxfs.h>
#include "err_protos.h"
#include "libfrog/bitmap.h"
+#include "libfrog/convert.h"
#include "slab.h"
#include "rmap.h"
#include "incore.h"
memset(btr, 0, sizeof(struct bt_rebuild));
bulkload_init_ag(&btr->newbt, sc, oinfo, NULLFSBLOCK);
- btr->bload.max_dirty = XFS_B_TO_FSBT(sc->mp, 256U << 10); /* 256K */
+ btr->bload.max_dirty = XFS_B_TO_FSBT(sc->mp, KILOBYTES(256));
bulkload_estimate_ag_slack(sc, &btr->bload, est_agfreeblocks);
}
#include "bulkload.h"
#include "bmap_repair.h"
#include "libfrog/util.h"
+#include "libfrog/convert.h"
/*
* Inode Fork Block Mapping (BMBT) Repair
rb->bmap_bload.get_records = xrep_bmap_get_records;
rb->bmap_bload.claim_block = xrep_bmap_claim_block;
rb->bmap_bload.iroot_size = xrep_bmap_iroot_size;
- rb->bmap_bload.max_dirty = XFS_B_TO_FSBT(sc->mp, 256U << 10); /* 256K */
+ rb->bmap_bload.max_dirty = XFS_B_TO_FSBT(sc->mp, KILOBYTES(256));
/*
* Always make the btree as small as possible, since we might need the
#include "quotacheck.h"
#include "rcbag_btree.h"
#include "rt.h"
+#include "libfrog/convert.h"
/*
* option tables for getsubopt calls
}
max_mem -= mem_used;
- if (max_mem >= (1 << 30))
- max_mem = 1 << 30;
+ if (max_mem >= GIGABYTES(1))
+ max_mem = GIGABYTES(1);
libxfs_bhash_size = max_mem / (HASH_CACHE_RATIO *
(igeo->inode_cluster_size >> 10));
if (libxfs_bhash_size < 512)
#include "libfrog/paths.h"
#include "libfrog/getparents.h"
#include "libfrog/handle_priv.h"
+#include "libfrog/convert.h"
#include "xfs_scrub.h"
#include "common.h"
#include "progress.h"
{
if (debug > 1)
goto no_prefix;
- if (bytes > (1ULL << 40)) {
+ if (bytes > TERABYTES(1)) {
*units = "TiB";
- return (double)bytes / (1ULL << 40);
- } else if (bytes > (1ULL << 30)) {
+ return (double)bytes / TERABYTES(1);
+ } else if (bytes > GIGABYTES(1)) {
*units = "GiB";
- return (double)bytes / (1ULL << 30);
- } else if (bytes > (1ULL << 20)) {
+ return (double)bytes / GIGABYTES(1);
+ } else if (bytes > MEGABYTES(1)) {
*units = "MiB";
- return (double)bytes / (1ULL << 20);
- } else if (bytes > (1ULL << 10)) {
+ return (double)bytes / MEGABYTES(1);
+ } else if (bytes > KILOBYTES(1)) {
*units = "KiB";
- return (double)bytes / (1ULL << 10);
+ return (double)bytes / KILOBYTES(1);
}
no_prefix:
#include "libfrog/paths.h"
#include "libfrog/workqueue.h"
#include "libfrog/histogram.h"
+#include "libfrog/convert.h"
#include "xfs_scrub.h"
#include "common.h"
#include "progress.h"
* call so that we can implement decent progress reporting and CPU resource
* control. Pick a prime number of gigabytes for interest.
*/
-#define FSTRIM_MAX_BYTES (11ULL << 30)
+#define FSTRIM_MAX_BYTES GIGABYTES(11)
/* Trim a certain range of the filesystem. */
static int