diff options
author | Kent Overstreet <kent.overstreet@gmail.com> | 2016-06-08 01:53:50 -0800 |
---|---|---|
committer | Kent Overstreet <kent.overstreet@gmail.com> | 2017-01-18 21:39:39 -0900 |
commit | 7b1ab8e6352a34c7a299bfa1ce13a9d9e4108ea8 (patch) | |
tree | 1b8fb8d4adecee6bd8079a851463bc18ffa08570 | |
parent | 901e4ccdfad38cc657e4d1cd43321ff59edfbf15 (diff) |
bcache: Add an option to limit inode numbers to 32 bits
-rw-r--r-- | drivers/md/bcache/inode.c | 10 | ||||
-rw-r--r-- | include/uapi/linux/bcache.h | 7 |
2 files changed, 15 insertions, 2 deletions
diff --git a/drivers/md/bcache/inode.c b/drivers/md/bcache/inode.c index 72a3c1e64349..29fb04913bac 100644 --- a/drivers/md/bcache/inode.c +++ b/drivers/md/bcache/inode.c @@ -116,7 +116,13 @@ int bch_inode_create(struct cache_set *c, struct bkey_i *inode, bool searched_from_start = false; int ret; - if ((max && *hint >= max) || *hint < min) + if (!max) + max = ULLONG_MAX; + + if (c->opts.inodes_32bit) + max = min_t(u64, max, U32_MAX); + + if (*hint >= max || *hint < min) *hint = min; if (*hint == min) @@ -125,7 +131,7 @@ again: bch_btree_iter_init_intent(&iter, c, BTREE_ID_INODES, POS(*hint, 0)); while ((k = bch_btree_iter_peek_with_holes(&iter)).k) { - if (max && k.k->p.inode >= max) + if (k.k->p.inode >= max) break; if (k.k->type < BCH_INODE_FS) { diff --git a/include/uapi/linux/bcache.h b/include/uapi/linux/bcache.h index 1019f125f880..bce0838f7760 100644 --- a/include/uapi/linux/bcache.h +++ b/include/uapi/linux/bcache.h @@ -779,6 +779,9 @@ enum { #define BCH_COMPRESSION_NR 3U +/* Limit inode numbers to 32 bits: */ +LE64_BITMASK(CACHE_INODE_32BIT, struct cache_sb, flags, 56, 57); + /* options: */ /** @@ -836,6 +839,10 @@ enum { BCH_STR_HASH_NR, \ CACHE_SET_STR_HASH_TYPE, \ true) \ + CACHE_SET_OPT(inodes_32bit, \ + bch_bool_opt, 2, \ + CACHE_INODE_32BIT, \ + true) \ /* backing device specific stuff: */ |