From: Jan Kara <jack@suse.cz>
To: marcin.slusarz@gmail.com
Cc: LKML <linux-kernel@vger.kernel.org>,
Ben Fennema <bfennema@falcon.csc.calpoly.edu>
Subject: Re: [PATCH 22/24] udf: convert UDF_SB_ALLOC_BITMAP macro to udf_sb_alloc_bitmap function
Date: Mon, 7 Jan 2008 12:35:24 +0100 [thread overview]
Message-ID: <20080107113524.GE12589@duck.suse.cz> (raw)
In-Reply-To: <1198374674-12128-23-git-send-email-marcin.slusarz@gmail.com>
On Sun 23-12-07 02:51:12, marcin.slusarz@gmail.com wrote:
> Signed-off-by: Marcin Slusarz <marcin.slusarz@gmail.com>
> CC: Ben Fennema <bfennema@falcon.csc.calpoly.edu>
> CC: Jan Kara <jack@suse.cz>
Looks much better :). Acked-by: Jan Kara <jack@suse.cz>
Honza
> ---
> fs/udf/super.c | 4 ++--
> fs/udf/udf_sb.h | 37 ++++++++++++++++++++-----------------
> 2 files changed, 22 insertions(+), 19 deletions(-)
>
> diff --git a/fs/udf/super.c b/fs/udf/super.c
> index 33ccf66..1afea58 100644
> --- a/fs/udf/super.c
> +++ b/fs/udf/super.c
> @@ -949,7 +949,7 @@ static int udf_load_partdesc(struct super_block *sb, struct buffer_head *bh)
> i, map->s_uspace.s_table->i_ino);
> }
> if (phd->unallocSpaceBitmap.extLength) {
> - UDF_SB_ALLOC_BITMAP(sb, i, s_uspace);
> + map->s_uspace.s_bitmap = udf_sb_alloc_bitmap(sb, i);
> if (map->s_uspace.s_bitmap != NULL) {
> map->s_uspace.s_bitmap->s_extLength =
> le32_to_cpu(phd->unallocSpaceBitmap.extLength);
> @@ -979,7 +979,7 @@ static int udf_load_partdesc(struct super_block *sb, struct buffer_head *bh)
> i, map->s_fspace.s_table->i_ino);
> }
> if (phd->freedSpaceBitmap.extLength) {
> - UDF_SB_ALLOC_BITMAP(sb, i, s_fspace);
> + map->s_fspace.s_bitmap = udf_sb_alloc_bitmap(sb, i);
> if (map->s_fspace.s_bitmap != NULL) {
> map->s_fspace.s_bitmap->s_extLength =
> le32_to_cpu(phd->freedSpaceBitmap.extLength);
> diff --git a/fs/udf/udf_sb.h b/fs/udf/udf_sb.h
> index a5805c5..4cf91f2 100644
> --- a/fs/udf/udf_sb.h
> +++ b/fs/udf/udf_sb.h
> @@ -2,6 +2,7 @@
> #define __LINUX_UDF_SB_H
>
> #include <linux/errno.h>
> +#include <linux/vmalloc.h>
>
> /* Since UDF 2.01 is ISO 13346 based... */
> #define UDF_SUPER_MAGIC 0x15013346
> @@ -149,23 +150,25 @@ static inline void udf_update_revision(struct super_block *sb, __u16 revision)
> udf_sb(sb)->s_udfrev = revision;
> }
>
> -#define UDF_SB_ALLOC_BITMAP(X,Y,Z)\
> -{\
> - int nr_groups = ((udf_sb_partmap((X),(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)\
> - udf_sb_partmaps(X)[(Y)].Z.s_bitmap = kmalloc(size, GFP_KERNEL);\
> - else\
> - udf_sb_partmaps(X)[(Y)].Z.s_bitmap = vmalloc(size);\
> - if (udf_sb_partmaps(X)[(Y)].Z.s_bitmap != NULL) {\
> - memset(udf_sb_partmaps(X)[(Y)].Z.s_bitmap, 0x00, size);\
> - udf_sb_partmaps(X)[(Y)].Z.s_bitmap->s_block_bitmap =\
> - (struct buffer_head **)(udf_sb_partmaps(X)[(Y)].Z.s_bitmap + 1);\
> - udf_sb_partmaps(X)[(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);\
> - }\
> +static inline struct udf_bitmap *udf_sb_alloc_bitmap(struct super_block *sb, __u32 index)
> +{
> + struct udf_part_map *map = udf_sb_partmap(sb, index);
> + int nr_groups = (map->s_partition_len + (sizeof(struct spaceBitmapDesc) << 3) +
> + (sb->s_blocksize * 8) - 1) / (sb->s_blocksize * 8);
> + int size = sizeof(struct udf_bitmap) + (sizeof(struct buffer_head *) * nr_groups);
> + struct udf_bitmap *bitmap;
> +
> + if (size <= PAGE_SIZE)
> + bitmap = kmalloc(size, GFP_KERNEL);
> + else
> + bitmap = vmalloc(size);
> + if (bitmap != NULL) {
> + memset(bitmap, 0x00, size);
> + bitmap->s_block_bitmap = (struct buffer_head **)(bitmap + 1);
> + bitmap->s_nr_groups = nr_groups;
> + } else
> + udf_error(sb, __FUNCTION__, "Unable to allocate space for bitmap and %d buffer_head pointers", nr_groups);
> + return bitmap;
> }
>
> #define UDF_SB_FREE_BITMAP(X,Y,Z)\
> --
> 1.5.3.4
>
--
Jan Kara <jack@suse.cz>
SUSE Labs, CR
next prev parent reply other threads:[~2008-01-07 11:35 UTC|newest]
Thread overview: 35+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-12-23 1:50 [PATCH 00/24] udf: convert super_block macros to functions marcin.slusarz
2007-12-23 1:50 ` [PATCH 01/24] udf: fix coding style of super.c marcin.slusarz
2008-01-07 11:13 ` Jan Kara
2007-12-23 1:50 ` [PATCH 02/24] udf: rename UDF_SB to udf_sb marcin.slusarz
2007-12-23 12:04 ` Christoph Hellwig
2007-12-23 1:50 ` [PATCH 03/24] udf: convert some macros to inline functions marcin.slusarz
2007-12-23 1:50 ` [PATCH 04/24] udf: convert UDF_SB_VOLIDENT macro to udf_sb_volume_ident function marcin.slusarz
2007-12-23 12:08 ` Christoph Hellwig
2007-12-23 1:50 ` [PATCH 05/24] udf: convert UDF_SB_NUMPARTS macro to udf_sb_num_parts function marcin.slusarz
2007-12-23 12:09 ` Christoph Hellwig
2007-12-23 1:50 ` [PATCH 06/24] udf: convert UDF_SB_PARTITION macro to udf_sb_partition function marcin.slusarz
2007-12-23 1:50 ` [PATCH 07/24] udf: convert UDF_SB_SESSION macro to udf_sb_session function marcin.slusarz
2007-12-23 1:50 ` [PATCH 08/24] udf: convert UDF_SB_ANCHOR macro to udf_sb_anchor function marcin.slusarz
2007-12-23 1:50 ` [PATCH 09/24] udf: convert UDF_SB_LASTBLOCK macro to udf_sb_last_block function marcin.slusarz
2007-12-23 1:51 ` [PATCH 10/24] udf: convert UDF_SB_LVIDBH macro to udf_sb_lvid_bh function marcin.slusarz
2007-12-23 1:51 ` [PATCH 11/24] udf: convert UDF_SB_LVID macro to udf_sb_lvid function marcin.slusarz
2007-12-23 1:51 ` [PATCH 12/24] udf: convert UDF_SB_LVIDIU macro to udf_sb_lvidiu function marcin.slusarz
2007-12-23 1:51 ` [PATCH 13/24] udf: remove unused macros marcin.slusarz
2007-12-23 1:51 ` [PATCH 14/24] udf: convert UDF_SB_RECORDTIME macro to udf_sb_record_time function marcin.slusarz
2007-12-23 1:51 ` [PATCH 15/24] udf: convert UDF_SB_SERIALNUM macro to udf_sb_serial_number function marcin.slusarz
2007-12-23 1:51 ` [PATCH 16/24] udf: convert UDF_SB_UDFREV macro to udf_sb_revision function marcin.slusarz
2007-12-23 1:51 ` [PATCH 17/24] udf: convert UDF_SB_VAT macro to udf_sb_vat_inode function marcin.slusarz
2007-12-23 1:51 ` [PATCH 18/24] udf: convert UDF_SB_ALLOC_PARTMAPS macro to udf_sb_alloc_partition_maps function marcin.slusarz
2007-12-23 1:51 ` [PATCH 19/24] udf: check if udf_load_logicalvol failed marcin.slusarz
2008-01-07 11:29 ` Jan Kara
2008-01-07 19:19 ` Marcin Slusarz
2007-12-23 1:51 ` [PATCH 20/24] udf: convert UDF_UPDATE_UDFREV macro to udf_update_revision function marcin.slusarz
2007-12-23 1:51 ` [PATCH 21/24] udf: remove some UDF_SB_* macros marcin.slusarz
2008-01-07 11:34 ` Jan Kara
2007-12-23 1:51 ` [PATCH 22/24] udf: convert UDF_SB_ALLOC_BITMAP macro to udf_sb_alloc_bitmap function marcin.slusarz
2008-01-07 11:35 ` Jan Kara [this message]
2007-12-23 1:51 ` [PATCH 23/24] udf: convert UDF_SB_FREE_BITMAP macro to udf_sb_free_bitmap function marcin.slusarz
2008-01-07 11:36 ` Jan Kara
2007-12-23 1:51 ` [PATCH 24/24] udf: fix sparse warnings (shadowing & mismatch between declaration and definition) marcin.slusarz
2008-01-07 11:37 ` Jan Kara
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20080107113524.GE12589@duck.suse.cz \
--to=jack@suse.cz \
--cc=bfennema@falcon.csc.calpoly.edu \
--cc=linux-kernel@vger.kernel.org \
--cc=marcin.slusarz@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®