diff options
author | Marcin Slusarz <marcin.slusarz@gmail.com> | 2008-02-08 07:20:33 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2008-02-08 12:22:35 -0500 |
commit | 66e1da3f47d5aaa278d116e72d2f8e8f204cdca3 (patch) | |
tree | aab724a6ccc5da3f6d64eb3cff3e9ac92b0b940b /fs/udf/udf_sb.h | |
parent | deae6cfcdc206f68e89346295909a2629f0e0606 (diff) |
udf: convert macros related to bitmaps to functions
convert UDF_SB_ALLOC_BITMAP macro to udf_sb_alloc_bitmap function
convert UDF_SB_FREE_BITMAP macro to udf_sb_free_bitmap function
Signed-off-by: Marcin Slusarz <marcin.slusarz@gmail.com>
Cc: Ben Fennema <bfennema@falcon.csc.calpoly.edu>
Acked-by: Jan Kara <jack@suse.cz>
Cc: Christoph Hellwig <hch@infradead.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs/udf/udf_sb.h')
-rw-r--r-- | fs/udf/udf_sb.h | 38 |
1 files changed, 0 insertions, 38 deletions
diff --git a/fs/udf/udf_sb.h b/fs/udf/udf_sb.h index 4d3bd77ea94b..2c05f8277fd8 100644 --- a/fs/udf/udf_sb.h +++ b/fs/udf/udf_sb.h | |||
@@ -43,46 +43,8 @@ static inline struct udf_sb_info *UDF_SB(struct super_block *sb) | |||
43 | 43 | ||
44 | struct logicalVolIntegrityDescImpUse *udf_sb_lvidiu(struct udf_sb_info *sbi); | 44 | struct logicalVolIntegrityDescImpUse *udf_sb_lvidiu(struct udf_sb_info *sbi); |
45 | 45 | ||
46 | #define UDF_SB_ALLOC_BITMAP(X,Y,Z)\ | ||
47 | {\ | ||
48 | struct udf_sb_info *sbi = UDF_SB(X);\ | ||
49 | int nr_groups = ((sbi->s_partmaps[(Y)].s_partition_len + (sizeof(struct spaceBitmapDesc) << 3) +\ | ||
50 | ((X)->s_blocksize * 8) - 1) / ((X)->s_blocksize * 8));\ | ||
51 | int size = sizeof(struct udf_bitmap) + (sizeof(struct buffer_head *) * nr_groups);\ | ||
52 | if (size <= PAGE_SIZE)\ | ||
53 | sbi->s_partmaps[(Y)].Z.s_bitmap = kmalloc(size, GFP_KERNEL);\ | ||
54 | else\ | ||
55 | sbi->s_partmaps[(Y)].Z.s_bitmap = vmalloc(size);\ | ||
56 | if (sbi->s_partmaps[(Y)].Z.s_bitmap != NULL) {\ | ||
57 | memset(sbi->s_partmaps[(Y)].Z.s_bitmap, 0x00, size);\ | ||
58 | sbi->s_partmaps[(Y)].Z.s_bitmap->s_block_bitmap =\ | ||
59 | (struct buffer_head **)(sbi->s_partmaps[(Y)].Z.s_bitmap + 1);\ | ||
60 | sbi->s_partmaps[(Y)].Z.s_bitmap->s_nr_groups = nr_groups;\ | ||
61 | } else {\ | ||
62 | udf_error(X, __FUNCTION__, "Unable to allocate space for bitmap and %d buffer_head pointers", nr_groups);\ | ||
63 | }\ | ||
64 | } | ||
65 | |||
66 | #define UDF_SB_FREE_BITMAP(X,Y,Z)\ | ||
67 | {\ | ||
68 | int i;\ | ||
69 | int nr_groups = UDF_SB_BITMAP_NR_GROUPS(X,Y,Z);\ | ||
70 | int size = sizeof(struct udf_bitmap) + (sizeof(struct buffer_head *) * nr_groups);\ | ||
71 | for (i = 0; i < nr_groups; i++) {\ | ||
72 | if (UDF_SB_BITMAP(X,Y,Z,i))\ | ||
73 | brelse(UDF_SB_BITMAP(X,Y,Z,i));\ | ||
74 | }\ | ||
75 | if (size <= PAGE_SIZE)\ | ||
76 | kfree(UDF_SB(X)->s_partmaps[Y].Z.s_bitmap);\ | ||
77 | else\ | ||
78 | vfree(UDF_SB(X)->s_partmaps[Y].Z.s_bitmap);\ | ||
79 | } | ||
80 | |||
81 | #define UDF_QUERY_FLAG(X,Y) ( UDF_SB(X)->s_flags & ( 1 << (Y) ) ) | 46 | #define UDF_QUERY_FLAG(X,Y) ( UDF_SB(X)->s_flags & ( 1 << (Y) ) ) |
82 | #define UDF_SET_FLAG(X,Y) ( UDF_SB(X)->s_flags |= ( 1 << (Y) ) ) | 47 | #define UDF_SET_FLAG(X,Y) ( UDF_SB(X)->s_flags |= ( 1 << (Y) ) ) |
83 | #define UDF_CLEAR_FLAG(X,Y) ( UDF_SB(X)->s_flags &= ~( 1 << (Y) ) ) | 48 | #define UDF_CLEAR_FLAG(X,Y) ( UDF_SB(X)->s_flags &= ~( 1 << (Y) ) ) |
84 | 49 | ||
85 | #define UDF_SB_BITMAP(X,Y,Z,I) ( UDF_SB(X)->s_partmaps[(Y)].Z.s_bitmap->s_block_bitmap[I] ) | ||
86 | #define UDF_SB_BITMAP_NR_GROUPS(X,Y,Z) ( UDF_SB(X)->s_partmaps[(Y)].Z.s_bitmap->s_nr_groups ) | ||
87 | |||
88 | #endif /* __LINUX_UDF_SB_H */ | 50 | #endif /* __LINUX_UDF_SB_H */ |