From 130949d764c377852be9323de8a0b21694326f4c Mon Sep 17 00:00:00 2001 From: Alessio Igor Bogani Date: Tue, 16 Nov 2010 18:40:48 +0100 Subject: [PATCH] --- yaml --- r: 229151 b: refs/heads/master c: 7db09be629033b79792a1bf18f505f5f15914395 h: refs/heads/master i: 229149: 7672c98706f6eaa2388106876ac7c1b52afbba40 229147: cabdb11444c08a19534822a74229458556a27fc8 229143: 04b88d5f692b0d041029d7cb8131ff79f5160d21 229135: eaf3378b20b73ed126f6ebbdc0710ede655bfe07 229119: a77a20668cb84fb01a5e93eb346e441c0ff751df v: v3 --- [refs] | 2 +- trunk/fs/udf/partition.c | 27 +++++++++++++++++++-------- 2 files changed, 20 insertions(+), 9 deletions(-) diff --git a/[refs] b/[refs] index f0e2c4b10ec0..5d6daec1168b 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 4d0fb621d35007c19a396f2bb629e5aeaacef2d0 +refs/heads/master: 7db09be629033b79792a1bf18f505f5f15914395 diff --git a/trunk/fs/udf/partition.c b/trunk/fs/udf/partition.c index 745eb209be0c..a71090ea0e07 100644 --- a/trunk/fs/udf/partition.c +++ b/trunk/fs/udf/partition.c @@ -25,6 +25,7 @@ #include #include #include +#include uint32_t udf_get_pblock(struct super_block *sb, uint32_t block, uint16_t partition, uint32_t offset) @@ -159,7 +160,9 @@ int udf_relocate_blocks(struct super_block *sb, long old_block, long *new_block) struct udf_sb_info *sbi = UDF_SB(sb); u16 reallocationTableLen; struct buffer_head *bh; + int ret = 0; + mutex_lock(&sbi->s_alloc_mutex); for (i = 0; i < sbi->s_partitions; i++) { struct udf_part_map *map = &sbi->s_partmaps[i]; if (old_block > map->s_partition_root && @@ -175,8 +178,10 @@ int udf_relocate_blocks(struct super_block *sb, long old_block, long *new_block) break; } - if (!st) - return 1; + if (!st) { + ret = 1; + goto out; + } reallocationTableLen = le16_to_cpu(st->reallocationTableLen); @@ -207,14 +212,16 @@ int udf_relocate_blocks(struct super_block *sb, long old_block, long *new_block) ((old_block - map->s_partition_root) & (sdata->s_packet_len - 1)); - return 0; + ret = 0; + goto out; } else if (origLoc == packet) { *new_block = le32_to_cpu( entry->mappedLocation) + ((old_block - map->s_partition_root) & (sdata->s_packet_len - 1)); - return 0; + ret = 0; + goto out; } else if (origLoc > packet) break; } @@ -251,20 +258,24 @@ int udf_relocate_blocks(struct super_block *sb, long old_block, long *new_block) st->mapEntry[k].mappedLocation) + ((old_block - map->s_partition_root) & (sdata->s_packet_len - 1)); - return 0; + ret = 0; + goto out; } - return 1; + ret = 1; + goto out; } /* if old_block */ } if (i == sbi->s_partitions) { /* outside of partitions */ /* for now, fail =) */ - return 1; + ret = 1; } - return 0; +out: + mutex_unlock(&sbi->s_alloc_mutex); + return ret; } static uint32_t udf_try_read_meta(struct inode *inode, uint32_t block,