Loading drivers/md/dm-bufio.c +0 −77 Original line number Diff line number Diff line Loading @@ -1415,83 +1415,6 @@ int dm_bufio_issue_discard(struct dm_bufio_client *c, sector_t block, sector_t c } EXPORT_SYMBOL_GPL(dm_bufio_issue_discard); /* * We first delete any other buffer that may be at that new location. * * Then, we write the buffer to the original location if it was dirty. * * Then, if we are the only one who is holding the buffer, relink the buffer * in the buffer tree for the new location. * * If there was someone else holding the buffer, we write it to the new * location but not relink it, because that other user needs to have the buffer * at the same place. */ void dm_bufio_release_move(struct dm_buffer *b, sector_t new_block) { struct dm_bufio_client *c = b->c; struct dm_buffer *new; BUG_ON(dm_bufio_in_request()); dm_bufio_lock(c); retry: new = __find(c, new_block); if (new) { if (new->hold_count) { __wait_for_free_buffer(c); goto retry; } /* * FIXME: Is there any point waiting for a write that's going * to be overwritten in a bit? */ __make_buffer_clean(new); __unlink_buffer(new); __free_buffer_wake(new); } BUG_ON(!b->hold_count); BUG_ON(test_bit(B_READING, &b->state)); __write_dirty_buffer(b, NULL); if (b->hold_count == 1) { wait_on_bit_io(&b->state, B_WRITING, TASK_UNINTERRUPTIBLE); set_bit(B_DIRTY, &b->state); b->dirty_start = 0; b->dirty_end = c->block_size; __unlink_buffer(b); __link_buffer(b, new_block, LIST_DIRTY); } else { sector_t old_block; wait_on_bit_lock_io(&b->state, B_WRITING, TASK_UNINTERRUPTIBLE); /* * Relink buffer to "new_block" so that write_callback * sees "new_block" as a block number. * After the write, link the buffer back to old_block. * All this must be done in bufio lock, so that block number * change isn't visible to other threads. */ old_block = b->block; __unlink_buffer(b); __link_buffer(b, new_block, b->list_mode); submit_io(b, REQ_OP_WRITE, write_endio); wait_on_bit_io(&b->state, B_WRITING, TASK_UNINTERRUPTIBLE); __unlink_buffer(b); __link_buffer(b, old_block, b->list_mode); } dm_bufio_unlock(c); dm_bufio_release(b); } EXPORT_SYMBOL_GPL(dm_bufio_release_move); static void forget_buffer_locked(struct dm_buffer *b) { if (likely(!b->hold_count) && likely(!smp_load_acquire(&b->state))) { Loading include/linux/dm-bufio.h +0 −6 Original line number Diff line number Diff line Loading @@ -130,12 +130,6 @@ int dm_bufio_issue_flush(struct dm_bufio_client *c); */ int dm_bufio_issue_discard(struct dm_bufio_client *c, sector_t block, sector_t count); /* * Like dm_bufio_release but also move the buffer to the new * block. dm_bufio_write_dirty_buffers is needed to commit the new block. */ void dm_bufio_release_move(struct dm_buffer *b, sector_t new_block); /* * Free the given buffer. * This is just a hint, if the buffer is in use or dirty, this function Loading Loading
drivers/md/dm-bufio.c +0 −77 Original line number Diff line number Diff line Loading @@ -1415,83 +1415,6 @@ int dm_bufio_issue_discard(struct dm_bufio_client *c, sector_t block, sector_t c } EXPORT_SYMBOL_GPL(dm_bufio_issue_discard); /* * We first delete any other buffer that may be at that new location. * * Then, we write the buffer to the original location if it was dirty. * * Then, if we are the only one who is holding the buffer, relink the buffer * in the buffer tree for the new location. * * If there was someone else holding the buffer, we write it to the new * location but not relink it, because that other user needs to have the buffer * at the same place. */ void dm_bufio_release_move(struct dm_buffer *b, sector_t new_block) { struct dm_bufio_client *c = b->c; struct dm_buffer *new; BUG_ON(dm_bufio_in_request()); dm_bufio_lock(c); retry: new = __find(c, new_block); if (new) { if (new->hold_count) { __wait_for_free_buffer(c); goto retry; } /* * FIXME: Is there any point waiting for a write that's going * to be overwritten in a bit? */ __make_buffer_clean(new); __unlink_buffer(new); __free_buffer_wake(new); } BUG_ON(!b->hold_count); BUG_ON(test_bit(B_READING, &b->state)); __write_dirty_buffer(b, NULL); if (b->hold_count == 1) { wait_on_bit_io(&b->state, B_WRITING, TASK_UNINTERRUPTIBLE); set_bit(B_DIRTY, &b->state); b->dirty_start = 0; b->dirty_end = c->block_size; __unlink_buffer(b); __link_buffer(b, new_block, LIST_DIRTY); } else { sector_t old_block; wait_on_bit_lock_io(&b->state, B_WRITING, TASK_UNINTERRUPTIBLE); /* * Relink buffer to "new_block" so that write_callback * sees "new_block" as a block number. * After the write, link the buffer back to old_block. * All this must be done in bufio lock, so that block number * change isn't visible to other threads. */ old_block = b->block; __unlink_buffer(b); __link_buffer(b, new_block, b->list_mode); submit_io(b, REQ_OP_WRITE, write_endio); wait_on_bit_io(&b->state, B_WRITING, TASK_UNINTERRUPTIBLE); __unlink_buffer(b); __link_buffer(b, old_block, b->list_mode); } dm_bufio_unlock(c); dm_bufio_release(b); } EXPORT_SYMBOL_GPL(dm_bufio_release_move); static void forget_buffer_locked(struct dm_buffer *b) { if (likely(!b->hold_count) && likely(!smp_load_acquire(&b->state))) { Loading
include/linux/dm-bufio.h +0 −6 Original line number Diff line number Diff line Loading @@ -130,12 +130,6 @@ int dm_bufio_issue_flush(struct dm_bufio_client *c); */ int dm_bufio_issue_discard(struct dm_bufio_client *c, sector_t block, sector_t count); /* * Like dm_bufio_release but also move the buffer to the new * block. dm_bufio_write_dirty_buffers is needed to commit the new block. */ void dm_bufio_release_move(struct dm_buffer *b, sector_t new_block); /* * Free the given buffer. * This is just a hint, if the buffer is in use or dirty, this function Loading