Skip to content

Commit

Permalink
printing locked space in cache blobstore
Browse files Browse the repository at this point in the history
  • Loading branch information
dmitrii committed Jan 13, 2012
1 parent 8caba11 commit ffc622f
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions storage/imager.c
Expand Up @@ -169,9 +169,10 @@ static int stat_blobstore (const char * path, blobstore * bs)
{
blobstore_meta meta;
blobstore_stat (bs, &meta);
long long size_mb = meta.blocks_limit ? (meta.blocks_limit / 2048) : (-1L); // convert sectors->MB
long long allocated_mb = meta.blocks_limit ? (meta.blocks_allocated / 2048) : 0;
long long reserved_mb = meta.blocks_limit ? ((meta.blocks_locked + meta.blocks_unlocked) / 2048) : 0;
long long size_mb = meta.blocks_limit ? (meta.blocks_limit / 2048) : (-1L); // convert sectors->MB
long long allocated_mb = meta.blocks_limit ? (meta.blocks_allocated / 2048) : 0;
long long reserved_mb = meta.blocks_limit ? ((meta.blocks_locked + meta.blocks_unlocked) / 2048) : 0;
long long locked_mb = meta.blocks_limit ? (meta.blocks_locked / 2048) : (-1L);

struct statfs fs;
if (statfs (path, &fs) == -1) {
Expand All @@ -188,6 +189,9 @@ static int stat_blobstore (const char * path, blobstore * bs)
logprintfl (EUCAINFO, " %06lldMB reserved for use (%.1f%% of limit)\n",
reserved_mb,
((double)reserved_mb/(double)size_mb)*100.0 );
logprintfl (EUCAINFO, " %06lldMB locked for use (%.1f%% of limit)\n",
locked_mb,
((double)locked_mb/(double)size_mb)*100.0 );
logprintfl (EUCAINFO, " %06lldMB allocated for use (%.1f%% of limit, %.1f%% of the file system)\n",
allocated_mb,
((double)allocated_mb/(double)size_mb)*100.0,
Expand Down

0 comments on commit ffc622f

Please sign in to comment.