File tree Expand file tree Collapse file tree 2 files changed +29
-0
lines changed
Expand file tree Collapse file tree 2 files changed +29
-0
lines changed Original file line number Diff line number Diff line change @@ -494,6 +494,16 @@ uint64_t spdk_bs_get_md_len(struct spdk_blob_store *bs);
494494 */
495495uint64_t spdk_bs_get_used_md (struct spdk_blob_store * bs );
496496
497+ /**
498+ * Get the maximum growable size of blobstore. floored to GiB value, in bytes
499+ *
500+ * \param bs blobstore to query.
501+ *
502+ * \return the maximum growable size in bytes
503+ */
504+ uint64_t
505+ spdk_bs_get_max_growable_size (struct spdk_blob_store * bs );
506+
497507/**
498508 * Get the blob id.
499509 *
Original file line number Diff line number Diff line change @@ -6185,6 +6185,25 @@ spdk_bs_get_used_md(struct spdk_blob_store *bs)
61856185 return res ;
61866186}
61876187
6188+ uint64_t
6189+ spdk_bs_get_max_growable_size (struct spdk_blob_store * bs )
6190+ {
6191+ uint64_t max_used_cluster_mask , max_growable_size ;
6192+
6193+ /* Calculate max number of pages for used_cluster_mask. This is immutable.
6194+ */
6195+ max_used_cluster_mask = spdk_divide_round_up (sizeof (struct spdk_bs_md_mask ) +
6196+ spdk_divide_round_up (bs -> md_len , 8 ),
6197+ SPDK_BS_PAGE_SIZE );
6198+
6199+ /* max growable size = Total number of bits * cluster size */
6200+ max_growable_size = max_used_cluster_mask * (SPDK_BS_PAGE_SIZE - sizeof (struct spdk_bs_md_mask )) * 8 * bs -> cluster_sz ;
6201+
6202+ /* Floor to the nearest GiB, in bytes */
6203+ max_growable_size &= ~((1ULL << 30 ) - 1 );
6204+ return max_growable_size ;
6205+ }
6206+
61886207static int
61896208bs_register_md_thread (struct spdk_blob_store * bs )
61906209{
You can’t perform that action at this time.
0 commit comments