From 66e1da3f47d5aaa278d116e72d2f8e8f204cdca3 Mon Sep 17 00:00:00 2001 From: Marcin Slusarz Date: Fri, 8 Feb 2008 04:20:33 -0800 Subject: 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 Cc: Ben Fennema Acked-by: Jan Kara Cc: Christoph Hellwig Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- fs/udf/udf_sb.h | 38 -------------------------------------- 1 file changed, 38 deletions(-) (limited to 'fs/udf/udf_sb.h') diff --git a/fs/udf/udf_sb.h b/fs/udf/udf_sb.h index 4d3bd77ea94..2c05f8277fd 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) struct logicalVolIntegrityDescImpUse *udf_sb_lvidiu(struct udf_sb_info *sbi); -#define UDF_SB_ALLOC_BITMAP(X,Y,Z)\ -{\ - struct udf_sb_info *sbi = UDF_SB(X);\ - int nr_groups = ((sbi->s_partmaps[(Y)].s_partition_len + (sizeof(struct spaceBitmapDesc) << 3) +\ - ((X)->s_blocksize * 8) - 1) / ((X)->s_blocksize * 8));\ - int size = sizeof(struct udf_bitmap) + (sizeof(struct buffer_head *) * nr_groups);\ - if (size <= PAGE_SIZE)\ - sbi->s_partmaps[(Y)].Z.s_bitmap = kmalloc(size, GFP_KERNEL);\ - else\ - sbi->s_partmaps[(Y)].Z.s_bitmap = vmalloc(size);\ - if (sbi->s_partmaps[(Y)].Z.s_bitmap != NULL) {\ - memset(sbi->s_partmaps[(Y)].Z.s_bitmap, 0x00, size);\ - sbi->s_partmaps[(Y)].Z.s_bitmap->s_block_bitmap =\ - (struct buffer_head **)(sbi->s_partmaps[(Y)].Z.s_bitmap + 1);\ - sbi->s_partmaps[(Y)].Z.s_bitmap->s_nr_groups = nr_groups;\ - } else {\ - udf_error(X, __FUNCTION__, "Unable to allocate space for bitmap and %d buffer_head pointers", nr_groups);\ - }\ -} - -#define UDF_SB_FREE_BITMAP(X,Y,Z)\ -{\ - int i;\ - int nr_groups = UDF_SB_BITMAP_NR_GROUPS(X,Y,Z);\ - int size = sizeof(struct udf_bitmap) + (sizeof(struct buffer_head *) * nr_groups);\ - for (i = 0; i < nr_groups; i++) {\ - if (UDF_SB_BITMAP(X,Y,Z,i))\ - brelse(UDF_SB_BITMAP(X,Y,Z,i));\ - }\ - if (size <= PAGE_SIZE)\ - kfree(UDF_SB(X)->s_partmaps[Y].Z.s_bitmap);\ - else\ - vfree(UDF_SB(X)->s_partmaps[Y].Z.s_bitmap);\ -} - #define UDF_QUERY_FLAG(X,Y) ( UDF_SB(X)->s_flags & ( 1 << (Y) ) ) #define UDF_SET_FLAG(X,Y) ( UDF_SB(X)->s_flags |= ( 1 << (Y) ) ) #define UDF_CLEAR_FLAG(X,Y) ( UDF_SB(X)->s_flags &= ~( 1 << (Y) ) ) -#define UDF_SB_BITMAP(X,Y,Z,I) ( UDF_SB(X)->s_partmaps[(Y)].Z.s_bitmap->s_block_bitmap[I] ) -#define UDF_SB_BITMAP_NR_GROUPS(X,Y,Z) ( UDF_SB(X)->s_partmaps[(Y)].Z.s_bitmap->s_nr_groups ) - #endif /* __LINUX_UDF_SB_H */ -- cgit v1.2.3