* [PATCH] delete dm_bufio_discard_buffers
@ 2020-05-27 11:04 Mikulas Patocka
2020-05-27 13:11 ` Mike Snitzer
0 siblings, 1 reply; 2+ messages in thread
From: Mikulas Patocka @ 2020-05-27 11:04 UTC (permalink / raw)
To: Mike Snitzer, Heinz Mauelshagen; +Cc: dm-devel
Hi
I suggest to delete dm_bufio_discard_buffers because no one is using it.
If you need it in the future, tell me - and I will optimize it, so that it
walks the rb-tree of buffers instead of doing block-by-block lookups.
Mikulas
diff --git a/drivers/md/dm-bufio.c b/drivers/md/dm-bufio.c
index bf289be1ee3a..993e624e506c 100644
--- a/drivers/md/dm-bufio.c
+++ b/drivers/md/dm-bufio.c
@@ -1358,32 +1358,6 @@ int dm_bufio_issue_discard(struct dm_bufio_client *c, sector_t block, sector_t c
}
EXPORT_SYMBOL_GPL(dm_bufio_issue_discard);
-/*
- * Free the specified range of buffers. If a buffer is held by other process, it
- * is not freed. If a buffer is dirty, it is discarded without writeback.
- * Finally, send the discard request to the device.
- */
-int dm_bufio_discard_buffers(struct dm_bufio_client *c, sector_t block, sector_t count)
-{
- sector_t i;
-
- for (i = block; i < block + count; i++) {
- struct dm_buffer *b;
- dm_bufio_lock(c);
- b = __find(c, i);
- if (b && likely(!b->hold_count)) {
- wait_on_bit_io(&b->state, B_READING, TASK_UNINTERRUPTIBLE);
- wait_on_bit_io(&b->state, B_WRITING, TASK_UNINTERRUPTIBLE);
- __unlink_buffer(b);
- __free_buffer_wake(b);
- }
- dm_bufio_unlock(c);
- }
-
- return dm_bufio_issue_discard(c, block, count);
-}
-EXPORT_SYMBOL_GPL(dm_bufio_discard_buffers);
-
/*
* We first delete any other buffer that may be at that new location.
*
diff --git a/include/linux/dm-bufio.h b/include/linux/dm-bufio.h
index 07e1f163e299..5ec6bfbde9ae 100644
--- a/include/linux/dm-bufio.h
+++ b/include/linux/dm-bufio.h
@@ -123,13 +123,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);
-/*
- * Free the specified range of buffers. If a buffer is held by other process, it
- * is not freed. If a buffer is dirty, it is discarded without writeback.
- * Finally, send the discard request to the device.
- */
-int dm_bufio_discard_buffers(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.
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: delete dm_bufio_discard_buffers
2020-05-27 11:04 [PATCH] delete dm_bufio_discard_buffers Mikulas Patocka
@ 2020-05-27 13:11 ` Mike Snitzer
0 siblings, 0 replies; 2+ messages in thread
From: Mike Snitzer @ 2020-05-27 13:11 UTC (permalink / raw)
To: Mikulas Patocka; +Cc: Heinz Mauelshagen, dm-devel
On Wed, May 27 2020 at 7:04am -0400,
Mikulas Patocka <mpatocka@redhat.com> wrote:
> Hi
>
> I suggest to delete dm_bufio_discard_buffers because no one is using it.
>
> If you need it in the future, tell me - and I will optimize it, so that it
> walks the rb-tree of buffers instead of doing block-by-block lookups.
>
OK, my only concern is: Heinz, should you have used
dm_bufio_discard_buffers() in dm-ebs commit a5089a95d84c ("dm ebs: pass
discards down to underlying device")? Or are you certain all ebs'
bufio buffers have made it to disk?
Also now seeing that the FIXME commit a5089a95d84c removed referred to
making use of dm_bufio_discard_buffers()...
Mike
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-05-27 13:11 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-05-27 11:04 [PATCH] delete dm_bufio_discard_buffers Mikulas Patocka
2020-05-27 13:11 ` Mike Snitzer
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.