summaryrefslogtreecommitdiff
path: root/drivers/md/dm-bufio.c
diff options
context:
space:
mode:
authorMikulas Patocka <mpatocka@redhat.com>2014-01-14 04:12:36 +0400
committerMike Snitzer <snitzer@redhat.com>2014-01-15 08:23:02 +0400
commit55494bf2947dccdf2d98b62374fea7365dfead84 (patch)
tree08958b0812f1c59732f6a56e2b567ad3a8da7230 /drivers/md/dm-bufio.c
parent2cadabd512acca99e6553d303eaedc97a3178a4d (diff)
downloadlinux-55494bf2947dccdf2d98b62374fea7365dfead84.tar.xz
dm snapshot: use dm-bufio
Use dm-bufio for initial loading of the exceptions. Introduce a new function dm_bufio_forget that frees the given buffer. Signed-off-by: Mikulas Patocka <mpatocka@redhat.com> Signed-off-by: Mike Snitzer <snitzer@redhat.com>
Diffstat (limited to 'drivers/md/dm-bufio.c')
-rw-r--r--drivers/md/dm-bufio.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/drivers/md/dm-bufio.c b/drivers/md/dm-bufio.c
index 54bdd923316f..d86593721915 100644
--- a/drivers/md/dm-bufio.c
+++ b/drivers/md/dm-bufio.c
@@ -1350,6 +1350,28 @@ retry:
}
EXPORT_SYMBOL_GPL(dm_bufio_release_move);
+/*
+ * Free the given buffer.
+ *
+ * This is just a hint, if the buffer is in use or dirty, this function
+ * does nothing.
+ */
+void dm_bufio_forget(struct dm_bufio_client *c, sector_t block)
+{
+ struct dm_buffer *b;
+
+ dm_bufio_lock(c);
+
+ b = __find(c, block);
+ if (b && likely(!b->hold_count) && likely(!b->state)) {
+ __unlink_buffer(b);
+ __free_buffer_wake(b);
+ }
+
+ dm_bufio_unlock(c);
+}
+EXPORT_SYMBOL(dm_bufio_forget);
+
unsigned dm_bufio_get_block_size(struct dm_bufio_client *c)
{
return c->block_size;