Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 319487
b: refs/heads/master
c: eb04cf6
h: refs/heads/master
i:
  319485: e456c9f
  319483: 1645a16
  319479: 22ab821
  319471: c13555c
  319455: 3c1b36b
  319423: 24af2a5
  319359: 6a184d3
  319231: f9bb9a1
  318975: 43082f8
  318463: ce95fe4
  317439: 5248ab8
  315391: 759ec0d
  311295: de55070
v: v3
  • Loading branch information
Joe Thornber authored and Alasdair G Kergon committed Jul 27, 2012
1 parent fd32140 commit d09cb98
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 39 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 51a0f659c03ccc8ec407c7a9f9701d1b4618d515
refs/heads/master: eb04cf634fc2d5e3bc8fe88fbf434eda4921d875
40 changes: 2 additions & 38 deletions trunk/drivers/md/dm-thin-metadata.c
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,6 @@ struct dm_pool_metadata {

struct rw_semaphore root_lock;
uint32_t time;
int need_commit;
dm_block_t root;
dm_block_t details_root;
struct list_head thin_devices;
Expand Down Expand Up @@ -479,7 +478,6 @@ static int init_pmd(struct dm_pool_metadata *pmd,

init_rwsem(&pmd->root_lock);
pmd->time = 0;
pmd->need_commit = 0;
pmd->details_root = 0;
pmd->trans_id = 0;
pmd->flags = 0;
Expand All @@ -503,11 +501,6 @@ static int __begin_transaction(struct dm_pool_metadata *pmd)
struct thin_disk_superblock *disk_super;
struct dm_block *sblock;

/*
* __maybe_commit_transaction() resets these
*/
WARN_ON(pmd->need_commit);

/*
* We re-read the superblock every time. Shouldn't need to do this
* really.
Expand Down Expand Up @@ -583,8 +576,6 @@ static int __write_changed_details(struct dm_pool_metadata *pmd)
list_del(&td->list);
kfree(td);
}

pmd->need_commit = 1;
}

return 0;
Expand All @@ -609,9 +600,6 @@ static int __commit_transaction(struct dm_pool_metadata *pmd)
if (r < 0)
return r;

if (!pmd->need_commit)
return r;

r = dm_sm_commit(pmd->data_sm);
if (r < 0)
return r;
Expand Down Expand Up @@ -650,11 +638,7 @@ static int __commit_transaction(struct dm_pool_metadata *pmd)
if (r < 0)
goto out_locked;

r = dm_tm_commit(pmd->tm, sblock);
if (!r)
pmd->need_commit = 0;

return r;
return dm_tm_commit(pmd->tm, sblock);

out_locked:
dm_bm_unlock(sblock);
Expand Down Expand Up @@ -744,7 +728,6 @@ struct dm_pool_metadata *dm_pool_metadata_open(struct block_device *bdev,
}

pmd->flags = 0;
pmd->need_commit = 1;
r = dm_pool_commit_metadata(pmd);
if (r < 0) {
DMERR("%s: dm_pool_commit_metadata() failed, error = %d",
Expand Down Expand Up @@ -1042,8 +1025,6 @@ static int __delete_device(struct dm_pool_metadata *pmd, dm_thin_id dev)
if (r)
return r;

pmd->need_commit = 1;

return 0;
}

Expand Down Expand Up @@ -1071,7 +1052,6 @@ int dm_pool_set_metadata_transaction_id(struct dm_pool_metadata *pmd,
}

pmd->trans_id = new_id;
pmd->need_commit = 1;
up_write(&pmd->root_lock);

return 0;
Expand Down Expand Up @@ -1113,8 +1093,6 @@ static int __reserve_metadata_snap(struct dm_pool_metadata *pmd)

dm_tm_dec(pmd->tm, held_root);
dm_tm_unlock(pmd->tm, copy);
pmd->need_commit = 1;

return -EBUSY;
}

Expand All @@ -1140,16 +1118,12 @@ static int __reserve_metadata_snap(struct dm_pool_metadata *pmd)
&sb_validator, &sblock);
if (r) {
dm_tm_dec(pmd->tm, held_root);
pmd->need_commit = 1;
return r;
}

disk_super = dm_block_data(sblock);
disk_super->held_root = cpu_to_le64(held_root);
dm_bm_unlock(sblock);

pmd->need_commit = 1;

return 0;
}

Expand Down Expand Up @@ -1179,7 +1153,6 @@ static int __release_metadata_snap(struct dm_pool_metadata *pmd)
disk_super = dm_block_data(sblock);
held_root = le64_to_cpu(disk_super->held_root);
disk_super->held_root = cpu_to_le64(0);
pmd->need_commit = 1;

dm_bm_unlock(sblock);

Expand Down Expand Up @@ -1317,7 +1290,6 @@ static int __insert(struct dm_thin_device *td, dm_block_t block,
struct dm_pool_metadata *pmd = td->pmd;
dm_block_t keys[2] = { td->id, block };

pmd->need_commit = 1;
value = cpu_to_le64(pack_block_time(data_block, pmd->time));
__dm_bless_for_disk(&value);

Expand Down Expand Up @@ -1358,7 +1330,6 @@ static int __remove(struct dm_thin_device *td, dm_block_t block)

td->mapped_blocks--;
td->changed = 1;
pmd->need_commit = 1;

return 0;
}
Expand All @@ -1379,10 +1350,7 @@ int dm_pool_alloc_data_block(struct dm_pool_metadata *pmd, dm_block_t *result)
int r;

down_write(&pmd->root_lock);

r = dm_sm_new_block(pmd->data_sm, result);
pmd->need_commit = 1;

up_write(&pmd->root_lock);

return r;
Expand Down Expand Up @@ -1519,11 +1487,7 @@ static int __resize_data_dev(struct dm_pool_metadata *pmd, dm_block_t new_count)
return -EINVAL;
}

r = dm_sm_extend(pmd->data_sm, new_count - old_count);
if (!r)
pmd->need_commit = 1;

return r;
return dm_sm_extend(pmd->data_sm, new_count - old_count);
}

int dm_pool_resize_data_dev(struct dm_pool_metadata *pmd, dm_block_t new_count)
Expand Down

0 comments on commit d09cb98

Please sign in to comment.