All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/6] dm-bufio: introduce dm_bufio_forget
@ 2014-01-14  0:12 Mikulas Patocka
  2014-01-14  0:13 ` [PATCH 2/6] dm-bufio: introduce dm_bufio_set_minimum_buffers Mikulas Patocka
  0 siblings, 1 reply; 10+ messages in thread
From: Mikulas Patocka @ 2014-01-14  0:12 UTC (permalink / raw)
  To: Mike Snitzer, Alasdair G. Kergon; +Cc: dm-devel

Introduce a new function dm_bufio_forget. It frees the given buffer.

Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>

---
 drivers/md/dm-bufio.c |   22 ++++++++++++++++++++++
 drivers/md/dm-bufio.h |    7 +++++++
 2 files changed, 29 insertions(+)

Index: linux-3.13-rc7/drivers/md/dm-bufio.c
===================================================================
--- linux-3.13-rc7.orig/drivers/md/dm-bufio.c	2014-01-14 00:52:22.000000000 +0100
+++ linux-3.13-rc7/drivers/md/dm-bufio.c	2014-01-14 00:52:25.000000000 +0100
@@ -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;
Index: linux-3.13-rc7/drivers/md/dm-bufio.h
===================================================================
--- linux-3.13-rc7.orig/drivers/md/dm-bufio.h	2014-01-14 00:52:22.000000000 +0100
+++ linux-3.13-rc7/drivers/md/dm-bufio.h	2014-01-14 00:52:25.000000000 +0100
@@ -108,6 +108,13 @@ int dm_bufio_issue_flush(struct dm_bufio
  */
 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
+ * does nothing.
+ */
+void dm_bufio_forget(struct dm_bufio_client *c, sector_t block);
+
 unsigned dm_bufio_get_block_size(struct dm_bufio_client *c);
 sector_t dm_bufio_get_device_size(struct dm_bufio_client *c);
 sector_t dm_bufio_get_block_number(struct dm_buffer *b);

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2014-01-16 20:53 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-01-14  0:12 [PATCH 1/6] dm-bufio: introduce dm_bufio_forget Mikulas Patocka
2014-01-14  0:13 ` [PATCH 2/6] dm-bufio: introduce dm_bufio_set_minimum_buffers Mikulas Patocka
2014-01-14  0:13   ` [PATCH 3/6] dm-snapshot: use GFP_KERNEL when initializing the snapshot Mikulas Patocka
2014-01-14  0:14     ` [PATCH 4/6] dm-snapshot: make ps->area explicit Mikulas Patocka
2014-01-14  0:14       ` [PATCH 5/6] dm-snapshot: use dm-bufio Mikulas Patocka
2014-01-14  0:14         ` [PATCH 6/6] dm-snapshot: use bufio prefetch Mikulas Patocka
2014-01-14 16:58           ` Mike Snitzer
2014-01-14 20:43             ` Mikulas Patocka
2014-01-14 21:50               ` Mike Snitzer
2014-01-16 20:53                 ` Mikulas Patocka

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.