[PATCH 00/24] udf: convert super_block macros to functions - Kernel

This is a discussion on [PATCH 00/24] udf: convert super_block macros to functions - Kernel ; Signed-off-by: Marcin Slusarz CC: Ben Fennema CC: Jan Kara --- fs/udf/misc.c | 8 ++++---- fs/udf/super.c | 28 ++++++++++++++-------------- fs/udf/udf_sb.h | 6 +++++- 3 files changed, 23 insertions(+), 19 deletions(-) diff --git a/fs/udf/misc.c b/fs/udf/misc.c index 15297de..95baad5 100644 --- a/fs/udf/misc.c +++ b/fs/udf/misc.c ...

+ Reply to Thread
Page 2 of 2 FirstFirst 1 2
Results 21 to 33 of 33

Thread: [PATCH 00/24] udf: convert super_block macros to functions

  1. [PATCH 07/24] udf: convert UDF_SB_SESSION macro to udf_sb_session function

    Signed-off-by: Marcin Slusarz
    CC: Ben Fennema
    CC: Jan Kara
    ---
    fs/udf/misc.c | 8 ++++----
    fs/udf/super.c | 28 ++++++++++++++--------------
    fs/udf/udf_sb.h | 6 +++++-
    3 files changed, 23 insertions(+), 19 deletions(-)

    diff --git a/fs/udf/misc.c b/fs/udf/misc.c
    index 15297de..95baad5 100644
    --- a/fs/udf/misc.c
    +++ b/fs/udf/misc.c
    @@ -197,10 +197,10 @@ struct buffer_head *udf_read_tagged(struct super_block *sb, uint32_t block,
    if (block == 0xFFFFFFFF)
    return NULL;

    - bh = udf_tread(sb, block + UDF_SB_SESSION(sb));
    + bh = udf_tread(sb, block + udf_sb_session(sb));
    if (!bh) {
    udf_debug("block=%d, location=%d: read failed\n",
    - block + UDF_SB_SESSION(sb), location);
    + block + udf_sb_session(sb), location);
    return NULL;
    }

    @@ -210,7 +210,7 @@ struct buffer_head *udf_read_tagged(struct super_block *sb, uint32_t block,

    if (location != le32_to_cpu(tag_p->tagLocation)) {
    udf_debug("location mismatch block %u, tag %u != %u\n",
    - block + UDF_SB_SESSION(sb), le32_to_cpu(tag_p->tagLocation), location);
    + block + udf_sb_session(sb), le32_to_cpu(tag_p->tagLocation), location);
    goto error_out;
    }

    @@ -240,7 +240,7 @@ struct buffer_head *udf_read_tagged(struct super_block *sb, uint32_t block,
    return bh;
    }
    udf_debug("Crc failure block %d: crc = %d, crclen = %d\n",
    - block + UDF_SB_SESSION(sb), le16_to_cpu(tag_p->descCRC),
    + block + udf_sb_session(sb), le16_to_cpu(tag_p->descCRC),
    le16_to_cpu(tag_p->descCRCLength));

    error_out:
    diff --git a/fs/udf/super.c b/fs/udf/super.c
    index 452e6f6..903c0ec 100644
    --- a/fs/udf/super.c
    +++ b/fs/udf/super.c
    @@ -548,7 +548,7 @@ static int udf_vrs(struct super_block *sb, int silent)
    else
    sectorsize = sb->s_blocksize;

    - sector += (UDF_SB_SESSION(sb) << sb->s_blocksize_bits);
    + sector += (udf_sb_session(sb) << sb->s_blocksize_bits);

    udf_debug("Starting at sector %u (%ld byte sectors)\n",
    (sector >> sb->s_blocksize_bits), sb->s_blocksize);
    @@ -614,7 +614,7 @@ static int udf_vrs(struct super_block *sb, int silent)
    return nsr03;
    else if (nsr02)
    return nsr02;
    - else if (sector - (UDF_SB_SESSION(sb) << sb->s_blocksize_bits) == 32768)
    + else if (sector - (udf_sb_session(sb) << sb->s_blocksize_bits) == 32768)
    return -1;
    else
    return 0;
    @@ -675,15 +675,15 @@ static void udf_find_anchor(struct super_block *sb)
    }

    if (ident == TAG_IDENT_AVDP) {
    - if (location == last[i] - UDF_SB_SESSION(sb)) {
    - lastblock = last[i] - UDF_SB_SESSION(sb);
    + if (location == last[i] - udf_sb_session(sb)) {
    + lastblock = last[i] - udf_sb_session(sb);
    UDF_SB_ANCHOR(sb)[0] = lastblock;
    UDF_SB_ANCHOR(sb)[1] = lastblock - 256;
    - } else if (location == udf_variable_to_fixed(last[i]) - UDF_SB_SESSION(sb)) {
    + } else if (location == udf_variable_to_fixed(last[i]) - udf_sb_session(sb)) {
    UDF_SET_FLAG(sb, UDF_FLAG_VARCONV);
    - lastblock = udf_variable_to_fixed(last[i]) - UDF_SB_SESSION(sb);
    + lastblock = udf_variable_to_fixed(last[i]) - udf_sb_session(sb);
    UDF_SB_ANCHOR(sb)[0] = lastblock;
    - UDF_SB_ANCHOR(sb)[1] = lastblock - 256 - UDF_SB_SESSION(sb);
    + UDF_SB_ANCHOR(sb)[1] = lastblock - 256 - udf_sb_session(sb);
    } else {
    udf_debug("Anchor found at block %d, location mismatch %d.\n",
    last[i], location);
    @@ -704,13 +704,13 @@ static void udf_find_anchor(struct super_block *sb)
    }

    if (ident == TAG_IDENT_AVDP &&
    - location == last[i] - 256 - UDF_SB_SESSION(sb)) {
    + location == last[i] - 256 - udf_sb_session(sb)) {
    lastblock = last[i];
    UDF_SB_ANCHOR(sb)[1] = last[i] - 256;
    } else {
    ident = location = 0;
    - if (last[i] >= 312 + UDF_SB_SESSION(sb)) {
    - bh = sb_bread(sb, last[i] - 312 - UDF_SB_SESSION(sb));
    + if (last[i] >= 312 + udf_sb_session(sb)) {
    + bh = sb_bread(sb, last[i] - 312 - udf_sb_session(sb));
    if (bh) {
    tag *t = (tag *)bh->b_data;
    ident = le16_to_cpu(t->tagIdent);
    @@ -732,7 +732,7 @@ static void udf_find_anchor(struct super_block *sb)

    if (!lastblock) {
    /* We haven't found the lastblock. check 312 */
    - bh = sb_bread(sb, 312 + UDF_SB_SESSION(sb));
    + bh = sb_bread(sb, 312 + udf_sb_session(sb));
    if (bh) {
    tag *t = (tag *)bh->b_data;
    ident = le16_to_cpu(t->tagIdent);
    @@ -1506,11 +1506,11 @@ static int udf_fill_super(struct super_block *sb, void *options, int silent)
    goto error_out;

    if (uopt.session == 0xFFFFFFFF)
    - UDF_SB_SESSION(sb) = udf_get_last_session(sb);
    + udf_sb(sb)->s_session = udf_get_last_session(sb);
    else
    - UDF_SB_SESSION(sb) = uopt.session;
    + udf_sb(sb)->s_session = uopt.session;

    - udf_debug("Multi-session=%d\n", UDF_SB_SESSION(sb));
    + udf_debug("Multi-session=%d\n", udf_sb_session(sb));

    UDF_SB_LASTBLOCK(sb) = uopt.lastblock;
    UDF_SB_ANCHOR(sb)[0] = UDF_SB_ANCHOR(sb)[1] = 0;
    diff --git a/fs/udf/udf_sb.h b/fs/udf/udf_sb.h
    index 6eb9ef4..f33d38e 100644
    --- a/fs/udf/udf_sb.h
    +++ b/fs/udf/udf_sb.h
    @@ -70,6 +70,11 @@ static inline __u16 udf_sb_partition(struct super_block *sb)
    return udf_sb(sb)->s_partition;
    }

    +static inline __s32 udf_sb_session(struct super_block *sb)
    +{
    + return udf_sb(sb)->s_session;
    +}
    +
    #define UDF_SB_ALLOC_PARTMAPS(X,Y)\
    {\
    udf_sb(X)->s_partmaps = kmalloc(sizeof(struct udf_part_map) * Y, GFP_KERNEL);\
    @@ -134,7 +139,6 @@ static inline __u16 udf_sb_partition(struct super_block *sb)
    #define UDF_SB_BITMAP(X,Y,Z,I) ( udf_sb_partmaps(X)[(Y)].Z.s_bitmap->s_block_bitmap[I] )
    #define UDF_SB_BITMAP_NR_GROUPS(X,Y,Z) ( udf_sb_partmaps(X)[(Y)].Z.s_bitmap->s_nr_groups )

    -#define UDF_SB_SESSION(X) ( udf_sb(X)->s_session )
    #define UDF_SB_ANCHOR(X) ( udf_sb(X)->s_anchor )
    #define UDF_SB_LASTBLOCK(X) ( udf_sb(X)->s_lastblock )
    #define UDF_SB_LVIDBH(X) ( udf_sb(X)->s_lvidbh )
    --
    1.5.3.4

    --
    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to majordomo@vger.kernel.org
    More majordomo info at http://vger.kernel.org/majordomo-info.html
    Please read the FAQ at http://www.tux.org/lkml/

  2. [PATCH 10/24] udf: convert UDF_SB_LVIDBH macro to udf_sb_lvid_bh function

    - change UDF_SB_LVIDBH macro to udf_sb_lvid_bh inline function
    - rename s_lvidbh field to s_lvid_bh

    Signed-off-by: Marcin Slusarz
    CC: Ben Fennema
    CC: Jan Kara
    ---
    fs/udf/balloc.c | 26 +++++++++++++-------------
    fs/udf/ialloc.c | 8 ++++----
    fs/udf/namei.c | 8 ++++----
    fs/udf/super.c | 26 +++++++++++++-------------
    fs/udf/udf_sb.h | 8 ++++++--
    include/linux/udf_fs_sb.h | 2 +-
    6 files changed, 41 insertions(+), 37 deletions(-)

    diff --git a/fs/udf/balloc.c b/fs/udf/balloc.c
    index e313d80..d689d16 100644
    --- a/fs/udf/balloc.c
    +++ b/fs/udf/balloc.c
    @@ -188,7 +188,7 @@ do_more:
    } else {
    if (inode)
    DQUOT_FREE_BLOCK(inode, 1);
    - if (UDF_SB_LVIDBH(sb)) {
    + if (udf_sb_lvid_bh(sb)) {
    UDF_SB_LVID(sb)->freeSpaceTable[udf_sb_partition(sb)] =
    cpu_to_le32(le32_to_cpu(UDF_SB_LVID(sb)->freeSpaceTable[udf_sb_partition(sb)]) + 1);
    }
    @@ -202,8 +202,8 @@ do_more:
    }
    error_return:
    sb->s_dirt = 1;
    - if (UDF_SB_LVIDBH(sb))
    - mark_buffer_dirty(UDF_SB_LVIDBH(sb));
    + if (udf_sb_lvid_bh(sb))
    + mark_buffer_dirty(udf_sb_lvid_bh(sb));
    mutex_unlock(&sbi->s_alloc_mutex);
    return;
    }
    @@ -261,10 +261,10 @@ repeat:
    if (block_count > 0)
    goto repeat;
    out:
    - if (UDF_SB_LVIDBH(sb)) {
    + if (udf_sb_lvid_bh(sb)) {
    UDF_SB_LVID(sb)->freeSpaceTable[partition] =
    cpu_to_le32(le32_to_cpu(UDF_SB_LVID(sb)->freeSpaceTable[partition]) - alloc_count);
    - mark_buffer_dirty(UDF_SB_LVIDBH(sb));
    + mark_buffer_dirty(udf_sb_lvid_bh(sb));
    }
    sb->s_dirt = 1;
    mutex_unlock(&sbi->s_alloc_mutex);
    @@ -389,10 +389,10 @@ got_block:

    mark_buffer_dirty(bh);

    - if (UDF_SB_LVIDBH(sb)) {
    + if (udf_sb_lvid_bh(sb)) {
    UDF_SB_LVID(sb)->freeSpaceTable[partition] =
    cpu_to_le32(le32_to_cpu(UDF_SB_LVID(sb)->freeSpaceTable[partition]) - 1);
    - mark_buffer_dirty(UDF_SB_LVIDBH(sb));
    + mark_buffer_dirty(udf_sb_lvid_bh(sb));
    }
    sb->s_dirt = 1;
    mutex_unlock(&sbi->s_alloc_mutex);
    @@ -432,10 +432,10 @@ static void udf_table_free_blocks(struct super_block *sb,
    but.. oh well */
    if (inode)
    DQUOT_FREE_BLOCK(inode, count);
    - if (UDF_SB_LVIDBH(sb)) {
    + if (udf_sb_lvid_bh(sb)) {
    UDF_SB_LVID(sb)->freeSpaceTable[udf_sb_partition(sb)] =
    cpu_to_le32(le32_to_cpu(UDF_SB_LVID(sb)->freeSpaceTable[udf_sb_partition(sb)]) + count);
    - mark_buffer_dirty(UDF_SB_LVIDBH(sb));
    + mark_buffer_dirty(udf_sb_lvid_bh(sb));
    }

    start = bloc.logicalBlockNum + offset;
    @@ -670,10 +670,10 @@ static int udf_table_prealloc_blocks(struct super_block *sb,

    brelse(epos.bh);

    - if (alloc_count && UDF_SB_LVIDBH(sb)) {
    + if (alloc_count && udf_sb_lvid_bh(sb)) {
    UDF_SB_LVID(sb)->freeSpaceTable[partition] =
    cpu_to_le32(le32_to_cpu(UDF_SB_LVID(sb)->freeSpaceTable[partition]) - alloc_count);
    - mark_buffer_dirty(UDF_SB_LVIDBH(sb));
    + mark_buffer_dirty(udf_sb_lvid_bh(sb));
    sb->s_dirt = 1;
    }
    mutex_unlock(&sbi->s_alloc_mutex);
    @@ -771,10 +771,10 @@ static int udf_table_new_block(struct super_block *sb,
    udf_delete_aext(table, goal_epos, goal_eloc, goal_elen);
    brelse(goal_epos.bh);

    - if (UDF_SB_LVIDBH(sb)) {
    + if (udf_sb_lvid_bh(sb)) {
    UDF_SB_LVID(sb)->freeSpaceTable[partition] =
    cpu_to_le32(le32_to_cpu(UDF_SB_LVID(sb)->freeSpaceTable[partition]) - 1);
    - mark_buffer_dirty(UDF_SB_LVIDBH(sb));
    + mark_buffer_dirty(udf_sb_lvid_bh(sb));
    }

    sb->s_dirt = 1;
    diff --git a/fs/udf/ialloc.c b/fs/udf/ialloc.c
    index 92dc9ae..5cfac06 100644
    --- a/fs/udf/ialloc.c
    +++ b/fs/udf/ialloc.c
    @@ -43,7 +43,7 @@ void udf_free_inode(struct inode *inode)
    clear_inode(inode);

    mutex_lock(&sbi->s_alloc_mutex);
    - if (sbi->s_lvidbh) {
    + if (sbi->s_lvid_bh) {
    if (S_ISDIR(inode->i_mode))
    UDF_SB_LVIDIU(sb)->numDirs =
    cpu_to_le32(le32_to_cpu(UDF_SB_LVIDIU(sb)->numDirs) - 1);
    @@ -51,7 +51,7 @@ void udf_free_inode(struct inode *inode)
    UDF_SB_LVIDIU(sb)->numFiles =
    cpu_to_le32(le32_to_cpu(UDF_SB_LVIDIU(sb)->numFiles) - 1);

    - mark_buffer_dirty(sbi->s_lvidbh);
    + mark_buffer_dirty(sbi->s_lvid_bh);
    }
    mutex_unlock(&sbi->s_alloc_mutex);

    @@ -88,7 +88,7 @@ struct inode *udf_new_inode(struct inode *dir, int mode, int *err)
    }

    mutex_lock(&sbi->s_alloc_mutex);
    - if (UDF_SB_LVIDBH(sb)) {
    + if (udf_sb_lvid_bh(sb)) {
    struct logicalVolHeaderDesc *lvhd;
    uint64_t uniqueID;
    lvhd = (struct logicalVolHeaderDesc *)(UDF_SB_LVID(sb)->logicalVolContentsUse);
    @@ -102,7 +102,7 @@ struct inode *udf_new_inode(struct inode *dir, int mode, int *err)
    if (!(++uniqueID & 0x00000000FFFFFFFFUL))
    uniqueID += 16;
    lvhd->uniqueID = cpu_to_le64(uniqueID);
    - mark_buffer_dirty(UDF_SB_LVIDBH(sb));
    + mark_buffer_dirty(udf_sb_lvid_bh(sb));
    }
    inode->i_mode = mode;
    inode->i_uid = current->fsuid;
    diff --git a/fs/udf/namei.c b/fs/udf/namei.c
    index 066153f..4122d2b 100644
    --- a/fs/udf/namei.c
    +++ b/fs/udf/namei.c
    @@ -1014,7 +1014,7 @@ static int udf_symlink(struct inode *dir, struct dentry *dentry,
    goto out_no_entry;
    cfi.icb.extLength = cpu_to_le32(inode->i_sb->s_blocksize);
    cfi.icb.extLocation = cpu_to_lelb(UDF_I_LOCATION(inode));
    - if (UDF_SB_LVIDBH(inode->i_sb)) {
    + if (udf_sb_lvid_bh(inode->i_sb)) {
    struct logicalVolHeaderDesc *lvhd;
    uint64_t uniqueID;
    lvhd = (struct logicalVolHeaderDesc *)(UDF_SB_LVID(inode->i_sb)->logicalVolContentsUse);
    @@ -1024,7 +1024,7 @@ static int udf_symlink(struct inode *dir, struct dentry *dentry,
    if (!(++uniqueID & 0x00000000FFFFFFFFUL))
    uniqueID += 16;
    lvhd->uniqueID = cpu_to_le64(uniqueID);
    - mark_buffer_dirty(UDF_SB_LVIDBH(inode->i_sb));
    + mark_buffer_dirty(udf_sb_lvid_bh(inode->i_sb));
    }
    udf_write_fi(dir, &cfi, fi, &fibh, NULL, NULL);
    if (UDF_I_ALLOCTYPE(dir) == ICBTAG_FLAG_AD_IN_ICB) {
    @@ -1066,7 +1066,7 @@ static int udf_link(struct dentry *old_dentry, struct inode *dir,
    }
    cfi.icb.extLength = cpu_to_le32(inode->i_sb->s_blocksize);
    cfi.icb.extLocation = cpu_to_lelb(UDF_I_LOCATION(inode));
    - if (UDF_SB_LVIDBH(inode->i_sb)) {
    + if (udf_sb_lvid_bh(inode->i_sb)) {
    struct logicalVolHeaderDesc *lvhd;
    uint64_t uniqueID;
    lvhd = (struct logicalVolHeaderDesc *)(UDF_SB_LVID(inode->i_sb)->logicalVolContentsUse);
    @@ -1076,7 +1076,7 @@ static int udf_link(struct dentry *old_dentry, struct inode *dir,
    if (!(++uniqueID & 0x00000000FFFFFFFFUL))
    uniqueID += 16;
    lvhd->uniqueID = cpu_to_le64(uniqueID);
    - mark_buffer_dirty(UDF_SB_LVIDBH(inode->i_sb));
    + mark_buffer_dirty(udf_sb_lvid_bh(inode->i_sb));
    }
    udf_write_fi(dir, &cfi, fi, &fibh, NULL, NULL);
    if (UDF_I_ALLOCTYPE(dir) == ICBTAG_FLAG_AD_IN_ICB) {
    diff --git a/fs/udf/super.c b/fs/udf/super.c
    index e641d8f..b1f02a4 100644
    --- a/fs/udf/super.c
    +++ b/fs/udf/super.c
    @@ -475,7 +475,7 @@ static int udf_remount_fs(struct super_block *sb, int *flags, char *options)
    udf_sb(sb)->s_gid = uopt.gid;
    udf_sb(sb)->s_umask = uopt.umask;

    - if (UDF_SB_LVIDBH(sb)) {
    + if (udf_sb_lvid_bh(sb)) {
    int write_rev = le16_to_cpu(UDF_SB_LVIDIU(sb)->minUDFWriteRev);
    if (write_rev > UDF_MAX_WRITE_VERSION)
    *flags |= MS_RDONLY;
    @@ -1097,18 +1097,18 @@ static void udf_load_logicalvolint(struct super_block *sb, kernel_extent_ad loc)
    (bh = udf_read_tagged(sb, loc.extLocation,
    loc.extLocation, &ident)) &&
    ident == TAG_IDENT_LVID) {
    - UDF_SB_LVIDBH(sb) = bh;
    + udf_sb(sb)->s_lvid_bh = bh;

    if (UDF_SB_LVID(sb)->nextIntegrityExt.extLength)
    udf_load_logicalvolint(sb,
    leea_to_cpu(UDF_SB_LVID(sb)->nextIntegrityExt));

    - if (UDF_SB_LVIDBH(sb) != bh)
    + if (udf_sb_lvid_bh(sb) != bh)
    brelse(bh);
    loc.extLength -= sb->s_blocksize;
    loc.extLocation++;
    }
    - if (UDF_SB_LVIDBH(sb) != bh)
    + if (udf_sb_lvid_bh(sb) != bh)
    brelse(bh);
    }

    @@ -1377,7 +1377,7 @@ static int udf_load_partition(struct super_block *sb, kernel_lb_addr *fileset)

    static void udf_open_lvid(struct super_block *sb)
    {
    - if (UDF_SB_LVIDBH(sb)) {
    + if (udf_sb_lvid_bh(sb)) {
    int i;
    kernel_timestamp cpu_time;

    @@ -1396,7 +1396,7 @@ static void udf_open_lvid(struct super_block *sb)
    UDF_SB_LVID(sb)->descTag.tagChecksum +=
    ((uint8_t *) &(UDF_SB_LVID(sb)->descTag))[i];

    - mark_buffer_dirty(UDF_SB_LVIDBH(sb));
    + mark_buffer_dirty(udf_sb_lvid_bh(sb));
    }
    }

    @@ -1405,7 +1405,7 @@ static void udf_close_lvid(struct super_block *sb)
    kernel_timestamp cpu_time;
    int i;

    - if (UDF_SB_LVIDBH(sb) &&
    + if (udf_sb_lvid_bh(sb) &&
    UDF_SB_LVID(sb)->integrityType == LVID_INTEGRITY_TYPE_OPEN) {
    UDF_SB_LVIDIU(sb)->impIdent.identSuffix[0] = UDF_OS_CLASS_UNIX;
    UDF_SB_LVIDIU(sb)->impIdent.identSuffix[1] = UDF_OS_ID_LINUX;
    @@ -1429,7 +1429,7 @@ static void udf_close_lvid(struct super_block *sb)
    UDF_SB_LVID(sb)->descTag.tagChecksum +=
    ((uint8_t *)&(UDF_SB_LVID(sb)->descTag))[i];

    - mark_buffer_dirty(UDF_SB_LVIDBH(sb));
    + mark_buffer_dirty(udf_sb_lvid_bh(sb));
    }
    }

    @@ -1539,7 +1539,7 @@ static int udf_fill_super(struct super_block *sb, void *options, int silent)

    udf_debug("Lastblock=%d\n", udf_sb_last_block(sb));

    - if (UDF_SB_LVIDBH(sb)) {
    + if (udf_sb_lvid_bh(sb)) {
    uint16_t minUDFReadRev = le16_to_cpu(UDF_SB_LVIDIU(sb)->minUDFReadRev);
    uint16_t minUDFWriteRev = le16_to_cpu(UDF_SB_LVIDIU(sb)->minUDFWriteRev);
    /* uint16_t maxUDFWriteRev = le16_to_cpu(UDF_SB_LVIDIU(sb)->maxUDFWriteRev); */
    @@ -1631,7 +1631,7 @@ error_out:
    #endif
    if (!(sb->s_flags & MS_RDONLY))
    udf_close_lvid(sb);
    - brelse(UDF_SB_LVIDBH(sb));
    + brelse(udf_sb_lvid_bh(sb));
    udf_sb_free(sb);
    kfree(sbi);
    sb->s_fs_info = NULL;
    @@ -1706,7 +1706,7 @@ static void udf_put_super(struct super_block *sb)
    #endif
    if (!(sb->s_flags & MS_RDONLY))
    udf_close_lvid(sb);
    - brelse(UDF_SB_LVIDBH(sb));
    + brelse(udf_sb_lvid_bh(sb));
    udf_sb_free(sb);
    kfree(sb->s_fs_info);
    sb->s_fs_info = NULL;
    @@ -1734,7 +1734,7 @@ static int udf_statfs(struct dentry *dentry, struct kstatfs *buf)
    buf->f_blocks = UDF_SB_PARTLEN(sb, udf_sb_partition(sb));
    buf->f_bfree = udf_count_free(sb);
    buf->f_bavail = buf->f_bfree;
    - buf->f_files = (UDF_SB_LVIDBH(sb) ?
    + buf->f_files = (udf_sb_lvid_bh(sb) ?
    (le32_to_cpu(UDF_SB_LVIDIU(sb)->numFiles) +
    le32_to_cpu(UDF_SB_LVIDIU(sb)->numDirs)) : 0) + buf->f_bfree;
    buf->f_ffree = buf->f_bfree;
    @@ -1837,7 +1837,7 @@ static unsigned int udf_count_free(struct super_block *sb)
    {
    unsigned int accum = 0;

    - if (UDF_SB_LVIDBH(sb)) {
    + if (udf_sb_lvid_bh(sb)) {
    if (le32_to_cpu(UDF_SB_LVID(sb)->numOfPartitions) > udf_sb_partition(sb)) {
    accum = le32_to_cpu(UDF_SB_LVID(sb)->freeSpaceTable[udf_sb_partition(sb)]);
    if (accum == 0xFFFFFFFF)
    diff --git a/fs/udf/udf_sb.h b/fs/udf/udf_sb.h
    index ea4ec0f..dd0ba67 100644
    --- a/fs/udf/udf_sb.h
    +++ b/fs/udf/udf_sb.h
    @@ -85,6 +85,11 @@ static inline __u32 udf_sb_last_block(struct super_block *sb)
    return udf_sb(sb)->s_last_block;
    }

    +static inline struct buffer_head *udf_sb_lvid_bh(struct super_block *sb)
    +{
    + return udf_sb(sb)->s_lvid_bh;
    +}
    +
    #define UDF_SB_ALLOC_PARTMAPS(X,Y)\
    {\
    udf_sb(X)->s_partmaps = kmalloc(sizeof(struct udf_part_map) * Y, GFP_KERNEL);\
    @@ -149,8 +154,7 @@ static inline __u32 udf_sb_last_block(struct super_block *sb)
    #define UDF_SB_BITMAP(X,Y,Z,I) ( udf_sb_partmaps(X)[(Y)].Z.s_bitmap->s_block_bitmap[I] )
    #define UDF_SB_BITMAP_NR_GROUPS(X,Y,Z) ( udf_sb_partmaps(X)[(Y)].Z.s_bitmap->s_nr_groups )

    -#define UDF_SB_LVIDBH(X) ( udf_sb(X)->s_lvidbh )
    -#define UDF_SB_LVID(X) ( (struct logicalVolIntegrityDesc *)UDF_SB_LVIDBH(X)->b_data )
    +#define UDF_SB_LVID(X) ( (struct logicalVolIntegrityDesc *)udf_sb_lvid_bh(X)->b_data )
    #define UDF_SB_LVIDIU(X) ( (struct logicalVolIntegrityDescImpUse *)&(UDF_SB_LVID(X)->impUse[le32_to_cpu(UDF_SB_LVID(X)->numOfPartitions) * 2 * sizeof(uint32_t)/sizeof(uint8_t)]) )

    #define UDF_SB_UMASK(X) ( udf_sb(X)->s_umask )
    diff --git a/include/linux/udf_fs_sb.h b/include/linux/udf_fs_sb.h
    index 2f46ce6..a9f19ab 100644
    --- a/include/linux/udf_fs_sb.h
    +++ b/include/linux/udf_fs_sb.h
    @@ -86,7 +86,7 @@ struct udf_sb_info
    __u32 s_anchor[4];
    __u32 s_last_block;

    - struct buffer_head *s_lvidbh;
    + struct buffer_head *s_lvid_bh;

    /* Default permissions */
    mode_t s_umask;
    --
    1.5.3.4

    --
    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to majordomo@vger.kernel.org
    More majordomo info at http://vger.kernel.org/majordomo-info.html
    Please read the FAQ at http://www.tux.org/lkml/

  3. [PATCH 13/24] udf: remove unused macros

    Signed-off-by: Marcin Slusarz
    CC: Ben Fennema
    CC: Jan Kara
    ---
    fs/udf/udf_sb.h | 4 ----
    1 files changed, 0 insertions(+), 4 deletions(-)

    diff --git a/fs/udf/udf_sb.h b/fs/udf/udf_sb.h
    index a9ff8fb..8683b71 100644
    --- a/fs/udf/udf_sb.h
    +++ b/fs/udf/udf_sb.h
    @@ -167,13 +167,9 @@ static inline struct logicalVolIntegrityDescImpUse *udf_sb_lvidiu(struct super_b
    #define UDF_SB_BITMAP(X,Y,Z,I) ( udf_sb_partmaps(X)[(Y)].Z.s_bitmap->s_block_bitmap[I] )
    #define UDF_SB_BITMAP_NR_GROUPS(X,Y,Z) ( udf_sb_partmaps(X)[(Y)].Z.s_bitmap->s_nr_groups )

    -#define UDF_SB_UMASK(X) ( udf_sb(X)->s_umask )
    -#define UDF_SB_GID(X) ( udf_sb(X)->s_gid )
    -#define UDF_SB_UID(X) ( udf_sb(X)->s_uid )
    #define UDF_SB_RECORDTIME(X) ( udf_sb(X)->s_recordtime )
    #define UDF_SB_SERIALNUM(X) ( udf_sb(X)->s_serialnum )
    #define UDF_SB_UDFREV(X) ( udf_sb(X)->s_udfrev )
    -#define UDF_SB_FLAGS(X) ( udf_sb(X)->s_flags )
    #define UDF_SB_VAT(X) ( udf_sb(X)->s_vat )

    #endif /* __LINUX_UDF_SB_H */
    --
    1.5.3.4

    --
    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to majordomo@vger.kernel.org
    More majordomo info at http://vger.kernel.org/majordomo-info.html
    Please read the FAQ at http://www.tux.org/lkml/

  4. Re: [PATCH 04/24] udf: convert UDF_SB_VOLIDENT macro to udf_sb_volume_ident function

    On Sun, Dec 23, 2007 at 02:50:54AM +0100, marcin.slusarz@gmail.com wrote:
    > - change UDF_SB_VOLIDENT macro to udf_sb_volume_ident inline function
    > - rename s_volident field to s_volume_ident


    Please just use the field directly without an accessor. And as usual
    there's a lot of opportunity to have a nice local variable for the udf
    superblock.

    --
    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to majordomo@vger.kernel.org
    More majordomo info at http://vger.kernel.org/majordomo-info.html
    Please read the FAQ at http://www.tux.org/lkml/

  5. Re: [PATCH 05/24] udf: convert UDF_SB_NUMPARTS macro to udf_sb_num_parts function

    Same comment applies to this one. And probably the following patches
    aswell so I'm not going to comment on this issue for them.

    --
    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to majordomo@vger.kernel.org
    More majordomo info at http://vger.kernel.org/majordomo-info.html
    Please read the FAQ at http://www.tux.org/lkml/

  6. Re: [PATCH 02/24] udf: rename UDF_SB to udf_sb

    On Sun, Dec 23, 2007 at 02:50:52AM +0100, marcin.slusarz@gmail.com wrote:
    > rename UDF_SB function to udf_sb


    FOO_SB is a convention used by most filesystems, so I don't really see
    any point in changing it.

    --
    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to majordomo@vger.kernel.org
    More majordomo info at http://vger.kernel.org/majordomo-info.html
    Please read the FAQ at http://www.tux.org/lkml/

  7. Re: [PATCH 01/24] udf: fix coding style of super.c

    On Sun 23-12-07 02:50:51, marcin.slusarz@gmail.com wrote:
    > fix coding style errors found by checkpatch:
    > - assignments in if conditions
    > - braces {} around single statement blocks
    > - no spaces after commas
    > - printks without KERN_*
    > - lines longer than 80 characters
    > before: total: 50 errors, 207 warnings, 1835 lines checked
    > after: total: 0 errors, 164 warnings, 1872 lines checked
    >
    > all 164 warnings left are lines longer than 80 characters;
    > this file has too much indentation with really long expressions
    > to break all those lines
    >
    > Signed-off-by: Marcin Slusarz
    > CC: Ben Fennema
    > CC: Jan Kara

    Thanks for doing the cleanup. I've reviewed the changes and all look
    fine. You can add: Acked-by: Jan Kara

    Honza

    > ---
    > fs/udf/super.c | 295 +++++++++++++++++++++++++++++++------------------------
    > 1 files changed, 166 insertions(+), 129 deletions(-)
    >
    > diff --git a/fs/udf/super.c b/fs/udf/super.c
    > index 4360c7a..57788f1 100644
    > --- a/fs/udf/super.c
    > +++ b/fs/udf/super.c
    > @@ -33,8 +33,8 @@
    > * 10/17/98 added freespace count for "df"
    > * 11/11/98 gr added novrs option
    > * 11/26/98 dgb added fileset,anchor mount options
    > - * 12/06/98 blf really hosed things royally. vat/sparing support. sequenced vol descs
    > - * rewrote option handling based on isofs
    > + * 12/06/98 blf really hosed things royally. vat/sparing support. sequenced
    > + * vol descs. rewrote option handling based on isofs
    > * 12/20/98 find the free space bitmap (if it exists)
    > */
    >
    > @@ -116,7 +116,7 @@ static struct kmem_cache *udf_inode_cachep;
    > static struct inode *udf_alloc_inode(struct super_block *sb)
    > {
    > struct udf_inode_info *ei;
    > - ei = (struct udf_inode_info *)kmem_cache_alloc(udf_inode_cachep, GFP_KERNEL);
    > + ei = kmem_cache_alloc(udf_inode_cachep, GFP_KERNEL);
    > if (!ei)
    > return NULL;
    >
    > @@ -561,47 +561,52 @@ static int udf_vrs(struct super_block *sb, int silent)
    >
    > /* Look for ISO descriptors */
    > vsd = (struct volStructDesc *)(bh->b_data +
    > - (sector & (sb->s_blocksize - 1)));
    > + (sector & (sb->s_blocksize - 1)));
    >
    > if (vsd->stdIdent[0] == 0) {
    > brelse(bh);
    > break;
    > - } else if (!strncmp(vsd->stdIdent, VSD_STD_ID_CD001, VSD_STD_ID_LEN)) {
    > + } else if (!strncmp(vsd->stdIdent, VSD_STD_ID_CD001,
    > + VSD_STD_ID_LEN)) {
    > iso9660 = sector;
    > switch (vsd->structType) {
    > case 0:
    > udf_debug("ISO9660 Boot Record found\n");
    > break;
    > case 1:
    > - udf_debug
    > - ("ISO9660 Primary Volume Descriptor found\n");
    > + udf_debug("ISO9660 Primary Volume Descriptor "
    > + "found\n");
    > break;
    > case 2:
    > - udf_debug
    > - ("ISO9660 Supplementary Volume Descriptor found\n");
    > + udf_debug("ISO9660 Supplementary Volume "
    > + "Descriptor found\n");
    > break;
    > case 3:
    > - udf_debug
    > - ("ISO9660 Volume Partition Descriptor found\n");
    > + udf_debug("ISO9660 Volume Partition Descriptor "
    > + "found\n");
    > break;
    > case 255:
    > - udf_debug
    > - ("ISO9660 Volume Descriptor Set Terminator found\n");
    > + udf_debug("ISO9660 Volume Descriptor Set "
    > + "Terminator found\n");
    > break;
    > default:
    > udf_debug("ISO9660 VRS (%u) found\n",
    > vsd->structType);
    > break;
    > }
    > - } else if (!strncmp(vsd->stdIdent, VSD_STD_ID_BEA01, VSD_STD_ID_LEN)) {
    > - } else if (!strncmp(vsd->stdIdent, VSD_STD_ID_TEA01, VSD_STD_ID_LEN)) {
    > + } else if (!strncmp(vsd->stdIdent, VSD_STD_ID_BEA01,
    > + VSD_STD_ID_LEN))
    > + ; /* nothing */
    > + else if (!strncmp(vsd->stdIdent, VSD_STD_ID_TEA01,
    > + VSD_STD_ID_LEN)) {
    > brelse(bh);
    > break;
    > - } else if (!strncmp(vsd->stdIdent, VSD_STD_ID_NSR02, VSD_STD_ID_LEN)) {
    > + } else if (!strncmp(vsd->stdIdent, VSD_STD_ID_NSR02,
    > + VSD_STD_ID_LEN))
    > nsr02 = sector;
    > - } else if (!strncmp(vsd->stdIdent, VSD_STD_ID_NSR03, VSD_STD_ID_LEN)) {
    > + else if (!strncmp(vsd->stdIdent, VSD_STD_ID_NSR03,
    > + VSD_STD_ID_LEN))
    > nsr03 = sector;
    > - }
    > brelse(bh);
    > }
    >
    > @@ -658,21 +663,26 @@ static void udf_find_anchor(struct super_block *sb)
    > * however, if the disc isn't closed, it could be 512 */
    >
    > for (i = 0; !lastblock && i < ARRAY_SIZE(last); i++) {
    > - if (last[i] < 0 || !(bh = sb_bread(sb, last[i]))) {
    > - ident = location = 0;
    > - } else {
    > - ident = le16_to_cpu(((tag *)bh->b_data)->tagIdent);
    > - location = le32_to_cpu(((tag *)bh->b_data)->tagLocation);
    > - brelse(bh);
    > + ident = location = 0;
    > + if (last[i] >= 0) {
    > + bh = sb_bread(sb, last[i]);
    > + if (bh) {
    > + tag *t = (tag *)bh->b_data;
    > + ident = le16_to_cpu(t->tagIdent);
    > + location = le32_to_cpu(t->tagLocation);
    > + brelse(bh);
    > + }
    > }
    >
    > if (ident == TAG_IDENT_AVDP) {
    > if (location == last[i] - UDF_SB_SESSION(sb)) {
    > - lastblock = UDF_SB_ANCHOR(sb)[0] = last[i] - UDF_SB_SESSION(sb);
    > - UDF_SB_ANCHOR(sb)[1] = last[i] - 256 - UDF_SB_SESSION(sb);
    > + lastblock = last[i] - UDF_SB_SESSION(sb);
    > + UDF_SB_ANCHOR(sb)[0] = lastblock;
    > + UDF_SB_ANCHOR(sb)[1] = lastblock - 256;
    > } else if (location == udf_variable_to_fixed(last[i]) - UDF_SB_SESSION(sb)) {
    > UDF_SET_FLAG(sb, UDF_FLAG_VARCONV);
    > - lastblock = UDF_SB_ANCHOR(sb)[0] = udf_variable_to_fixed(last[i]) - UDF_SB_SESSION(sb);
    > + lastblock = udf_variable_to_fixed(last[i]) - UDF_SB_SESSION(sb);
    > + UDF_SB_ANCHOR(sb)[0] = lastblock;
    > UDF_SB_ANCHOR(sb)[1] = lastblock - 256 - UDF_SB_SESSION(sb);
    > } else {
    > udf_debug("Anchor found at block %d, location mismatch %d.\n",
    > @@ -682,12 +692,15 @@ static void udf_find_anchor(struct super_block *sb)
    > lastblock = last[i];
    > UDF_SB_ANCHOR(sb)[3] = 512;
    > } else {
    > - if (last[i] < 256 || !(bh = sb_bread(sb, last[i] - 256))) {
    > - ident = location = 0;
    > - } else {
    > - ident = le16_to_cpu(((tag *)bh->b_data)->tagIdent);
    > - location = le32_to_cpu(((tag *)bh->b_data)->tagLocation);
    > - brelse(bh);
    > + ident = location = 0;
    > + if (last[i] >= 256) {
    > + bh = sb_bread(sb, last[i] - 256);
    > + if (bh) {
    > + tag *t = (tag *)bh->b_data;
    > + ident = le16_to_cpu(t->tagIdent);
    > + location = le32_to_cpu(t->tagLocation);
    > + brelse(bh);
    > + }
    > }
    >
    > if (ident == TAG_IDENT_AVDP &&
    > @@ -695,13 +708,15 @@ static void udf_find_anchor(struct super_block *sb)
    > lastblock = last[i];
    > UDF_SB_ANCHOR(sb)[1] = last[i] - 256;
    > } else {
    > - if (last[i] < 312 + UDF_SB_SESSION(sb) ||
    > - !(bh = sb_bread(sb, last[i] - 312 - UDF_SB_SESSION(sb)))) {
    > - ident = location = 0;
    > - } else {
    > - ident = le16_to_cpu(((tag *)bh->b_data)->tagIdent);
    > - location = le32_to_cpu(((tag *)bh->b_data)->tagLocation);
    > - brelse(bh);
    > + ident = location = 0;
    > + if (last[i] >= 312 + UDF_SB_SESSION(sb)) {
    > + bh = sb_bread(sb, last[i] - 312 - UDF_SB_SESSION(sb));
    > + if (bh) {
    > + tag *t = (tag *)bh->b_data;
    > + ident = le16_to_cpu(t->tagIdent);
    > + location = le32_to_cpu(t->tagLocation);
    > + brelse(bh);
    > + }
    > }
    >
    > if (ident == TAG_IDENT_AVDP &&
    > @@ -716,10 +731,12 @@ static void udf_find_anchor(struct super_block *sb)
    > }
    >
    > if (!lastblock) {
    > - /* We havn't found the lastblock. check 312 */
    > - if ((bh = sb_bread(sb, 312 + UDF_SB_SESSION(sb)))) {
    > - ident = le16_to_cpu(((tag *)bh->b_data)->tagIdent);
    > - location = le32_to_cpu(((tag *)bh->b_data)->tagLocation);
    > + /* We haven't found the lastblock. check 312 */
    > + bh = sb_bread(sb, 312 + UDF_SB_SESSION(sb));
    > + if (bh) {
    > + tag *t = (tag *)bh->b_data;
    > + ident = le16_to_cpu(t->tagIdent);
    > + location = le32_to_cpu(t->tagLocation);
    > brelse(bh);
    >
    > if (ident == TAG_IDENT_AVDP && location == 256)
    > @@ -729,15 +746,15 @@ static void udf_find_anchor(struct super_block *sb)
    >
    > for (i = 0; i < ARRAY_SIZE(UDF_SB_ANCHOR(sb)); i++) {
    > if (UDF_SB_ANCHOR(sb)[i]) {
    > - if (!(bh = udf_read_tagged(sb, UDF_SB_ANCHOR(sb)[i],
    > - UDF_SB_ANCHOR(sb)[i], &ident))) {
    > + bh = udf_read_tagged(sb, UDF_SB_ANCHOR(sb)[i],
    > + UDF_SB_ANCHOR(sb)[i], &ident);
    > + if (!bh)
    > UDF_SB_ANCHOR(sb)[i] = 0;
    > - } else {
    > + else {
    > brelse(bh);
    > if ((ident != TAG_IDENT_AVDP) &&
    > - (i || (ident != TAG_IDENT_FE && ident != TAG_IDENT_EFE))) {
    > + (i || (ident != TAG_IDENT_FE && ident != TAG_IDENT_EFE)))
    > UDF_SB_ANCHOR(sb)[i] = 0;
    > - }
    > }
    > }
    > }
    > @@ -745,7 +762,9 @@ static void udf_find_anchor(struct super_block *sb)
    > UDF_SB_LASTBLOCK(sb) = lastblock;
    > }
    >
    > -static int udf_find_fileset(struct super_block *sb, kernel_lb_addr *fileset, kernel_lb_addr *root)
    > +static int udf_find_fileset(struct super_block *sb,
    > + kernel_lb_addr *fileset,
    > + kernel_lb_addr *root)
    > {
    > struct buffer_head *bh = NULL;
    > long lastblock;
    > @@ -764,7 +783,8 @@ static int udf_find_fileset(struct super_block *sb, kernel_lb_addr *fileset, ker
    >
    > }
    >
    > - if (!bh) { /* Search backwards through the partitions */
    > + if (!bh) {
    > + /* Search backwards through the partitions */
    > kernel_lb_addr newfileset;
    >
    > /* --> cvg: FIXME - is it reasonable? */
    > @@ -775,11 +795,13 @@ static int udf_find_fileset(struct super_block *sb, kernel_lb_addr *fileset, ker
    > fileset->logicalBlockNum == 0xFFFFFFFF &&
    > fileset->partitionReferenceNum == 0xFFFF);
    > newfileset.partitionReferenceNum--) {
    > - lastblock = UDF_SB_PARTLEN(sb, newfileset.partitionReferenceNum);
    > + lastblock = UDF_SB_PARTLEN(sb,
    > + newfileset.partitionReferenceNum);
    > newfileset.logicalBlockNum = 0;
    >
    > do {
    > - bh = udf_read_ptagged(sb, newfileset, 0, &ident);
    > + bh = udf_read_ptagged(sb, newfileset, 0,
    > + &ident);
    > if (!bh) {
    > newfileset.logicalBlockNum++;
    > continue;
    > @@ -840,7 +862,8 @@ static void udf_load_pvoldesc(struct super_block *sb, struct buffer_head *bh)
    > lets_to_cpu(pvoldesc->recordingDateAndTime))) {
    > kernel_timestamp ts;
    > ts = lets_to_cpu(pvoldesc->recordingDateAndTime);
    > - udf_debug("recording time %ld/%ld, %04u/%02u/%02u %02u:%02u (%x)\n",
    > + udf_debug("recording time %ld/%ld, %04u/%02u/%02u"
    > + " %02u:%02u (%x)\n",
    > recording, recording_usec,
    > ts.year, ts.month, ts.day, ts.hour,
    > ts.minute, ts.typeAndTimezone);
    > @@ -888,19 +911,21 @@ static int udf_load_partdesc(struct super_block *sb, struct buffer_head *bh)
    > udf_debug("Searching map: (%d == %d)\n",
    > UDF_SB_PARTMAPS(sb)[i].s_partition_num, le16_to_cpu(p->partitionNumber));
    > if (UDF_SB_PARTMAPS(sb)[i].s_partition_num == le16_to_cpu(p->partitionNumber)) {
    > - UDF_SB_PARTLEN(sb,i) = le32_to_cpu(p->partitionLength); /* blocks */
    > - UDF_SB_PARTROOT(sb,i) = le32_to_cpu(p->partitionStartingLocation);
    > + UDF_SB_PARTLEN(sb, i) = le32_to_cpu(p->partitionLength); /* blocks */
    > + UDF_SB_PARTROOT(sb, i) = le32_to_cpu(p->partitionStartingLocation);
    > if (le32_to_cpu(p->accessType) == PD_ACCESS_TYPE_READ_ONLY)
    > - UDF_SB_PARTFLAGS(sb,i) |= UDF_PART_FLAG_READ_ONLY;
    > + UDF_SB_PARTFLAGS(sb, i) |= UDF_PART_FLAG_READ_ONLY;
    > if (le32_to_cpu(p->accessType) == PD_ACCESS_TYPE_WRITE_ONCE)
    > - UDF_SB_PARTFLAGS(sb,i) |= UDF_PART_FLAG_WRITE_ONCE;
    > + UDF_SB_PARTFLAGS(sb, i) |= UDF_PART_FLAG_WRITE_ONCE;
    > if (le32_to_cpu(p->accessType) == PD_ACCESS_TYPE_REWRITABLE)
    > - UDF_SB_PARTFLAGS(sb,i) |= UDF_PART_FLAG_REWRITABLE;
    > + UDF_SB_PARTFLAGS(sb, i) |= UDF_PART_FLAG_REWRITABLE;
    > if (le32_to_cpu(p->accessType) == PD_ACCESS_TYPE_OVERWRITABLE)
    > - UDF_SB_PARTFLAGS(sb,i) |= UDF_PART_FLAG_OVERWRITABLE;
    > + UDF_SB_PARTFLAGS(sb, i) |= UDF_PART_FLAG_OVERWRITABLE;
    >
    > - if (!strcmp(p->partitionContents.ident, PD_PARTITION_CONTENTS_NSR02) ||
    > - !strcmp(p->partitionContents.ident, PD_PARTITION_CONTENTS_NSR03)) {
    > + if (!strcmp(p->partitionContents.ident,
    > + PD_PARTITION_CONTENTS_NSR02) ||
    > + !strcmp(p->partitionContents.ident,
    > + PD_PARTITION_CONTENTS_NSR03)) {
    > struct partitionHeaderDesc *phd;
    >
    > phd = (struct partitionHeaderDesc *)(p->partitionContentsUse);
    > @@ -916,7 +941,7 @@ static int udf_load_partdesc(struct super_block *sb, struct buffer_head *bh)
    > udf_debug("cannot load unallocSpaceTable (part %d)\n", i);
    > return 1;
    > }
    > - UDF_SB_PARTFLAGS(sb,i) |= UDF_PART_FLAG_UNALLOC_TABLE;
    > + UDF_SB_PARTFLAGS(sb, i) |= UDF_PART_FLAG_UNALLOC_TABLE;
    > udf_debug("unallocSpaceTable (part %d) @ %ld\n",
    > i, UDF_SB_PARTMAPS(sb)[i].s_uspace.s_table->i_ino);
    > }
    > @@ -927,7 +952,7 @@ static int udf_load_partdesc(struct super_block *sb, struct buffer_head *bh)
    > le32_to_cpu(phd->unallocSpaceBitmap.extLength);
    > UDF_SB_PARTMAPS(sb)[i].s_uspace.s_bitmap->s_extPosition =
    > le32_to_cpu(phd->unallocSpaceBitmap.extPosition);
    > - UDF_SB_PARTFLAGS(sb,i) |= UDF_PART_FLAG_UNALLOC_BITMAP;
    > + UDF_SB_PARTFLAGS(sb, i) |= UDF_PART_FLAG_UNALLOC_BITMAP;
    > udf_debug("unallocSpaceBitmap (part %d) @ %d\n",
    > i, UDF_SB_PARTMAPS(sb)[i].s_uspace.s_bitmap->s_extPosition);
    > }
    > @@ -946,7 +971,7 @@ static int udf_load_partdesc(struct super_block *sb, struct buffer_head *bh)
    > udf_debug("cannot load freedSpaceTable (part %d)\n", i);
    > return 1;
    > }
    > - UDF_SB_PARTFLAGS(sb,i) |= UDF_PART_FLAG_FREED_TABLE;
    > + UDF_SB_PARTFLAGS(sb, i) |= UDF_PART_FLAG_FREED_TABLE;
    > udf_debug("freedSpaceTable (part %d) @ %ld\n",
    > i, UDF_SB_PARTMAPS(sb)[i].s_fspace.s_table->i_ino);
    > }
    > @@ -957,7 +982,7 @@ static int udf_load_partdesc(struct super_block *sb, struct buffer_head *bh)
    > le32_to_cpu(phd->freedSpaceBitmap.extLength);
    > UDF_SB_PARTMAPS(sb)[i].s_fspace.s_bitmap->s_extPosition =
    > le32_to_cpu(phd->freedSpaceBitmap.extPosition);
    > - UDF_SB_PARTFLAGS(sb,i) |= UDF_PART_FLAG_FREED_BITMAP;
    > + UDF_SB_PARTFLAGS(sb, i) |= UDF_PART_FLAG_FREED_BITMAP;
    > udf_debug("freedSpaceBitmap (part %d) @ %d\n",
    > i, UDF_SB_PARTMAPS(sb)[i].s_fspace.s_bitmap->s_extPosition);
    > }
    > @@ -970,9 +995,11 @@ static int udf_load_partdesc(struct super_block *sb, struct buffer_head *bh)
    > udf_debug("Partition (%d) not found in partition map\n",
    > le16_to_cpu(p->partitionNumber));
    > } else {
    > - udf_debug("Partition (%d:%d type %x) starts at physical %d, block length %d\n",
    > - le16_to_cpu(p->partitionNumber), i, UDF_SB_PARTTYPE(sb,i),
    > - UDF_SB_PARTROOT(sb,i), UDF_SB_PARTLEN(sb,i));
    > + udf_debug("Partition (%d:%d type %x) starts at physical %d, "
    > + "block length %d\n",
    > + le16_to_cpu(p->partitionNumber), i,
    > + UDF_SB_PARTTYPE(sb, i), UDF_SB_PARTROOT(sb, i),
    > + UDF_SB_PARTLEN(sb, i));
    > }
    > return 0;
    > }
    > @@ -994,19 +1021,19 @@ static int udf_load_logicalvol(struct super_block *sb, struct buffer_head *bh,
    > type = ((struct genericPartitionMap *)&(lvd->partitionMaps[offset]))->partitionMapType;
    > if (type == 1) {
    > struct genericPartitionMap1 *gpm1 = (struct genericPartitionMap1 *)&(lvd->partitionMaps[offset]);
    > - UDF_SB_PARTTYPE(sb,i) = UDF_TYPE1_MAP15;
    > - UDF_SB_PARTVSN(sb,i) = le16_to_cpu(gpm1->volSeqNum);
    > - UDF_SB_PARTNUM(sb,i) = le16_to_cpu(gpm1->partitionNum);
    > - UDF_SB_PARTFUNC(sb,i) = NULL;
    > + UDF_SB_PARTTYPE(sb, i) = UDF_TYPE1_MAP15;
    > + UDF_SB_PARTVSN(sb, i) = le16_to_cpu(gpm1->volSeqNum);
    > + UDF_SB_PARTNUM(sb, i) = le16_to_cpu(gpm1->partitionNum);
    > + UDF_SB_PARTFUNC(sb, i) = NULL;
    > } else if (type == 2) {
    > struct udfPartitionMap2 *upm2 = (struct udfPartitionMap2 *)&(lvd->partitionMaps[offset]);
    > if (!strncmp(upm2->partIdent.ident, UDF_ID_VIRTUAL, strlen(UDF_ID_VIRTUAL))) {
    > if (le16_to_cpu(((__le16 *)upm2->partIdent.identSuffix)[0]) == 0x0150) {
    > - UDF_SB_PARTTYPE(sb,i) = UDF_VIRTUAL_MAP15;
    > - UDF_SB_PARTFUNC(sb,i) = udf_get_pblock_virt15;
    > + UDF_SB_PARTTYPE(sb, i) = UDF_VIRTUAL_MAP15;
    > + UDF_SB_PARTFUNC(sb, i) = udf_get_pblock_virt15;
    > } else if (le16_to_cpu(((__le16 *)upm2->partIdent.identSuffix)[0]) == 0x0200) {
    > - UDF_SB_PARTTYPE(sb,i) = UDF_VIRTUAL_MAP20;
    > - UDF_SB_PARTFUNC(sb,i) = udf_get_pblock_virt20;
    > + UDF_SB_PARTTYPE(sb, i) = UDF_VIRTUAL_MAP20;
    > + UDF_SB_PARTFUNC(sb, i) = udf_get_pblock_virt20;
    > }
    > } else if (!strncmp(upm2->partIdent.ident, UDF_ID_SPARABLE, strlen(UDF_ID_SPARABLE))) {
    > uint32_t loc;
    > @@ -1014,39 +1041,41 @@ static int udf_load_logicalvol(struct super_block *sb, struct buffer_head *bh,
    > struct sparingTable *st;
    > struct sparablePartitionMap *spm = (struct sparablePartitionMap *)&(lvd->partitionMaps[offset]);
    >
    > - UDF_SB_PARTTYPE(sb,i) = UDF_SPARABLE_MAP15;
    > - UDF_SB_TYPESPAR(sb,i).s_packet_len = le16_to_cpu(spm->packetLength);
    > + UDF_SB_PARTTYPE(sb, i) = UDF_SPARABLE_MAP15;
    > + UDF_SB_TYPESPAR(sb, i).s_packet_len = le16_to_cpu(spm->packetLength);
    > for (j = 0; j < spm->numSparingTables; j++) {
    > loc = le32_to_cpu(spm->locSparingTable[j]);
    > - UDF_SB_TYPESPAR(sb,i).s_spar_map[j] =
    > + UDF_SB_TYPESPAR(sb, i).s_spar_map[j] =
    > udf_read_tagged(sb, loc, loc, &ident);
    > - if (UDF_SB_TYPESPAR(sb,i).s_spar_map[j] != NULL) {
    > - st = (struct sparingTable *)UDF_SB_TYPESPAR(sb,i).s_spar_map[j]->b_data;
    > + if (UDF_SB_TYPESPAR(sb, i).s_spar_map[j] != NULL) {
    > + st = (struct sparingTable *)UDF_SB_TYPESPAR(sb, i).s_spar_map[j]->b_data;
    > if (ident != 0 ||
    > strncmp(st->sparingIdent.ident, UDF_ID_SPARING, strlen(UDF_ID_SPARING))) {
    > - brelse(UDF_SB_TYPESPAR(sb,i).s_spar_map[j]);
    > - UDF_SB_TYPESPAR(sb,i).s_spar_map[j] = NULL;
    > + brelse(UDF_SB_TYPESPAR(sb, i).s_spar_map[j]);
    > + UDF_SB_TYPESPAR(sb, i).s_spar_map[j] = NULL;
    > }
    > }
    > }
    > - UDF_SB_PARTFUNC(sb,i) = udf_get_pblock_spar15;
    > + UDF_SB_PARTFUNC(sb, i) = udf_get_pblock_spar15;
    > } else {
    > - udf_debug("Unknown ident: %s\n", upm2->partIdent.ident);
    > + udf_debug("Unknown ident: %s\n",
    > + upm2->partIdent.ident);
    > continue;
    > }
    > - UDF_SB_PARTVSN(sb,i) = le16_to_cpu(upm2->volSeqNum);
    > - UDF_SB_PARTNUM(sb,i) = le16_to_cpu(upm2->partitionNum);
    > + UDF_SB_PARTVSN(sb, i) = le16_to_cpu(upm2->volSeqNum);
    > + UDF_SB_PARTNUM(sb, i) = le16_to_cpu(upm2->partitionNum);
    > }
    > udf_debug("Partition (%d:%d) type %d on volume %d\n",
    > - i, UDF_SB_PARTNUM(sb,i), type, UDF_SB_PARTVSN(sb,i));
    > + i, UDF_SB_PARTNUM(sb, i), type,
    > + UDF_SB_PARTVSN(sb, i));
    > }
    >
    > if (fileset) {
    > long_ad *la = (long_ad *)&(lvd->logicalVolContentsUse[0]);
    >
    > *fileset = lelb_to_cpu(la->extLocation);
    > - udf_debug("FileSet found in LogicalVolDesc at block=%d, partition=%d\n",
    > - fileset->logicalBlockNum,
    > + udf_debug("FileSet found in LogicalVolDesc at block=%d, "
    > + "partition=%d\n", fileset->logicalBlockNum,
    > fileset->partitionReferenceNum);
    > }
    > if (lvd->integritySeqExt.extLength)
    > @@ -1071,7 +1100,8 @@ static void udf_load_logicalvolint(struct super_block *sb, kernel_extent_ad loc)
    > UDF_SB_LVIDBH(sb) = bh;
    >
    > if (UDF_SB_LVID(sb)->nextIntegrityExt.extLength)
    > - udf_load_logicalvolint(sb, leea_to_cpu(UDF_SB_LVID(sb)->nextIntegrityExt));
    > + udf_load_logicalvolint(sb,
    > + leea_to_cpu(UDF_SB_LVID(sb)->nextIntegrityExt));
    >
    > if (UDF_SB_LVIDBH(sb) != bh)
    > brelse(bh);
    > @@ -1097,8 +1127,8 @@ static void udf_load_logicalvolint(struct super_block *sb, kernel_extent_ad loc)
    > * July 1, 1997 - Andrew E. Mileski
    > * Written, tested, and released.
    > */
    > -static int udf_process_sequence(struct super_block *sb, long block, long lastblock,
    > - kernel_lb_addr *fileset)
    > +static int udf_process_sequence(struct super_block *sb, long block,
    > + long lastblock, kernel_lb_addr *fileset)
    > {
    > struct buffer_head *bh = NULL;
    > struct udf_vds_record vds[VDS_POS_LENGTH];
    > @@ -1178,7 +1208,8 @@ static int udf_process_sequence(struct super_block *sb, long block, long lastblo
    > }
    > for (i = 0; i < VDS_POS_LENGTH; i++) {
    > if (vds[i].block) {
    > - bh = udf_read_tagged(sb, vds[i].block, vds[i].block, &ident);
    > + bh = udf_read_tagged(sb, vds[i].block, vds[i].block,
    > + &ident);
    >
    > if (i == VDS_POS_PRIMARY_VOL_DESC) {
    > udf_load_pvoldesc(sb, bh);
    > @@ -1190,11 +1221,14 @@ static int udf_process_sequence(struct super_block *sb, long block, long lastblo
    > brelse(bh);
    > return 1;
    > }
    > - for (j = vds[i].block + 1; j < vds[VDS_POS_TERMINATING_DESC].block; j++) {
    > + for (j = vds[i].block + 1;
    > + j < vds[VDS_POS_TERMINATING_DESC].block;
    > + j++) {
    > bh2 = udf_read_tagged(sb, j, j, &ident);
    > gd = (struct generic_desc *)bh2->b_data;
    > if (ident == TAG_IDENT_PD)
    > - if (udf_load_partdesc(sb, bh2)) {
    > + if (udf_load_partdesc(sb,
    > + bh2)) {
    > brelse(bh);
    > brelse(bh2);
    > return 1;
    > @@ -1222,14 +1256,16 @@ static int udf_check_valid(struct super_block *sb, int novrs, int silent)
    > }
    > /* Check that it is NSR02 compliant */
    > /* Process any "CD-ROM Volume Descriptor Set" (ECMA 167 2/8.3.1) */
    > - else if ((block = udf_vrs(sb, silent)) == -1) {
    > - udf_debug("Failed to read byte 32768. Assuming open disc. "
    > - "Skipping validity check\n");
    > - if (!UDF_SB_LASTBLOCK(sb))
    > - UDF_SB_LASTBLOCK(sb) = udf_get_last_block(sb);
    > - return 0;
    > - } else {
    > - return !block;
    > + else {
    > + block = udf_vrs(sb, silent);
    > + if (block == -1) {
    > + udf_debug("Failed to read byte 32768. Assuming open "
    > + "disc. Skipping validity check\n");
    > + if (!UDF_SB_LASTBLOCK(sb))
    > + UDF_SB_LASTBLOCK(sb) = udf_get_last_block(sb);
    > + return 0;
    > + } else
    > + return !block;
    > }
    > }
    >
    > @@ -1252,7 +1288,7 @@ static int udf_load_partition(struct super_block *sb, kernel_lb_addr *fileset)
    >
    > /* Locate the main sequence */
    > main_s = le32_to_cpu(anchor->mainVolDescSeqExt.extLocation);
    > - main_e = le32_to_cpu(anchor->mainVolDescSeqExt.extLength );
    > + main_e = le32_to_cpu(anchor->mainVolDescSeqExt.extLength);
    > main_e = main_e >> sb->s_blocksize_bits;
    > main_e += main_s;
    >
    > @@ -1267,9 +1303,8 @@ static int udf_load_partition(struct super_block *sb, kernel_lb_addr *fileset)
    > /* Process the main & reserve sequences */
    > /* responsible for finding the PartitionDesc(s) */
    > if (!(udf_process_sequence(sb, main_s, main_e, fileset) &&
    > - udf_process_sequence(sb, reserve_s, reserve_e, fileset))) {
    > + udf_process_sequence(sb, reserve_s, reserve_e, fileset)))
    > break;
    > - }
    > }
    > }
    >
    > @@ -1308,7 +1343,8 @@ static int udf_load_partition(struct super_block *sb, kernel_lb_addr *fileset)
    > if (j == UDF_SB_NUMPARTS(sb))
    > return 1;
    >
    > - if (!(UDF_SB_VAT(sb) = udf_iget(sb, ino)))
    > + UDF_SB_VAT(sb) = udf_iget(sb, ino);
    > + if (!UDF_SB_VAT(sb))
    > return 1;
    >
    > if (UDF_SB_PARTTYPE(sb, i) == UDF_VIRTUAL_MAP15) {
    > @@ -1481,8 +1517,9 @@ static int udf_fill_super(struct super_block *sb, void *options, int silent)
    > UDF_SB_ANCHOR(sb)[2] = uopt.anchor;
    > UDF_SB_ANCHOR(sb)[3] = 256;
    >
    > - if (udf_check_valid(sb, uopt.novrs, silent)) { /* read volume recognition sequences */
    > - printk("UDF-fs: No VRS found\n");
    > + if (udf_check_valid(sb, uopt.novrs, silent)) {
    > + /* read volume recognition sequences */
    > + printk(KERN_WARNING "UDF-fs: No VRS found\n");
    > goto error_out;
    > }
    >
    > @@ -1496,7 +1533,7 @@ static int udf_fill_super(struct super_block *sb, void *options, int silent)
    > sb->s_time_gran = 1000;
    >
    > if (udf_load_partition(sb, &fileset)) {
    > - printk("UDF-fs: No partition found (1)\n");
    > + printk(KERN_WARNING "UDF-fs: No partition found (1)\n");
    > goto error_out;
    > }
    >
    > @@ -1508,7 +1545,7 @@ static int udf_fill_super(struct super_block *sb, void *options, int silent)
    > /* uint16_t maxUDFWriteRev = le16_to_cpu(UDF_SB_LVIDIU(sb)->maxUDFWriteRev); */
    >
    > if (minUDFReadRev > UDF_MAX_READ_VERSION) {
    > - printk("UDF-fs: minUDFReadRev=%x (max is %x)\n",
    > + printk(KERN_ERR "UDF-fs: minUDFReadRev=%x (max is %x)\n",
    > le16_to_cpu(UDF_SB_LVIDIU(sb)->minUDFReadRev),
    > UDF_MAX_READ_VERSION);
    > goto error_out;
    > @@ -1525,17 +1562,17 @@ static int udf_fill_super(struct super_block *sb, void *options, int silent)
    > }
    >
    > if (!UDF_SB_NUMPARTS(sb)) {
    > - printk("UDF-fs: No partition found (2)\n");
    > + printk(KERN_WARNING "UDF-fs: No partition found (2)\n");
    > goto error_out;
    > }
    >
    > if (UDF_SB_PARTFLAGS(sb, UDF_SB_PARTITION(sb)) & UDF_PART_FLAG_READ_ONLY) {
    > - printk("UDF-fs: Partition marked readonly; forcing readonly mount\n");
    > + printk(KERN_NOTICE "UDF-fs: Partition marked readonly; forcing readonly mount\n");
    > sb->s_flags |= MS_RDONLY;
    > }
    >
    > if (udf_find_fileset(sb, &fileset, &rootdir)) {
    > - printk("UDF-fs: No fileset found\n");
    > + printk(KERN_WARNING "UDF-fs: No fileset found\n");
    > goto error_out;
    > }
    >
    > @@ -1556,7 +1593,7 @@ static int udf_fill_super(struct super_block *sb, void *options, int silent)
    > /* perhaps it's not extensible enough, but for now ... */
    > inode = udf_iget(sb, rootdir);
    > if (!inode) {
    > - printk("UDF-fs: Error in udf_iget, block=%d, partition=%d\n",
    > + printk(KERN_ERR "UDF-fs: Error in udf_iget, block=%d, partition=%d\n",
    > rootdir.logicalBlockNum, rootdir.partitionReferenceNum);
    > goto error_out;
    > }
    > @@ -1564,7 +1601,7 @@ static int udf_fill_super(struct super_block *sb, void *options, int silent)
    > /* Allocate a dentry for the root inode */
    > sb->s_root = d_alloc_root(inode);
    > if (!sb->s_root) {
    > - printk("UDF-fs: Couldn't allocate root dentry\n");
    > + printk(KERN_ERR "UDF-fs: Couldn't allocate root dentry\n");
    > iput(inode);
    > goto error_out;
    > }
    > @@ -1580,9 +1617,9 @@ error_out:
    > if (UDF_SB_PARTFLAGS(sb, UDF_SB_PARTITION(sb)) & UDF_PART_FLAG_FREED_TABLE)
    > iput(UDF_SB_PARTMAPS(sb)[UDF_SB_PARTITION(sb)].s_fspace.s_table);
    > if (UDF_SB_PARTFLAGS(sb, UDF_SB_PARTITION(sb)) & UDF_PART_FLAG_UNALLOC_BITMAP)
    > - UDF_SB_FREE_BITMAP(sb,UDF_SB_PARTITION(sb), s_uspace);
    > + UDF_SB_FREE_BITMAP(sb, UDF_SB_PARTITION(sb), s_uspace);
    > if (UDF_SB_PARTFLAGS(sb, UDF_SB_PARTITION(sb)) & UDF_PART_FLAG_FREED_BITMAP)
    > - UDF_SB_FREE_BITMAP(sb,UDF_SB_PARTITION(sb), s_fspace);
    > + UDF_SB_FREE_BITMAP(sb, UDF_SB_PARTITION(sb), s_fspace);
    > if (UDF_SB_PARTTYPE(sb, UDF_SB_PARTITION(sb)) == UDF_SPARABLE_MAP15) {
    > for (i = 0; i < 4; i++)
    > brelse(UDF_SB_TYPESPAR(sb, UDF_SB_PARTITION(sb)).s_spar_map[i]);
    > @@ -1614,7 +1651,7 @@ void udf_error(struct super_block *sb, const char *function,
    > va_start(args, fmt);
    > vsnprintf(error_buf, sizeof(error_buf), fmt, args);
    > va_end(args);
    > - printk (KERN_CRIT "UDF-fs error (device %s): %s: %s\n",
    > + printk(KERN_CRIT "UDF-fs error (device %s): %s: %s\n",
    > sb->s_id, function, error_buf);
    > }
    >
    > @@ -1655,9 +1692,9 @@ static void udf_put_super(struct super_block *sb)
    > if (UDF_SB_PARTFLAGS(sb, UDF_SB_PARTITION(sb)) & UDF_PART_FLAG_FREED_TABLE)
    > iput(UDF_SB_PARTMAPS(sb)[UDF_SB_PARTITION(sb)].s_fspace.s_table);
    > if (UDF_SB_PARTFLAGS(sb, UDF_SB_PARTITION(sb)) & UDF_PART_FLAG_UNALLOC_BITMAP)
    > - UDF_SB_FREE_BITMAP(sb,UDF_SB_PARTITION(sb), s_uspace);
    > + UDF_SB_FREE_BITMAP(sb, UDF_SB_PARTITION(sb), s_uspace);
    > if (UDF_SB_PARTFLAGS(sb, UDF_SB_PARTITION(sb)) & UDF_PART_FLAG_FREED_BITMAP)
    > - UDF_SB_FREE_BITMAP(sb,UDF_SB_PARTITION(sb), s_fspace);
    > + UDF_SB_FREE_BITMAP(sb, UDF_SB_PARTITION(sb), s_fspace);
    > if (UDF_SB_PARTTYPE(sb, UDF_SB_PARTITION(sb)) == UDF_SPARABLE_MAP15) {
    > for (i = 0; i < 4; i++)
    > brelse(UDF_SB_TYPESPAR(sb, UDF_SB_PARTITION(sb)).s_spar_map[i]);
    > @@ -1786,9 +1823,9 @@ static unsigned int udf_count_free_table(struct super_block *sb, struct inode *t
    > epos.offset = sizeof(struct unallocSpaceEntry);
    > epos.bh = NULL;
    >
    > - while ((etype = udf_next_aext(table, &epos, &eloc, &elen, 1)) != -1) {
    > + while ((etype = udf_next_aext(table, &epos, &eloc, &elen, 1)) != -1)
    > accum += (elen >> table->i_sb->s_blocksize_bits);
    > - }
    > +
    > brelse(epos.bh);
    >
    > unlock_kernel();
    > @@ -1811,22 +1848,22 @@ static unsigned int udf_count_free(struct super_block *sb)
    > if (accum)
    > return accum;
    >
    > - if (UDF_SB_PARTFLAGS(sb,UDF_SB_PARTITION(sb)) & UDF_PART_FLAG_UNALLOC_BITMAP) {
    > + if (UDF_SB_PARTFLAGS(sb, UDF_SB_PARTITION(sb)) & UDF_PART_FLAG_UNALLOC_BITMAP) {
    > accum += udf_count_free_bitmap(sb,
    > UDF_SB_PARTMAPS(sb)[UDF_SB_PARTITION(sb)].s_uspace.s_bitmap);
    > }
    > - if (UDF_SB_PARTFLAGS(sb,UDF_SB_PARTITION(sb)) & UDF_PART_FLAG_FREED_BITMAP) {
    > + if (UDF_SB_PARTFLAGS(sb, UDF_SB_PARTITION(sb)) & UDF_PART_FLAG_FREED_BITMAP) {
    > accum += udf_count_free_bitmap(sb,
    > UDF_SB_PARTMAPS(sb)[UDF_SB_PARTITION(sb)].s_fspace.s_bitmap);
    > }
    > if (accum)
    > return accum;
    >
    > - if (UDF_SB_PARTFLAGS(sb,UDF_SB_PARTITION(sb)) & UDF_PART_FLAG_UNALLOC_TABLE) {
    > + if (UDF_SB_PARTFLAGS(sb, UDF_SB_PARTITION(sb)) & UDF_PART_FLAG_UNALLOC_TABLE) {
    > accum += udf_count_free_table(sb,
    > UDF_SB_PARTMAPS(sb)[UDF_SB_PARTITION(sb)].s_uspace.s_table);
    > }
    > - if (UDF_SB_PARTFLAGS(sb,UDF_SB_PARTITION(sb)) & UDF_PART_FLAG_FREED_TABLE) {
    > + if (UDF_SB_PARTFLAGS(sb, UDF_SB_PARTITION(sb)) & UDF_PART_FLAG_FREED_TABLE) {
    > accum += udf_count_free_table(sb,
    > UDF_SB_PARTMAPS(sb)[UDF_SB_PARTITION(sb)].s_fspace.s_table);
    > }
    > --
    > 1.5.3.4
    >

    --
    Jan Kara
    SUSE Labs, CR
    --
    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to majordomo@vger.kernel.org
    More majordomo info at http://vger.kernel.org/majordomo-info.html
    Please read the FAQ at http://www.tux.org/lkml/

  8. Re: [PATCH 24/24] udf: fix sparse warnings (shadowing & mismatch between declaration and definition)

    On Sun 23-12-07 02:51:14, marcin.slusarz@gmail.com wrote:
    > fix warnings:
    > fs/udf/super.c:1370:24: warning: symbol 'bh' shadows an earlier one
    > fs/udf/super.c:1288:21: originally declared here
    > fs/udf/super.c:450:6: warning: symbol 'udf_write_super' was not declared. Should it be static?
    >
    > Signed-off-by: Marcin Slusarz
    > CC: Ben Fennema
    > CC: Jan Kara

    Looks fine. Acked-by: Jan Kara

    Honza

    > ---
    > fs/udf/super.c | 3 +--
    > 1 files changed, 1 insertions(+), 2 deletions(-)
    >
    > diff --git a/fs/udf/super.c b/fs/udf/super.c
    > index f6c911b..da68130 100644
    > --- a/fs/udf/super.c
    > +++ b/fs/udf/super.c
    > @@ -447,7 +447,7 @@ static int udf_parse_options(char *options, struct udf_options *uopt)
    > return 1;
    > }
    >
    > -void udf_write_super(struct super_block *sb)
    > +static void udf_write_super(struct super_block *sb)
    > {
    > lock_kernel();
    >
    > @@ -1367,7 +1367,6 @@ static int udf_load_partition(struct super_block *sb, kernel_lb_addr *fileset)
    > map->s_type_specific.s_virtual.s_num_entries =
    > (udf_sb_vat_inode(sb)->i_size - 36) >> 2;
    > } else if (map->s_partition_type == UDF_VIRTUAL_MAP20) {
    > - struct buffer_head *bh = NULL;
    > uint32_t pos;
    >
    > pos = udf_block_map(udf_sb_vat_inode(sb), 0);
    > --
    > 1.5.3.4
    >

    --
    Jan Kara
    SUSE Labs, CR
    --
    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to majordomo@vger.kernel.org
    More majordomo info at http://vger.kernel.org/majordomo-info.html
    Please read the FAQ at http://www.tux.org/lkml/

  9. Re: [PATCH 19/24] udf: check if udf_load_logicalvol failed

    On Sun 23-12-07 02:51:09, marcin.slusarz@gmail.com wrote:
    > udf_load_logicalvol may fail eg in out of memory conditions - check it
    > and propagate error further
    >
    > Signed-off-by: Marcin Slusarz
    > CC: Ben Fennema
    > CC: Jan Kara

    I certainly agree with the idea of the change. Just note that
    udf_process_sequence() returns 1 in case of failure so propagating an error
    is not ideal - we should keep things consistent. And also note that the
    actual value is disregarded in udf_load_partition() anyway.

    Honza
    > ---
    > fs/udf/super.c | 7 ++++++-
    > 1 files changed, 6 insertions(+), 1 deletions(-)
    >
    > diff --git a/fs/udf/super.c b/fs/udf/super.c
    > index 4aef612..f8c5794 100644
    > --- a/fs/udf/super.c
    > +++ b/fs/udf/super.c
    > @@ -1141,6 +1141,7 @@ static int udf_process_sequence(struct super_block *sb, long block,
    > uint32_t vdsn;
    > uint16_t ident;
    > long next_s = 0, next_e = 0;
    > + int ret;
    >
    > memset(vds, 0, sizeof(struct udf_vds_record) * VDS_POS_LENGTH);
    >
    > @@ -1216,7 +1217,11 @@ static int udf_process_sequence(struct super_block *sb, long block,
    > if (i == VDS_POS_PRIMARY_VOL_DESC) {
    > udf_load_pvoldesc(sb, bh);
    > } else if (i == VDS_POS_LOGICAL_VOL_DESC) {
    > - udf_load_logicalvol(sb, bh, fileset); /* TODO: check return value */
    > + ret = udf_load_logicalvol(sb, bh, fileset);
    > + if (ret != 0) {
    > + brelse(bh);
    > + return ret;
    > + }
    > } else if (i == VDS_POS_PARTITION_DESC) {
    > struct buffer_head *bh2 = NULL;
    > if (udf_load_partdesc(sb, bh)) {

    --
    Jan Kara
    SUSE Labs, CR
    --
    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to majordomo@vger.kernel.org
    More majordomo info at http://vger.kernel.org/majordomo-info.html
    Please read the FAQ at http://www.tux.org/lkml/

  10. Re: [PATCH 23/24] udf: convert UDF_SB_FREE_BITMAP macro to udf_sb_free_bitmap function

    On Sun 23-12-07 02:51:13, marcin.slusarz@gmail.com wrote:
    > additionally fix sparse warnings:
    > fs/udf/super.c:1636:4: warning: symbol 'i' shadows an earlier one
    > fs/udf/super.c:1469:6: originally declared here
    > fs/udf/super.c:1638:4: warning: symbol 'i' shadows an earlier one
    > fs/udf/super.c:1469:6: originally declared here
    > fs/udf/super.c:1712:4: warning: symbol 'i' shadows an earlier one
    > fs/udf/super.c:1701:6: originally declared here
    > fs/udf/super.c:1714:4: warning: symbol 'i' shadows an earlier one
    > fs/udf/super.c:1701:6: originally declared here
    >
    > Signed-off-by: Marcin Slusarz
    > CC: Ben Fennema
    > CC: Jan Kara

    Looks fine. Acked-by: Jan Kara

    Honza

    > ---
    > fs/udf/super.c | 8 ++++----
    > fs/udf/udf_sb.h | 31 ++++++++++++++-----------------
    > 2 files changed, 18 insertions(+), 21 deletions(-)
    >
    > diff --git a/fs/udf/super.c b/fs/udf/super.c
    > index 1afea58..f6c911b 100644
    > --- a/fs/udf/super.c
    > +++ b/fs/udf/super.c
    > @@ -1634,9 +1634,9 @@ error_out:
    > if (map->s_partition_flags & UDF_PART_FLAG_FREED_TABLE)
    > iput(map->s_fspace.s_table);
    > if (map->s_partition_flags & UDF_PART_FLAG_UNALLOC_BITMAP)
    > - UDF_SB_FREE_BITMAP(sb, udf_sb_partition(sb), s_uspace);
    > + udf_sb_free_bitmap(map->s_uspace.s_bitmap);
    > if (map->s_partition_flags & UDF_PART_FLAG_FREED_BITMAP)
    > - UDF_SB_FREE_BITMAP(sb, udf_sb_partition(sb), s_fspace);
    > + udf_sb_free_bitmap(map->s_fspace.s_bitmap);
    > if (map->s_partition_type == UDF_SPARABLE_MAP15) {
    > for (i = 0; i < 4; i++)
    > brelse(map->s_type_specific.s_sparing.s_spar_map[i]);
    > @@ -1710,9 +1710,9 @@ static void udf_put_super(struct super_block *sb)
    > if (map->s_partition_flags & UDF_PART_FLAG_FREED_TABLE)
    > iput(map->s_fspace.s_table);
    > if (map->s_partition_flags & UDF_PART_FLAG_UNALLOC_BITMAP)
    > - UDF_SB_FREE_BITMAP(sb, udf_sb_partition(sb), s_uspace);
    > + udf_sb_free_bitmap(map->s_uspace.s_bitmap);
    > if (map->s_partition_flags & UDF_PART_FLAG_FREED_BITMAP)
    > - UDF_SB_FREE_BITMAP(sb, udf_sb_partition(sb), s_fspace);
    > + udf_sb_free_bitmap(map->s_fspace.s_bitmap);
    > if (map->s_partition_type == UDF_SPARABLE_MAP15) {
    > for (i = 0; i < 4; i++)
    > brelse(map->s_type_specific.s_sparing.s_spar_map[i]);
    > diff --git a/fs/udf/udf_sb.h b/fs/udf/udf_sb.h
    > index 4cf91f2..8fc2be9 100644
    > --- a/fs/udf/udf_sb.h
    > +++ b/fs/udf/udf_sb.h
    > @@ -171,27 +171,24 @@ static inline struct udf_bitmap *udf_sb_alloc_bitmap(struct super_block *sb, __u
    > return bitmap;
    > }
    >
    > -#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_partmaps(X)[Y].Z.s_bitmap);\
    > - else\
    > - vfree(udf_sb_partmaps(X)[Y].Z.s_bitmap);\
    > +static inline void udf_sb_free_bitmap(struct udf_bitmap *bitmap)
    > +{
    > + int i;
    > + int nr_groups = bitmap->s_nr_groups;
    > + int size = sizeof(struct udf_bitmap) + (sizeof(struct buffer_head *) * nr_groups);
    > +
    > + for (i = 0; i < nr_groups; i++) {
    > + if (bitmap->s_block_bitmap[i])
    > + brelse(bitmap->s_block_bitmap[i]);
    > + }
    > + if (size <= PAGE_SIZE)
    > + kfree(bitmap);
    > + else
    > + vfree(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_partmaps(X)[(Y)].Z.s_bitmap->s_block_bitmap[I] )
    > -#define UDF_SB_BITMAP_NR_GROUPS(X,Y,Z) ( udf_sb_partmaps(X)[(Y)].Z.s_bitmap->s_nr_groups )
    > -
    > -
    > #endif /* __LINUX_UDF_SB_H */
    > --
    > 1.5.3.4
    >

    --
    Jan Kara
    SUSE Labs, CR
    --
    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to majordomo@vger.kernel.org
    More majordomo info at http://vger.kernel.org/majordomo-info.html
    Please read the FAQ at http://www.tux.org/lkml/

  11. Re: [PATCH 21/24] udf: remove some UDF_SB_* macros

    On Sun 23-12-07 02:51:11, marcin.slusarz@gmail.com wrote:
    > remove macros:
    > - UDF_SB_PARTTYPE
    > - UDF_SB_PARTROOT
    > - UDF_SB_PARTLEN
    > - UDF_SB_PARTVSN
    > - UDF_SB_PARTNUM
    > - UDF_SB_TYPESPAR
    > - UDF_SB_TYPEVIRT
    > - UDF_SB_PARTFUNC
    > - UDF_SB_PARTFLAGS
    > and replace all uses
    >
    > Signed-off-by: Marcin Slusarz
    > CC: Ben Fennema
    > CC: Jan Kara

    Looks fine. Acked-by: Jan Kara

    Honza

    > ---
    > fs/udf/balloc.c | 76 +++++++++++----------
    > fs/udf/inode.c | 2 +-
    > fs/udf/partition.c | 49 ++++++++------
    > fs/udf/super.c | 191 ++++++++++++++++++++++++++++------------------------
    > fs/udf/udf_sb.h | 16 ++---
    > 5 files changed, 179 insertions(+), 155 deletions(-)
    >
    > diff --git a/fs/udf/balloc.c b/fs/udf/balloc.c
    > index 23aae18..4fe8635 100644
    > --- a/fs/udf/balloc.c
    > +++ b/fs/udf/balloc.c
    > @@ -155,10 +155,10 @@ static void udf_bitmap_free_blocks(struct super_block *sb,
    >
    > mutex_lock(&sbi->s_alloc_mutex);
    > if (bloc.logicalBlockNum < 0 ||
    > - (bloc.logicalBlockNum + count) > UDF_SB_PARTLEN(sb, bloc.partitionReferenceNum)) {
    > + (bloc.logicalBlockNum + count) > udf_sb_partmap(sb, bloc.partitionReferenceNum)->s_partition_len) {
    > udf_debug("%d < %d || %d + %d > %d\n",
    > bloc.logicalBlockNum, 0, bloc.logicalBlockNum, count,
    > - UDF_SB_PARTLEN(sb, bloc.partitionReferenceNum));
    > + udf_sb_partmap(sb, bloc.partitionReferenceNum)->s_partition_len);
    > goto error_return;
    > }
    >
    > @@ -219,16 +219,18 @@ static int udf_bitmap_prealloc_blocks(struct super_block *sb,
    > int bit, block, block_group, group_start;
    > int nr_groups, bitmap_nr;
    > struct buffer_head *bh;
    > + __u32 part_len;
    >
    > mutex_lock(&sbi->s_alloc_mutex);
    > - if (first_block < 0 || first_block >= UDF_SB_PARTLEN(sb, partition))
    > + part_len = udf_sb_partmap(sb, partition)->s_partition_len;
    > + if (first_block < 0 || first_block >= part_len)
    > goto out;
    >
    > - if (first_block + block_count > UDF_SB_PARTLEN(sb, partition))
    > - block_count = UDF_SB_PARTLEN(sb, partition) - first_block;
    > + if (first_block + block_count > part_len)
    > + block_count = part_len - first_block;
    >
    > repeat:
    > - nr_groups = (UDF_SB_PARTLEN(sb, partition) +
    > + nr_groups = (udf_sb_partmap(sb, partition)->s_partition_len +
    > (sizeof(struct spaceBitmapDesc) << 3) +
    > (sb->s_blocksize * 8) - 1) / (sb->s_blocksize * 8);
    > block = first_block + (sizeof(struct spaceBitmapDesc) << 3);
    > @@ -287,7 +289,7 @@ static int udf_bitmap_new_block(struct super_block *sb,
    > mutex_lock(&sbi->s_alloc_mutex);
    >
    > repeat:
    > - if (goal < 0 || goal >= UDF_SB_PARTLEN(sb, partition))
    > + if (goal < 0 || goal >= udf_sb_partmap(sb, partition)->s_partition_len)
    > goal = 0;
    >
    > nr_groups = bitmap->s_nr_groups;
    > @@ -421,10 +423,10 @@ static void udf_table_free_blocks(struct super_block *sb,
    >
    > mutex_lock(&sbi->s_alloc_mutex);
    > if (bloc.logicalBlockNum < 0 ||
    > - (bloc.logicalBlockNum + count) > UDF_SB_PARTLEN(sb, bloc.partitionReferenceNum)) {
    > + (bloc.logicalBlockNum + count) > udf_sb_partmap(sb, bloc.partitionReferenceNum)->s_partition_len) {
    > udf_debug("%d < %d || %d + %d > %d\n",
    > bloc.logicalBlockNum, 0, bloc.logicalBlockNum, count,
    > - UDF_SB_PARTLEN(sb, bloc.partitionReferenceNum));
    > + udf_sb_partmap(sb, bloc.partitionReferenceNum)->s_partition_len);
    > goto error_return;
    > }
    >
    > @@ -627,7 +629,7 @@ static int udf_table_prealloc_blocks(struct super_block *sb,
    > struct extent_position epos;
    > int8_t etype = -1;
    >
    > - if (first_block < 0 || first_block >= UDF_SB_PARTLEN(sb, partition))
    > + if (first_block < 0 || first_block >= udf_sb_partmap(sb, partition)->s_partition_len)
    > return 0;
    >
    > if (UDF_I_ALLOCTYPE(table) == ICBTAG_FLAG_AD_SHORT)
    > @@ -703,7 +705,7 @@ static int udf_table_new_block(struct super_block *sb,
    > return newblock;
    >
    > mutex_lock(&sbi->s_alloc_mutex);
    > - if (goal < 0 || goal >= UDF_SB_PARTLEN(sb, partition))
    > + if (goal < 0 || goal >= udf_sb_partmap(sb, partition)->s_partition_len)
    > goal = 0;
    >
    > /* We search for the closest matching block to goal. If we find a exact hit,
    > @@ -789,22 +791,23 @@ inline void udf_free_blocks(struct super_block *sb,
    > uint32_t count)
    > {
    > uint16_t partition = bloc.partitionReferenceNum;
    > + struct udf_part_map *map = udf_sb_partmap(sb, partition);
    >
    > - if (UDF_SB_PARTFLAGS(sb, partition) & UDF_PART_FLAG_UNALLOC_BITMAP) {
    > + if (map->s_partition_flags & UDF_PART_FLAG_UNALLOC_BITMAP) {
    > return udf_bitmap_free_blocks(sb, inode,
    > - udf_sb_partmaps(sb)[partition].s_uspace.s_bitmap,
    > + map->s_uspace.s_bitmap,
    > bloc, offset, count);
    > - } else if (UDF_SB_PARTFLAGS(sb, partition) & UDF_PART_FLAG_UNALLOC_TABLE) {
    > + } else if (map->s_partition_flags & UDF_PART_FLAG_UNALLOC_TABLE) {
    > return udf_table_free_blocks(sb, inode,
    > - udf_sb_partmaps(sb)[partition].s_uspace.s_table,
    > + map->s_uspace.s_table,
    > bloc, offset, count);
    > - } else if (UDF_SB_PARTFLAGS(sb, partition) & UDF_PART_FLAG_FREED_BITMAP) {
    > + } else if (map->s_partition_flags & UDF_PART_FLAG_FREED_BITMAP) {
    > return udf_bitmap_free_blocks(sb, inode,
    > - udf_sb_partmaps(sb)[partition].s_fspace.s_bitmap,
    > + map->s_fspace.s_bitmap,
    > bloc, offset, count);
    > - } else if (UDF_SB_PARTFLAGS(sb, partition) & UDF_PART_FLAG_FREED_TABLE) {
    > + } else if (map->s_partition_flags & UDF_PART_FLAG_FREED_TABLE) {
    > return udf_table_free_blocks(sb, inode,
    > - udf_sb_partmaps(sb)[partition].s_fspace.s_table,
    > + map->s_fspace.s_table,
    > bloc, offset, count);
    > } else {
    > return;
    > @@ -816,21 +819,23 @@ inline int udf_prealloc_blocks(struct super_block *sb,
    > uint16_t partition, uint32_t first_block,
    > uint32_t block_count)
    > {
    > - if (UDF_SB_PARTFLAGS(sb, partition) & UDF_PART_FLAG_UNALLOC_BITMAP) {
    > + struct udf_part_map *map = udf_sb_partmap(sb, partition);
    > +
    > + if (map->s_partition_flags & UDF_PART_FLAG_UNALLOC_BITMAP) {
    > return udf_bitmap_prealloc_blocks(sb, inode,
    > - udf_sb_partmaps(sb)[partition].s_uspace.s_bitmap,
    > + map->s_uspace.s_bitmap,
    > partition, first_block, block_count);
    > - } else if (UDF_SB_PARTFLAGS(sb, partition) & UDF_PART_FLAG_UNALLOC_TABLE) {
    > + } else if (map->s_partition_flags & UDF_PART_FLAG_UNALLOC_TABLE) {
    > return udf_table_prealloc_blocks(sb, inode,
    > - udf_sb_partmaps(sb)[partition].s_uspace.s_table,
    > + map->s_uspace.s_table,
    > partition, first_block, block_count);
    > - } else if (UDF_SB_PARTFLAGS(sb, partition) & UDF_PART_FLAG_FREED_BITMAP) {
    > + } else if (map->s_partition_flags & UDF_PART_FLAG_FREED_BITMAP) {
    > return udf_bitmap_prealloc_blocks(sb, inode,
    > - udf_sb_partmaps(sb)[partition].s_fspace.s_bitmap,
    > + map->s_fspace.s_bitmap,
    > partition, first_block, block_count);
    > - } else if (UDF_SB_PARTFLAGS(sb, partition) & UDF_PART_FLAG_FREED_TABLE) {
    > + } else if (map->s_partition_flags & UDF_PART_FLAG_FREED_TABLE) {
    > return udf_table_prealloc_blocks(sb, inode,
    > - udf_sb_partmaps(sb)[partition].s_fspace.s_table,
    > + map->s_fspace.s_table,
    > partition, first_block, block_count);
    > } else {
    > return 0;
    > @@ -842,23 +847,24 @@ inline int udf_new_block(struct super_block *sb,
    > uint16_t partition, uint32_t goal, int *err)
    > {
    > int ret;
    > + struct udf_part_map *map = udf_sb_partmap(sb, partition);
    >
    > - if (UDF_SB_PARTFLAGS(sb, partition) & UDF_PART_FLAG_UNALLOC_BITMAP) {
    > + if (map->s_partition_flags & UDF_PART_FLAG_UNALLOC_BITMAP) {
    > ret = udf_bitmap_new_block(sb, inode,
    > - udf_sb_partmaps(sb)[partition].s_uspace.s_bitmap,
    > + map->s_uspace.s_bitmap,
    > partition, goal, err);
    > return ret;
    > - } else if (UDF_SB_PARTFLAGS(sb, partition) & UDF_PART_FLAG_UNALLOC_TABLE) {
    > + } else if (map->s_partition_flags & UDF_PART_FLAG_UNALLOC_TABLE) {
    > return udf_table_new_block(sb, inode,
    > - udf_sb_partmaps(sb)[partition].s_uspace.s_table,
    > + map->s_uspace.s_table,
    > partition, goal, err);
    > - } else if (UDF_SB_PARTFLAGS(sb, partition) & UDF_PART_FLAG_FREED_BITMAP) {
    > + } else if (map->s_partition_flags & UDF_PART_FLAG_FREED_BITMAP) {
    > return udf_bitmap_new_block(sb, inode,
    > - udf_sb_partmaps(sb)[partition].s_fspace.s_bitmap,
    > + map->s_fspace.s_bitmap,
    > partition, goal, err);
    > - } else if (UDF_SB_PARTFLAGS(sb, partition) & UDF_PART_FLAG_FREED_TABLE) {
    > + } else if (map->s_partition_flags & UDF_PART_FLAG_FREED_TABLE) {
    > return udf_table_new_block(sb, inode,
    > - udf_sb_partmaps(sb)[partition].s_fspace.s_table,
    > + map->s_fspace.s_table,
    > partition, goal, err);
    > } else {
    > *err = -EIO;
    > diff --git a/fs/udf/inode.c b/fs/udf/inode.c
    > index 1cdb381..8aa0fc6 100644
    > --- a/fs/udf/inode.c
    > +++ b/fs/udf/inode.c
    > @@ -1585,7 +1585,7 @@ struct inode *udf_iget(struct super_block *sb, kernel_lb_addr ino)
    > if (is_bad_inode(inode))
    > goto out_iput;
    >
    > - if (ino.logicalBlockNum >= UDF_SB_PARTLEN(sb, ino.partitionReferenceNum)) {
    > + if (ino.logicalBlockNum >= udf_sb_partmap(sb, ino.partitionReferenceNum)->s_partition_len) {
    > udf_debug("block=%d, partition=%d out of range\n",
    > ino.logicalBlockNum, ino.partitionReferenceNum);
    > make_bad_inode(inode);
    > diff --git a/fs/udf/partition.c b/fs/udf/partition.c
    > index 99640a6..4959d53 100644
    > --- a/fs/udf/partition.c
    > +++ b/fs/udf/partition.c
    > @@ -31,15 +31,17 @@
    > inline uint32_t udf_get_pblock(struct super_block *sb, uint32_t block,
    > uint16_t partition, uint32_t offset)
    > {
    > + struct udf_part_map *map;
    > if (partition >= udf_sb_num_parts(sb)) {
    > udf_debug("block=%d, partition=%d, offset=%d: invalid partition\n",
    > block, partition, offset);
    > return 0xFFFFFFFF;
    > }
    > - if (UDF_SB_PARTFUNC(sb, partition))
    > - return UDF_SB_PARTFUNC(sb, partition)(sb, block, partition, offset);
    > + map = udf_sb_partmap(sb, partition);
    > + if (map->s_partition_func)
    > + return map->s_partition_func(sb, block, partition, offset);
    > else
    > - return UDF_SB_PARTROOT(sb, partition) + block + offset;
    > + return map->s_partition_root + block + offset;
    > }
    >
    > uint32_t udf_get_pblock_virt15(struct super_block *sb, uint32_t block,
    > @@ -49,12 +51,14 @@ uint32_t udf_get_pblock_virt15(struct super_block *sb, uint32_t block,
    > uint32_t newblock;
    > uint32_t index;
    > uint32_t loc;
    > + struct udf_part_map *map;
    >
    > - index = (sb->s_blocksize - UDF_SB_TYPEVIRT(sb,partition).s_start_offset) / sizeof(uint32_t);
    > + map = udf_sb_partmap(sb, partition);
    > + index = (sb->s_blocksize - map->s_type_specific.s_virtual.s_start_offset) / sizeof(uint32_t);
    >
    > - if (block > UDF_SB_TYPEVIRT(sb,partition).s_num_entries) {
    > + if (block > map->s_type_specific.s_virtual.s_num_entries) {
    > udf_debug("Trying to access block beyond end of VAT (%d max %d)\n",
    > - block, UDF_SB_TYPEVIRT(sb,partition).s_num_entries);
    > + block, map->s_type_specific.s_virtual.s_num_entries);
    > return 0xFFFFFFFF;
    > }
    >
    > @@ -64,7 +68,7 @@ uint32_t udf_get_pblock_virt15(struct super_block *sb, uint32_t block,
    > index = block % (sb->s_blocksize / sizeof(uint32_t));
    > } else {
    > newblock = 0;
    > - index = UDF_SB_TYPEVIRT(sb,partition).s_start_offset / sizeof(uint32_t) + block;
    > + index = map->s_type_specific.s_virtual.s_start_offset / sizeof(uint32_t) + block;
    > }
    >
    > loc = udf_block_map(udf_sb_vat_inode(sb), newblock);
    > @@ -100,11 +104,15 @@ uint32_t udf_get_pblock_spar15(struct super_block * sb, uint32_t block,
    > {
    > int i;
    > struct sparingTable *st = NULL;
    > - uint32_t packet = (block + offset) & ~(UDF_SB_TYPESPAR(sb,partition).s_packet_len - 1);
    > + struct udf_part_map *map;
    > + uint32_t packet;
    > +
    > + map = udf_sb_partmap(sb, partition);
    > + packet = (block + offset) & ~(map->s_type_specific.s_sparing.s_packet_len - 1);
    >
    > for (i = 0; i < 4; i++) {
    > - if (UDF_SB_TYPESPAR(sb,partition).s_spar_map[i] != NULL) {
    > - st = (struct sparingTable *)UDF_SB_TYPESPAR(sb,partition).s_spar_map[i]->b_data;
    > + if (map->s_type_specific.s_sparing.s_spar_map[i] != NULL) {
    > + st = (struct sparingTable *)map->s_type_specific.s_sparing.s_spar_map[i]->b_data;
    > break;
    > }
    > }
    > @@ -115,14 +123,14 @@ uint32_t udf_get_pblock_spar15(struct super_block * sb, uint32_t block,
    > break;
    > } else if (le32_to_cpu(st->mapEntry[i].origLocation) == packet) {
    > return le32_to_cpu(st->mapEntry[i].mappedLocation) +
    > - ((block + offset) & (UDF_SB_TYPESPAR(sb,partition).s_packet_len - 1));
    > + ((block + offset) & (map->s_type_specific.s_sparing.s_packet_len - 1));
    > } else if (le32_to_cpu(st->mapEntry[i].origLocation) > packet) {
    > break;
    > }
    > }
    > }
    >
    > - return UDF_SB_PARTROOT(sb,partition) + block + offset;
    > + return map->s_partition_root + block + offset;
    > }
    >
    > int udf_relocate_blocks(struct super_block *sb, long old_block, long *new_block)
    > @@ -134,13 +142,14 @@ int udf_relocate_blocks(struct super_block *sb, long old_block, long *new_block)
    > int i, j, k, l;
    >
    > for (i = 0; i < udf_sb_num_parts(sb); i++) {
    > - if (old_block > UDF_SB_PARTROOT(sb,i) &&
    > - old_block < UDF_SB_PARTROOT(sb,i) + UDF_SB_PARTLEN(sb,i)) {
    > - sdata = &UDF_SB_TYPESPAR(sb,i);
    > - packet = (old_block - UDF_SB_PARTROOT(sb,i)) & ~(sdata->s_packet_len - 1);
    > + struct udf_part_map *map = udf_sb_partmap(sb, i);
    > + if (old_block > map->s_partition_root &&
    > + old_block < map->s_partition_root + map->s_partition_len) {
    > + sdata = &map->s_type_specific.s_sparing;
    > + packet = (old_block - map->s_partition_root) & ~(sdata->s_packet_len - 1);
    >
    > for (j = 0; j < 4; j++) {
    > - if (UDF_SB_TYPESPAR(sb,i).s_spar_map[j] != NULL) {
    > + if (map->s_type_specific.s_sparing.s_spar_map[j] != NULL) {
    > st = (struct sparingTable *)sdata->s_spar_map[j]->b_data;
    > break;
    > }
    > @@ -160,11 +169,11 @@ int udf_relocate_blocks(struct super_block *sb, long old_block, long *new_block)
    > }
    > }
    > *new_block = le32_to_cpu(st->mapEntry[k].mappedLocation) +
    > - ((old_block - UDF_SB_PARTROOT(sb,i)) & (sdata->s_packet_len - 1));
    > + ((old_block - map->s_partition_root) & (sdata->s_packet_len - 1));
    > return 0;
    > } else if (le32_to_cpu(st->mapEntry[k].origLocation) == packet) {
    > *new_block = le32_to_cpu(st->mapEntry[k].mappedLocation) +
    > - ((old_block - UDF_SB_PARTROOT(sb,i)) & (sdata->s_packet_len - 1));
    > + ((old_block - map->s_partition_root) & (sdata->s_packet_len - 1));
    > return 0;
    > } else if (le32_to_cpu(st->mapEntry[k].origLocation) > packet) {
    > break;
    > @@ -185,7 +194,7 @@ int udf_relocate_blocks(struct super_block *sb, long old_block, long *new_block)
    > }
    > }
    > *new_block = le32_to_cpu(st->mapEntry[k].mappedLocation) +
    > - ((old_block - UDF_SB_PARTROOT(sb,i)) & (sdata->s_packet_len - 1));
    > + ((old_block - map->s_partition_root) & (sdata->s_packet_len - 1));
    > return 0;
    > }
    > }
    > diff --git a/fs/udf/super.c b/fs/udf/super.c
    > index f8c5794..33ccf66 100644
    > --- a/fs/udf/super.c
    > +++ b/fs/udf/super.c
    > @@ -795,8 +795,9 @@ static int udf_find_fileset(struct super_block *sb,
    > fileset->logicalBlockNum == 0xFFFFFFFF &&
    > fileset->partitionReferenceNum == 0xFFFF);
    > newfileset.partitionReferenceNum--) {
    > - lastblock = UDF_SB_PARTLEN(sb,
    > - newfileset.partitionReferenceNum);
    > + lastblock = udf_sb_partmap(sb,
    > + newfileset.partitionReferenceNum)->
    > + s_partition_len;
    > newfileset.logicalBlockNum = 0;
    >
    > do {
    > @@ -904,23 +905,25 @@ static int udf_load_partdesc(struct super_block *sb, struct buffer_head *bh)
    > {
    > struct partitionDesc *p;
    > int i;
    > + struct udf_part_map *map;
    >
    > p = (struct partitionDesc *)bh->b_data;
    >
    > for (i = 0; i < udf_sb_num_parts(sb); i++) {
    > + map = udf_sb_partmap(sb, i);
    > udf_debug("Searching map: (%d == %d)\n",
    > - udf_sb_partmaps(sb)[i].s_partition_num, le16_to_cpu(p->partitionNumber));
    > - if (udf_sb_partmaps(sb)[i].s_partition_num == le16_to_cpu(p->partitionNumber)) {
    > - UDF_SB_PARTLEN(sb, i) = le32_to_cpu(p->partitionLength); /* blocks */
    > - UDF_SB_PARTROOT(sb, i) = le32_to_cpu(p->partitionStartingLocation);
    > + map->s_partition_num, le16_to_cpu(p->partitionNumber));
    > + if (map->s_partition_num == le16_to_cpu(p->partitionNumber)) {
    > + map->s_partition_len = le32_to_cpu(p->partitionLength); /* blocks */
    > + map->s_partition_root = le32_to_cpu(p->partitionStartingLocation);
    > if (le32_to_cpu(p->accessType) == PD_ACCESS_TYPE_READ_ONLY)
    > - UDF_SB_PARTFLAGS(sb, i) |= UDF_PART_FLAG_READ_ONLY;
    > + map->s_partition_flags |= UDF_PART_FLAG_READ_ONLY;
    > if (le32_to_cpu(p->accessType) == PD_ACCESS_TYPE_WRITE_ONCE)
    > - UDF_SB_PARTFLAGS(sb, i) |= UDF_PART_FLAG_WRITE_ONCE;
    > + map->s_partition_flags |= UDF_PART_FLAG_WRITE_ONCE;
    > if (le32_to_cpu(p->accessType) == PD_ACCESS_TYPE_REWRITABLE)
    > - UDF_SB_PARTFLAGS(sb, i) |= UDF_PART_FLAG_REWRITABLE;
    > + map->s_partition_flags |= UDF_PART_FLAG_REWRITABLE;
    > if (le32_to_cpu(p->accessType) == PD_ACCESS_TYPE_OVERWRITABLE)
    > - UDF_SB_PARTFLAGS(sb, i) |= UDF_PART_FLAG_OVERWRITABLE;
    > + map->s_partition_flags |= UDF_PART_FLAG_OVERWRITABLE;
    >
    > if (!strcmp(p->partitionContents.ident,
    > PD_PARTITION_CONTENTS_NSR02) ||
    > @@ -935,26 +938,26 @@ static int udf_load_partdesc(struct super_block *sb, struct buffer_head *bh)
    > .partitionReferenceNum = i,
    > };
    >
    > - udf_sb_partmaps(sb)[i].s_uspace.s_table =
    > + map->s_uspace.s_table =
    > udf_iget(sb, loc);
    > - if (!udf_sb_partmaps(sb)[i].s_uspace.s_table) {
    > + if (!map->s_uspace.s_table) {
    > udf_debug("cannot load unallocSpaceTable (part %d)\n", i);
    > return 1;
    > }
    > - UDF_SB_PARTFLAGS(sb, i) |= UDF_PART_FLAG_UNALLOC_TABLE;
    > + map->s_partition_flags |= UDF_PART_FLAG_UNALLOC_TABLE;
    > udf_debug("unallocSpaceTable (part %d) @ %ld\n",
    > - i, udf_sb_partmaps(sb)[i].s_uspace.s_table->i_ino);
    > + i, map->s_uspace.s_table->i_ino);
    > }
    > if (phd->unallocSpaceBitmap.extLength) {
    > UDF_SB_ALLOC_BITMAP(sb, i, s_uspace);
    > - if (udf_sb_partmaps(sb)[i].s_uspace.s_bitmap != NULL) {
    > - udf_sb_partmaps(sb)[i].s_uspace.s_bitmap->s_extLength =
    > + if (map->s_uspace.s_bitmap != NULL) {
    > + map->s_uspace.s_bitmap->s_extLength =
    > le32_to_cpu(phd->unallocSpaceBitmap.extLength);
    > - udf_sb_partmaps(sb)[i].s_uspace.s_bitmap->s_extPosition =
    > + map->s_uspace.s_bitmap->s_extPosition =
    > le32_to_cpu(phd->unallocSpaceBitmap.extPosition);
    > - UDF_SB_PARTFLAGS(sb, i) |= UDF_PART_FLAG_UNALLOC_BITMAP;
    > + map->s_partition_flags |= UDF_PART_FLAG_UNALLOC_BITMAP;
    > udf_debug("unallocSpaceBitmap (part %d) @ %d\n",
    > - i, udf_sb_partmaps(sb)[i].s_uspace.s_bitmap->s_extPosition);
    > + i, map->s_uspace.s_bitmap->s_extPosition);
    > }
    > }
    > if (phd->partitionIntegrityTable.extLength)
    > @@ -965,26 +968,26 @@ static int udf_load_partdesc(struct super_block *sb, struct buffer_head *bh)
    > .partitionReferenceNum = i,
    > };
    >
    > - udf_sb_partmaps(sb)[i].s_fspace.s_table =
    > + map->s_fspace.s_table =
    > udf_iget(sb, loc);
    > - if (!udf_sb_partmaps(sb)[i].s_fspace.s_table) {
    > + if (!map->s_fspace.s_table) {
    > udf_debug("cannot load freedSpaceTable (part %d)\n", i);
    > return 1;
    > }
    > - UDF_SB_PARTFLAGS(sb, i) |= UDF_PART_FLAG_FREED_TABLE;
    > + map->s_partition_flags |= UDF_PART_FLAG_FREED_TABLE;
    > udf_debug("freedSpaceTable (part %d) @ %ld\n",
    > - i, udf_sb_partmaps(sb)[i].s_fspace.s_table->i_ino);
    > + i, map->s_fspace.s_table->i_ino);
    > }
    > if (phd->freedSpaceBitmap.extLength) {
    > UDF_SB_ALLOC_BITMAP(sb, i, s_fspace);
    > - if (udf_sb_partmaps(sb)[i].s_fspace.s_bitmap != NULL) {
    > - udf_sb_partmaps(sb)[i].s_fspace.s_bitmap->s_extLength =
    > + if (map->s_fspace.s_bitmap != NULL) {
    > + map->s_fspace.s_bitmap->s_extLength =
    > le32_to_cpu(phd->freedSpaceBitmap.extLength);
    > - udf_sb_partmaps(sb)[i].s_fspace.s_bitmap->s_extPosition =
    > + map->s_fspace.s_bitmap->s_extPosition =
    > le32_to_cpu(phd->freedSpaceBitmap.extPosition);
    > - UDF_SB_PARTFLAGS(sb, i) |= UDF_PART_FLAG_FREED_BITMAP;
    > + map->s_partition_flags |= UDF_PART_FLAG_FREED_BITMAP;
    > udf_debug("freedSpaceBitmap (part %d) @ %d\n",
    > - i, udf_sb_partmaps(sb)[i].s_fspace.s_bitmap->s_extPosition);
    > + i, map->s_fspace.s_bitmap->s_extPosition);
    > }
    > }
    > }
    > @@ -998,8 +1001,9 @@ static int udf_load_partdesc(struct super_block *sb, struct buffer_head *bh)
    > udf_debug("Partition (%d:%d type %x) starts at physical %d, "
    > "block length %d\n",
    > le16_to_cpu(p->partitionNumber), i,
    > - UDF_SB_PARTTYPE(sb, i), UDF_SB_PARTROOT(sb, i),
    > - UDF_SB_PARTLEN(sb, i));
    > + map->s_partition_type,
    > + map->s_partition_root,
    > + map->s_partition_len);
    > }
    > return 0;
    > }
    > @@ -1020,22 +1024,23 @@ static int udf_load_logicalvol(struct super_block *sb, struct buffer_head *bh,
    > for (i = 0, offset = 0;
    > i < udf_sb_num_parts(sb) && offset < le32_to_cpu(lvd->mapTableLength);
    > i++, offset += ((struct genericPartitionMap *)&(lvd->partitionMaps[offset]))->partitionMapLength) {
    > + struct udf_part_map *map = udf_sb_partmap(sb, i);
    > type = ((struct genericPartitionMap *)&(lvd->partitionMaps[offset]))->partitionMapType;
    > if (type == 1) {
    > struct genericPartitionMap1 *gpm1 = (struct genericPartitionMap1 *)&(lvd->partitionMaps[offset]);
    > - UDF_SB_PARTTYPE(sb, i) = UDF_TYPE1_MAP15;
    > - UDF_SB_PARTVSN(sb, i) = le16_to_cpu(gpm1->volSeqNum);
    > - UDF_SB_PARTNUM(sb, i) = le16_to_cpu(gpm1->partitionNum);
    > - UDF_SB_PARTFUNC(sb, i) = NULL;
    > + map->s_partition_type = UDF_TYPE1_MAP15;
    > + map->s_volumeseqnum = le16_to_cpu(gpm1->volSeqNum);
    > + map->s_partition_num = le16_to_cpu(gpm1->partitionNum);
    > + map->s_partition_func = NULL;
    > } else if (type == 2) {
    > struct udfPartitionMap2 *upm2 = (struct udfPartitionMap2 *)&(lvd->partitionMaps[offset]);
    > if (!strncmp(upm2->partIdent.ident, UDF_ID_VIRTUAL, strlen(UDF_ID_VIRTUAL))) {
    > if (le16_to_cpu(((__le16 *)upm2->partIdent.identSuffix)[0]) == 0x0150) {
    > - UDF_SB_PARTTYPE(sb, i) = UDF_VIRTUAL_MAP15;
    > - UDF_SB_PARTFUNC(sb, i) = udf_get_pblock_virt15;
    > + map->s_partition_type = UDF_VIRTUAL_MAP15;
    > + map->s_partition_func = udf_get_pblock_virt15;
    > } else if (le16_to_cpu(((__le16 *)upm2->partIdent.identSuffix)[0]) == 0x0200) {
    > - UDF_SB_PARTTYPE(sb, i) = UDF_VIRTUAL_MAP20;
    > - UDF_SB_PARTFUNC(sb, i) = udf_get_pblock_virt20;
    > + map->s_partition_type = UDF_VIRTUAL_MAP20;
    > + map->s_partition_func = udf_get_pblock_virt20;
    > }
    > } else if (!strncmp(upm2->partIdent.ident, UDF_ID_SPARABLE, strlen(UDF_ID_SPARABLE))) {
    > uint32_t loc;
    > @@ -1043,33 +1048,33 @@ static int udf_load_logicalvol(struct super_block *sb, struct buffer_head *bh,
    > struct sparingTable *st;
    > struct sparablePartitionMap *spm = (struct sparablePartitionMap *)&(lvd->partitionMaps[offset]);
    >
    > - UDF_SB_PARTTYPE(sb, i) = UDF_SPARABLE_MAP15;
    > - UDF_SB_TYPESPAR(sb, i).s_packet_len = le16_to_cpu(spm->packetLength);
    > + map->s_partition_type = UDF_SPARABLE_MAP15;
    > + map->s_type_specific.s_sparing.s_packet_len = le16_to_cpu(spm->packetLength);
    > for (j = 0; j < spm->numSparingTables; j++) {
    > loc = le32_to_cpu(spm->locSparingTable[j]);
    > - UDF_SB_TYPESPAR(sb, i).s_spar_map[j] =
    > + map->s_type_specific.s_sparing.s_spar_map[j] =
    > udf_read_tagged(sb, loc, loc, &ident);
    > - if (UDF_SB_TYPESPAR(sb, i).s_spar_map[j] != NULL) {
    > - st = (struct sparingTable *)UDF_SB_TYPESPAR(sb, i).s_spar_map[j]->b_data;
    > + if (map->s_type_specific.s_sparing.s_spar_map[j] != NULL) {
    > + st = (struct sparingTable *)map->s_type_specific.s_sparing.s_spar_map[j]->b_data;
    > if (ident != 0 ||
    > strncmp(st->sparingIdent.ident, UDF_ID_SPARING, strlen(UDF_ID_SPARING))) {
    > - brelse(UDF_SB_TYPESPAR(sb, i).s_spar_map[j]);
    > - UDF_SB_TYPESPAR(sb, i).s_spar_map[j] = NULL;
    > + brelse(map->s_type_specific.s_sparing.s_spar_map[j]);
    > + map->s_type_specific.s_sparing.s_spar_map[j] = NULL;
    > }
    > }
    > }
    > - UDF_SB_PARTFUNC(sb, i) = udf_get_pblock_spar15;
    > + map->s_partition_func = udf_get_pblock_spar15;
    > } else {
    > udf_debug("Unknown ident: %s\n",
    > upm2->partIdent.ident);
    > continue;
    > }
    > - UDF_SB_PARTVSN(sb, i) = le16_to_cpu(upm2->volSeqNum);
    > - UDF_SB_PARTNUM(sb, i) = le16_to_cpu(upm2->partitionNum);
    > + map->s_volumeseqnum = le16_to_cpu(upm2->volSeqNum);
    > + map->s_partition_num = le16_to_cpu(upm2->partitionNum);
    > }
    > udf_debug("Partition (%d:%d) type %d on volume %d\n",
    > - i, UDF_SB_PARTNUM(sb, i), type,
    > - UDF_SB_PARTVSN(sb, i));
    > + i, map->s_partition_num, type,
    > + map->s_volumeseqnum);
    > }
    >
    > if (fileset) {
    > @@ -1323,7 +1328,8 @@ static int udf_load_partition(struct super_block *sb, kernel_lb_addr *fileset)
    >
    > for (i = 0; i < udf_sb_num_parts(sb); i++) {
    > kernel_lb_addr uninitialized_var(ino);
    > - switch (UDF_SB_PARTTYPE(sb, i)) {
    > + struct udf_part_map *map = udf_sb_partmap(sb, i);
    > + switch (map->s_partition_type) {
    > case UDF_VIRTUAL_MAP15:
    > case UDF_VIRTUAL_MAP20:
    > if (!udf_sb_last_block(sb)) {
    > @@ -1338,11 +1344,12 @@ static int udf_load_partition(struct super_block *sb, kernel_lb_addr *fileset)
    > }
    >
    > for (j = 0; j < udf_sb_num_parts(sb); j++) {
    > + struct udf_part_map *map2 = udf_sb_partmap(sb, j);
    > if (j != i &&
    > - UDF_SB_PARTVSN(sb, i) == UDF_SB_PARTVSN(sb, j) &&
    > - UDF_SB_PARTNUM(sb, i) == UDF_SB_PARTNUM(sb, j)) {
    > + map->s_volumeseqnum == map2->s_volumeseqnum &&
    > + map->s_partition_num == map2->s_partition_num) {
    > ino.partitionReferenceNum = j;
    > - ino.logicalBlockNum = udf_sb_last_block(sb) - UDF_SB_PARTROOT(sb, j);
    > + ino.logicalBlockNum = udf_sb_last_block(sb) - map2->s_partition_root;
    > break;
    > }
    > }
    > @@ -1354,12 +1361,12 @@ static int udf_load_partition(struct super_block *sb, kernel_lb_addr *fileset)
    > if (!udf_sb_vat_inode(sb))
    > return 1;
    >
    > - if (UDF_SB_PARTTYPE(sb, i) == UDF_VIRTUAL_MAP15) {
    > - UDF_SB_TYPEVIRT(sb, i).s_start_offset =
    > + if (map->s_partition_type == UDF_VIRTUAL_MAP15) {
    > + map->s_type_specific.s_virtual.s_start_offset =
    > udf_ext0_offset(udf_sb_vat_inode(sb));
    > - UDF_SB_TYPEVIRT(sb, i).s_num_entries =
    > + map->s_type_specific.s_virtual.s_num_entries =
    > (udf_sb_vat_inode(sb)->i_size - 36) >> 2;
    > - } else if (UDF_SB_PARTTYPE(sb, i) == UDF_VIRTUAL_MAP20) {
    > + } else if (map->s_partition_type == UDF_VIRTUAL_MAP20) {
    > struct buffer_head *bh = NULL;
    > uint32_t pos;
    >
    > @@ -1367,16 +1374,18 @@ static int udf_load_partition(struct super_block *sb, kernel_lb_addr *fileset)
    > bh = sb_bread(sb, pos);
    > if (!bh)
    > return 1;
    > - UDF_SB_TYPEVIRT(sb, i).s_start_offset =
    > + map->s_type_specific.s_virtual.s_start_offset =
    > le16_to_cpu(((struct virtualAllocationTable20 *)bh->b_data +
    > udf_ext0_offset(udf_sb_vat_inode(sb)))->lengthHeader) +
    > udf_ext0_offset(udf_sb_vat_inode(sb));
    > - UDF_SB_TYPEVIRT(sb, i).s_num_entries = (udf_sb_vat_inode(sb)->i_size -
    > - UDF_SB_TYPEVIRT(sb, i).s_start_offset) >> 2;
    > + map->s_type_specific.s_virtual.s_num_entries = (udf_sb_vat_inode(sb)->i_size -
    > + map->s_type_specific.s_virtual.s_start_offset) >> 2;
    > brelse(bh);
    > }
    > - UDF_SB_PARTROOT(sb, i) = udf_get_pblock(sb, 0, i, 0);
    > - UDF_SB_PARTLEN(sb, i) = UDF_SB_PARTLEN(sb, ino.partitionReferenceNum);
    > + map->s_partition_root = udf_get_pblock(sb, 0, i, 0);
    > + map->s_partition_len =
    > + udf_sb_partmap(sb, ino.partitionReferenceNum)->
    > + s_partition_len;
    > }
    > }
    > return 0;
    > @@ -1573,7 +1582,7 @@ static int udf_fill_super(struct super_block *sb, void *options, int silent)
    > goto error_out;
    > }
    >
    > - if (UDF_SB_PARTFLAGS(sb, udf_sb_partition(sb)) & UDF_PART_FLAG_READ_ONLY) {
    > + if (udf_sb_partmap(sb, udf_sb_partition(sb))->s_partition_flags & UDF_PART_FLAG_READ_ONLY) {
    > printk(KERN_NOTICE "UDF-fs: Partition marked readonly; forcing readonly mount\n");
    > sb->s_flags |= MS_RDONLY;
    > }
    > @@ -1619,17 +1628,18 @@ error_out:
    > if (udf_sb_vat_inode(sb))
    > iput(udf_sb_vat_inode(sb));
    > if (udf_sb_num_parts(sb)) {
    > - if (UDF_SB_PARTFLAGS(sb, udf_sb_partition(sb)) & UDF_PART_FLAG_UNALLOC_TABLE)
    > - iput(udf_sb_partmaps(sb)[udf_sb_partition(sb)].s_uspace.s_table);
    > - if (UDF_SB_PARTFLAGS(sb, udf_sb_partition(sb)) & UDF_PART_FLAG_FREED_TABLE)
    > - iput(udf_sb_partmaps(sb)[udf_sb_partition(sb)].s_fspace.s_table);
    > - if (UDF_SB_PARTFLAGS(sb, udf_sb_partition(sb)) & UDF_PART_FLAG_UNALLOC_BITMAP)
    > + struct udf_part_map *map = udf_sb_partmap(sb, udf_sb_partition(sb));
    > + if (map->s_partition_flags & UDF_PART_FLAG_UNALLOC_TABLE)
    > + iput(map->s_uspace.s_table);
    > + if (map->s_partition_flags & UDF_PART_FLAG_FREED_TABLE)
    > + iput(map->s_fspace.s_table);
    > + if (map->s_partition_flags & UDF_PART_FLAG_UNALLOC_BITMAP)
    > UDF_SB_FREE_BITMAP(sb, udf_sb_partition(sb), s_uspace);
    > - if (UDF_SB_PARTFLAGS(sb, udf_sb_partition(sb)) & UDF_PART_FLAG_FREED_BITMAP)
    > + if (map->s_partition_flags & UDF_PART_FLAG_FREED_BITMAP)
    > UDF_SB_FREE_BITMAP(sb, udf_sb_partition(sb), s_fspace);
    > - if (UDF_SB_PARTTYPE(sb, udf_sb_partition(sb)) == UDF_SPARABLE_MAP15) {
    > + if (map->s_partition_type == UDF_SPARABLE_MAP15) {
    > for (i = 0; i < 4; i++)
    > - brelse(UDF_SB_TYPESPAR(sb, udf_sb_partition(sb)).s_spar_map[i]);
    > + brelse(map->s_type_specific.s_sparing.s_spar_map[i]);
    > }
    > }
    > #ifdef CONFIG_UDF_NLS
    > @@ -1694,17 +1704,18 @@ static void udf_put_super(struct super_block *sb)
    > if (udf_sb_vat_inode(sb))
    > iput(udf_sb_vat_inode(sb));
    > if (udf_sb_num_parts(sb)) {
    > - if (UDF_SB_PARTFLAGS(sb, udf_sb_partition(sb)) & UDF_PART_FLAG_UNALLOC_TABLE)
    > - iput(udf_sb_partmaps(sb)[udf_sb_partition(sb)].s_uspace.s_table);
    > - if (UDF_SB_PARTFLAGS(sb, udf_sb_partition(sb)) & UDF_PART_FLAG_FREED_TABLE)
    > - iput(udf_sb_partmaps(sb)[udf_sb_partition(sb)].s_fspace.s_table);
    > - if (UDF_SB_PARTFLAGS(sb, udf_sb_partition(sb)) & UDF_PART_FLAG_UNALLOC_BITMAP)
    > + struct udf_part_map *map = udf_sb_partmap(sb, udf_sb_partition(sb));
    > + if (map->s_partition_flags & UDF_PART_FLAG_UNALLOC_TABLE)
    > + iput(map->s_uspace.s_table);
    > + if (map->s_partition_flags & UDF_PART_FLAG_FREED_TABLE)
    > + iput(map->s_fspace.s_table);
    > + if (map->s_partition_flags & UDF_PART_FLAG_UNALLOC_BITMAP)
    > UDF_SB_FREE_BITMAP(sb, udf_sb_partition(sb), s_uspace);
    > - if (UDF_SB_PARTFLAGS(sb, udf_sb_partition(sb)) & UDF_PART_FLAG_FREED_BITMAP)
    > + if (map->s_partition_flags & UDF_PART_FLAG_FREED_BITMAP)
    > UDF_SB_FREE_BITMAP(sb, udf_sb_partition(sb), s_fspace);
    > - if (UDF_SB_PARTTYPE(sb, udf_sb_partition(sb)) == UDF_SPARABLE_MAP15) {
    > + if (map->s_partition_type == UDF_SPARABLE_MAP15) {
    > for (i = 0; i < 4; i++)
    > - brelse(UDF_SB_TYPESPAR(sb, udf_sb_partition(sb)).s_spar_map[i]);
    > + brelse(map->s_type_specific.s_sparing.s_spar_map[i]);
    > }
    > }
    > #ifdef CONFIG_UDF_NLS
    > @@ -1738,7 +1749,7 @@ static int udf_statfs(struct dentry *dentry, struct kstatfs *buf)
    >
    > buf->f_type = UDF_SUPER_MAGIC;
    > buf->f_bsize = sb->s_blocksize;
    > - buf->f_blocks = UDF_SB_PARTLEN(sb, udf_sb_partition(sb));
    > + buf->f_blocks = udf_sb_partmap(sb, udf_sb_partition(sb))->s_partition_len;
    > buf->f_bfree = udf_count_free(sb);
    > buf->f_bavail = buf->f_bfree;
    > buf->f_files = (udf_sb_lvid_bh(sb) ?
    > @@ -1843,6 +1854,7 @@ static unsigned int udf_count_free_table(struct super_block *sb, struct inode *t
    > static unsigned int udf_count_free(struct super_block *sb)
    > {
    > unsigned int accum = 0;
    > + struct udf_part_map *map;
    >
    > if (udf_sb_lvid_bh(sb)) {
    > if (le32_to_cpu(udf_sb_lvid(sb)->numOfPartitions) > udf_sb_partition(sb)) {
    > @@ -1855,24 +1867,25 @@ static unsigned int udf_count_free(struct super_block *sb)
    > if (accum)
    > return accum;
    >
    > - if (UDF_SB_PARTFLAGS(sb, udf_sb_partition(sb)) & UDF_PART_FLAG_UNALLOC_BITMAP) {
    > + map = udf_sb_partmap(sb, udf_sb_partition(sb));
    > + if (map->s_partition_flags & UDF_PART_FLAG_UNALLOC_BITMAP) {
    > accum += udf_count_free_bitmap(sb,
    > - udf_sb_partmaps(sb)[udf_sb_partition(sb)].s_uspace.s_bitmap);
    > + map->s_uspace.s_bitmap);
    > }
    > - if (UDF_SB_PARTFLAGS(sb, udf_sb_partition(sb)) & UDF_PART_FLAG_FREED_BITMAP) {
    > + if (map->s_partition_flags & UDF_PART_FLAG_FREED_BITMAP) {
    > accum += udf_count_free_bitmap(sb,
    > - udf_sb_partmaps(sb)[udf_sb_partition(sb)].s_fspace.s_bitmap);
    > + map->s_fspace.s_bitmap);
    > }
    > if (accum)
    > return accum;
    >
    > - if (UDF_SB_PARTFLAGS(sb, udf_sb_partition(sb)) & UDF_PART_FLAG_UNALLOC_TABLE) {
    > + if (map->s_partition_flags & UDF_PART_FLAG_UNALLOC_TABLE) {
    > accum += udf_count_free_table(sb,
    > - udf_sb_partmaps(sb)[udf_sb_partition(sb)].s_uspace.s_table);
    > + map->s_uspace.s_table);
    > }
    > - if (UDF_SB_PARTFLAGS(sb, udf_sb_partition(sb)) & UDF_PART_FLAG_FREED_TABLE) {
    > + if (map->s_partition_flags & UDF_PART_FLAG_FREED_TABLE) {
    > accum += udf_count_free_table(sb,
    > - udf_sb_partmaps(sb)[udf_sb_partition(sb)].s_fspace.s_table);
    > + map->s_fspace.s_table);
    > }
    >
    > return accum;
    > diff --git a/fs/udf/udf_sb.h b/fs/udf/udf_sb.h
    > index aee5942..a5805c5 100644
    > --- a/fs/udf/udf_sb.h
    > +++ b/fs/udf/udf_sb.h
    > @@ -48,6 +48,11 @@ static inline struct udf_part_map *udf_sb_partmaps(struct super_block *sb)
    > return udf_sb(sb)->s_partmaps;
    > }
    >
    > +static inline struct udf_part_map *udf_sb_partmap(struct super_block *sb, __u32 index)
    > +{
    > + return udf_sb_partmaps(sb) + index;
    > +}
    > +
    > static inline int __must_check udf_sb_alloc_partition_maps(struct super_block *sb, __u32 count)
    > {
    > struct udf_sb_info *info = udf_sb(sb);
    > @@ -146,7 +151,7 @@ static inline void udf_update_revision(struct super_block *sb, __u16 revision)
    >
    > #define UDF_SB_ALLOC_BITMAP(X,Y,Z)\
    > {\
    > - int nr_groups = ((UDF_SB_PARTLEN((X),(Y)) + (sizeof(struct spaceBitmapDesc) << 3) +\
    > + 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)\
    > @@ -182,15 +187,6 @@ static inline void udf_update_revision(struct super_block *sb, __u16 revision)
    > #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_PARTTYPE(X,Y) ( udf_sb_partmaps(X)[(Y)].s_partition_type )
    > -#define UDF_SB_PARTROOT(X,Y) ( udf_sb_partmaps(X)[(Y)].s_partition_root )
    > -#define UDF_SB_PARTLEN(X,Y) ( udf_sb_partmaps(X)[(Y)].s_partition_len )
    > -#define UDF_SB_PARTVSN(X,Y) ( udf_sb_partmaps(X)[(Y)].s_volumeseqnum )
    > -#define UDF_SB_PARTNUM(X,Y) ( udf_sb_partmaps(X)[(Y)].s_partition_num )
    > -#define UDF_SB_TYPESPAR(X,Y) ( udf_sb_partmaps(X)[(Y)].s_type_specific.s_sparing )
    > -#define UDF_SB_TYPEVIRT(X,Y) ( udf_sb_partmaps(X)[(Y)].s_type_specific.s_virtual )
    > -#define UDF_SB_PARTFUNC(X,Y) ( udf_sb_partmaps(X)[(Y)].s_partition_func )
    > -#define UDF_SB_PARTFLAGS(X,Y) ( udf_sb_partmaps(X)[(Y)].s_partition_flags )
    > #define UDF_SB_BITMAP(X,Y,Z,I) ( udf_sb_partmaps(X)[(Y)].Z.s_bitmap->s_block_bitmap[I] )
    > #define UDF_SB_BITMAP_NR_GROUPS(X,Y,Z) ( udf_sb_partmaps(X)[(Y)].Z.s_bitmap->s_nr_groups )
    >
    > --
    > 1.5.3.4
    >

    --
    Jan Kara
    SUSE Labs, CR
    --
    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to majordomo@vger.kernel.org
    More majordomo info at http://vger.kernel.org/majordomo-info.html
    Please read the FAQ at http://www.tux.org/lkml/

  12. Re: [PATCH 22/24] udf: convert UDF_SB_ALLOC_BITMAP macro to udf_sb_alloc_bitmap function

    On Sun 23-12-07 02:51:12, marcin.slusarz@gmail.com wrote:
    > Signed-off-by: Marcin Slusarz
    > CC: Ben Fennema
    > CC: Jan Kara

    Looks much better . Acked-by: Jan Kara

    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
    > +#include
    >
    > /* 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
    SUSE Labs, CR
    --
    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to majordomo@vger.kernel.org
    More majordomo info at http://vger.kernel.org/majordomo-info.html
    Please read the FAQ at http://www.tux.org/lkml/

  13. Re: [PATCH 19/24] udf: check if udf_load_logicalvol failed

    On Mon, Jan 07, 2008 at 12:29:51PM +0100, Jan Kara wrote:
    > On Sun 23-12-07 02:51:09, marcin.slusarz@gmail.com wrote:
    > > udf_load_logicalvol may fail eg in out of memory conditions - check it
    > > and propagate error further
    > >
    > > Signed-off-by: Marcin Slusarz
    > > CC: Ben Fennema
    > > CC: Jan Kara

    > I certainly agree with the idea of the change. Just note that
    > udf_process_sequence() returns 1 in case of failure so propagating an error
    > is not ideal - we should keep things consistent. And also note that the
    > actual value is disregarded in udf_load_partition() anyway.

    OK, I will make it consistent in next version.

    Marcin
    --
    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to majordomo@vger.kernel.org
    More majordomo info at http://vger.kernel.org/majordomo-info.html
    Please read the FAQ at http://www.tux.org/lkml/

+ Reply to Thread
Page 2 of 2 FirstFirst 1 2