• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  *  linux/fs/ext4/bitmap.c
3  *
4  * Copyright (C) 1992, 1993, 1994, 1995
5  * Remy Card (card@masi.ibp.fr)
6  * Laboratoire MASI - Institut Blaise Pascal
7  * Universite Pierre et Marie Curie (Paris VI)
8  */
9 
10 #include <linux/buffer_head.h>
11 #include <linux/jbd2.h>
12 #include "ext4.h"
13 
14 static const int nibblemap[] = {4, 3, 3, 2, 3, 2, 2, 1, 3, 2, 2, 1, 2, 1, 1, 0};
15 
ext4_count_free(char * bitmap,unsigned int numchars)16 unsigned int ext4_count_free(char *bitmap, unsigned int numchars)
17 {
18 	unsigned int i, sum = 0;
19 
20 	for (i = 0; i < numchars; i++)
21 		sum += nibblemap[bitmap[i] & 0xf] +
22 			nibblemap[(bitmap[i] >> 4) & 0xf];
23 	return sum;
24 }
25 
26