Skip to content
/ linux Public
forked from torvalds/linux

Commit

Permalink
udf: Drop freed bitmap / table support
Browse files Browse the repository at this point in the history
We don't support Free Space Table and Free Space Bitmap as specified by
UDF standard for writing as we don't support erasing blocks before
overwriting them. Just drop the handling of these structures as
partition descriptor checking code already makes sure such filesystems
can be mounted only read-only.

Signed-off-by: Jan Kara <[email protected]>
  • Loading branch information
jankara committed Sep 7, 2018
1 parent b085fbe commit 694538b
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 74 deletions.
24 changes: 0 additions & 24 deletions fs/udf/balloc.c
Original file line number Diff line number Diff line change
Expand Up @@ -650,12 +650,6 @@ void udf_free_blocks(struct super_block *sb, struct inode *inode,
} else if (map->s_partition_flags & UDF_PART_FLAG_UNALLOC_TABLE) {
udf_table_free_blocks(sb, map->s_uspace.s_table,
bloc, offset, count);
} else if (map->s_partition_flags & UDF_PART_FLAG_FREED_BITMAP) {
udf_bitmap_free_blocks(sb, map->s_fspace.s_bitmap,
bloc, offset, count);
} else if (map->s_partition_flags & UDF_PART_FLAG_FREED_TABLE) {
udf_table_free_blocks(sb, map->s_fspace.s_table,
bloc, offset, count);
}

if (inode) {
Expand All @@ -682,16 +676,6 @@ inline int udf_prealloc_blocks(struct super_block *sb,
map->s_uspace.s_table,
partition, first_block,
block_count);
else if (map->s_partition_flags & UDF_PART_FLAG_FREED_BITMAP)
allocated = udf_bitmap_prealloc_blocks(sb,
map->s_fspace.s_bitmap,
partition, first_block,
block_count);
else if (map->s_partition_flags & UDF_PART_FLAG_FREED_TABLE)
allocated = udf_table_prealloc_blocks(sb,
map->s_fspace.s_table,
partition, first_block,
block_count);
else
return 0;

Expand All @@ -715,14 +699,6 @@ inline udf_pblk_t udf_new_block(struct super_block *sb,
block = udf_table_new_block(sb,
map->s_uspace.s_table,
partition, goal, err);
else if (map->s_partition_flags & UDF_PART_FLAG_FREED_BITMAP)
block = udf_bitmap_new_block(sb,
map->s_fspace.s_bitmap,
partition, goal, err);
else if (map->s_partition_flags & UDF_PART_FLAG_FREED_TABLE)
block = udf_table_new_block(sb,
map->s_fspace.s_table,
partition, goal, err);
else {
*err = -EIO;
return 0;
Expand Down
44 changes: 0 additions & 44 deletions fs/udf/super.c
Original file line number Diff line number Diff line change
Expand Up @@ -290,12 +290,8 @@ static void udf_free_partition(struct udf_part_map *map)

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(map->s_uspace.s_bitmap);
if (map->s_partition_flags & UDF_PART_FLAG_FREED_BITMAP)
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]);
Expand Down Expand Up @@ -1105,37 +1101,6 @@ static int udf_fill_partdesc_info(struct super_block *sb,
p_index, bitmap->s_extPosition);
}

if (phd->freedSpaceTable.extLength) {
struct kernel_lb_addr loc = {
.logicalBlockNum = le32_to_cpu(
phd->freedSpaceTable.extPosition),
.partitionReferenceNum = p_index,
};
struct inode *inode;

inode = udf_iget_special(sb, &loc);
if (IS_ERR(inode)) {
udf_debug("cannot load freedSpaceTable (part %d)\n",
p_index);
return PTR_ERR(inode);
}
map->s_fspace.s_table = inode;
map->s_partition_flags |= UDF_PART_FLAG_FREED_TABLE;
udf_debug("freedSpaceTable (part %d) @ %lu\n",
p_index, map->s_fspace.s_table->i_ino);
}

if (phd->freedSpaceBitmap.extLength) {
struct udf_bitmap *bitmap = udf_sb_alloc_bitmap(sb, p_index);
if (!bitmap)
return -ENOMEM;
map->s_fspace.s_bitmap = bitmap;
bitmap->s_extPosition = le32_to_cpu(
phd->freedSpaceBitmap.extPosition);
map->s_partition_flags |= UDF_PART_FLAG_FREED_BITMAP;
udf_debug("freedSpaceBitmap (part %d) @ %u\n",
p_index, bitmap->s_extPosition);
}
return 0;
}

Expand Down Expand Up @@ -2490,22 +2455,13 @@ static unsigned int udf_count_free(struct super_block *sb)
accum += udf_count_free_bitmap(sb,
map->s_uspace.s_bitmap);
}
if (map->s_partition_flags & UDF_PART_FLAG_FREED_BITMAP) {
accum += udf_count_free_bitmap(sb,
map->s_fspace.s_bitmap);
}
if (accum)
return accum;

if (map->s_partition_flags & UDF_PART_FLAG_UNALLOC_TABLE) {
accum += udf_count_free_table(sb,
map->s_uspace.s_table);
}
if (map->s_partition_flags & UDF_PART_FLAG_FREED_TABLE) {
accum += udf_count_free_table(sb,
map->s_fspace.s_table);
}

return accum;
}

Expand Down
6 changes: 0 additions & 6 deletions fs/udf/udf_sb.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,6 @@

#define UDF_PART_FLAG_UNALLOC_BITMAP 0x0001
#define UDF_PART_FLAG_UNALLOC_TABLE 0x0002
#define UDF_PART_FLAG_FREED_BITMAP 0x0004
#define UDF_PART_FLAG_FREED_TABLE 0x0008
#define UDF_PART_FLAG_READ_ONLY 0x0010
#define UDF_PART_FLAG_WRITE_ONCE 0x0020
#define UDF_PART_FLAG_REWRITABLE 0x0040
Expand Down Expand Up @@ -95,10 +93,6 @@ struct udf_part_map {
struct udf_bitmap *s_bitmap;
struct inode *s_table;
} s_uspace;
union {
struct udf_bitmap *s_bitmap;
struct inode *s_table;
} s_fspace;
__u32 s_partition_root;
__u32 s_partition_len;
__u16 s_partition_type;
Expand Down

0 comments on commit 694538b

Please sign in to comment.