Linux Device Mapper development
 help / color / mirror / Atom feed
From: Mike Snitzer <snitzer@kernel.org>
To: dm-devel@redhat.com
Cc: keescook@chromium.org, heinzm@redhat.com,
	Mike Snitzer <snitzer@kernel.org>,
	nhuck@google.com, ebiggers@kernel.org, ejt@redhat.com,
	mpatocka@redhat.com, luomeng12@huawei.com
Subject: [dm-devel] [dm-6.4 PATCH 7/8] dm bufio: rename buffer_cache struct to dm_buffer_cache
Date: Wed, 22 Mar 2023 14:18:44 -0400	[thread overview]
Message-ID: <20230322181845.29848-8-snitzer@kernel.org> (raw)
In-Reply-To: <20230322181845.29848-1-snitzer@kernel.org>

Signed-off-by: Mike Snitzer <snitzer@kernel.org>
---
 drivers/md/dm-bufio.c | 52 +++++++++++++++++++++----------------------
 1 file changed, 26 insertions(+), 26 deletions(-)

diff --git a/drivers/md/dm-bufio.c b/drivers/md/dm-bufio.c
index b418ee8e3853..e7b901baa878 100644
--- a/drivers/md/dm-bufio.c
+++ b/drivers/md/dm-bufio.c
@@ -327,7 +327,7 @@ enum data_mode {
 };
 
 struct dm_buffer {
-	/* protected by the locks in buffer_cache */
+	/* protected by the locks in dm_buffer_cache */
 	struct rb_node node;
 
 	/* immutable, so don't need protecting */
@@ -393,7 +393,7 @@ struct tree_lock {
 	struct rw_semaphore lock;
 } ____cacheline_aligned_in_smp;
 
-struct buffer_cache {
+struct dm_buffer_cache {
 	/*
 	 * We spread entries across multiple trees to reduce contention
 	 * on the locks.
@@ -414,22 +414,22 @@ static inline unsigned int cache_index(sector_t block)
 	return block & LOCKS_MASK;
 }
 
-static inline void cache_read_lock(struct buffer_cache *bc, sector_t block)
+static inline void cache_read_lock(struct dm_buffer_cache *bc, sector_t block)
 {
 	down_read(&bc->locks[cache_index(block)].lock);
 }
 
-static inline void cache_read_unlock(struct buffer_cache *bc, sector_t block)
+static inline void cache_read_unlock(struct dm_buffer_cache *bc, sector_t block)
 {
 	up_read(&bc->locks[cache_index(block)].lock);
 }
 
-static inline void cache_write_lock(struct buffer_cache *bc, sector_t block)
+static inline void cache_write_lock(struct dm_buffer_cache *bc, sector_t block)
 {
 	down_write(&bc->locks[cache_index(block)].lock);
 }
 
-static inline void cache_write_unlock(struct buffer_cache *bc, sector_t block)
+static inline void cache_write_unlock(struct dm_buffer_cache *bc, sector_t block)
 {
 	up_write(&bc->locks[cache_index(block)].lock);
 }
@@ -439,12 +439,12 @@ static inline void cache_write_unlock(struct buffer_cache *bc, sector_t block)
  * This struct helps avoid redundant drop and gets of the same lock.
  */
 struct lock_history {
-	struct buffer_cache *cache;
+	struct dm_buffer_cache *cache;
 	bool write;
 	unsigned int previous;
 };
 
-static void lh_init(struct lock_history *lh, struct buffer_cache *cache, bool write)
+static void lh_init(struct lock_history *lh, struct dm_buffer_cache *cache, bool write)
 {
 	lh->cache = cache;
 	lh->write = write;
@@ -513,7 +513,7 @@ static struct dm_buffer *list_to_buffer(struct list_head *l)
 	return le_to_buffer(le);
 }
 
-static void cache_init(struct buffer_cache *bc)
+static void cache_init(struct dm_buffer_cache *bc)
 {
 	unsigned int i;
 
@@ -526,7 +526,7 @@ static void cache_init(struct buffer_cache *bc)
 	lru_init(&bc->lru[LIST_DIRTY]);
 }
 
-static void cache_destroy(struct buffer_cache *bc)
+static void cache_destroy(struct dm_buffer_cache *bc)
 {
 	unsigned int i;
 
@@ -540,7 +540,7 @@ static void cache_destroy(struct buffer_cache *bc)
 /*
  * not threadsafe, or racey depending how you look at it
  */
-static unsigned long cache_count(struct buffer_cache *bc, int list_mode)
+static unsigned long cache_count(struct dm_buffer_cache *bc, int list_mode)
 {
 	return lru_count(&bc->lru[list_mode]);
 }
@@ -550,7 +550,7 @@ static unsigned long cache_count(struct buffer_cache *bc, int list_mode)
 /*
  * not threadsafe
  */
-static unsigned long cache_total(struct buffer_cache *bc)
+static unsigned long cache_total(struct dm_buffer_cache *bc)
 {
 	return lru_count(&bc->lru[LIST_CLEAN]) +
 		lru_count(&bc->lru[LIST_DIRTY]);
@@ -588,7 +588,7 @@ static void __cache_inc_buffer(struct dm_buffer *b)
 	WRITE_ONCE(b->last_accessed, jiffies);
 }
 
-static struct dm_buffer *cache_get(struct buffer_cache *bc, sector_t block)
+static struct dm_buffer *cache_get(struct dm_buffer_cache *bc, sector_t block)
 {
 	struct dm_buffer *b;
 
@@ -609,7 +609,7 @@ static struct dm_buffer *cache_get(struct buffer_cache *bc, sector_t block)
  * Returns true if the hold count hits zero.
  * threadsafe
  */
-static bool cache_put(struct buffer_cache *bc, struct dm_buffer *b)
+static bool cache_put(struct dm_buffer_cache *bc, struct dm_buffer *b)
 {
 	bool r;
 
@@ -653,7 +653,7 @@ static enum evict_result __evict_pred(struct lru_entry *le, void *context)
 	return w->pred(b, w->context);
 }
 
-static struct dm_buffer *__cache_evict(struct buffer_cache *bc, int list_mode,
+static struct dm_buffer *__cache_evict(struct dm_buffer_cache *bc, int list_mode,
 				       b_predicate pred, void *context,
 				       struct lock_history *lh)
 {
@@ -672,7 +672,7 @@ static struct dm_buffer *__cache_evict(struct buffer_cache *bc, int list_mode,
 	return b;
 }
 
-static struct dm_buffer *cache_evict(struct buffer_cache *bc, int list_mode,
+static struct dm_buffer *cache_evict(struct dm_buffer_cache *bc, int list_mode,
 				     b_predicate pred, void *context)
 {
 	struct dm_buffer *b;
@@ -690,7 +690,7 @@ static struct dm_buffer *cache_evict(struct buffer_cache *bc, int list_mode,
 /*
  * Mark a buffer as clean or dirty. Not threadsafe.
  */
-static void cache_mark(struct buffer_cache *bc, struct dm_buffer *b, int list_mode)
+static void cache_mark(struct dm_buffer_cache *bc, struct dm_buffer *b, int list_mode)
 {
 	cache_write_lock(bc, b->block);
 	if (list_mode != b->list_mode) {
@@ -707,7 +707,7 @@ static void cache_mark(struct buffer_cache *bc, struct dm_buffer *b, int list_mo
  * Runs through the lru associated with 'old_mode', if the predicate matches then
  * it moves them to 'new_mode'.  Not threadsafe.
  */
-static void __cache_mark_many(struct buffer_cache *bc, int old_mode, int new_mode,
+static void __cache_mark_many(struct dm_buffer_cache *bc, int old_mode, int new_mode,
 			      b_predicate pred, void *context, struct lock_history *lh)
 {
 	struct lru_entry *le;
@@ -725,7 +725,7 @@ static void __cache_mark_many(struct buffer_cache *bc, int old_mode, int new_mod
 	}
 }
 
-static void cache_mark_many(struct buffer_cache *bc, int old_mode, int new_mode,
+static void cache_mark_many(struct dm_buffer_cache *bc, int old_mode, int new_mode,
 			    b_predicate pred, void *context)
 {
 	struct lock_history lh;
@@ -753,7 +753,7 @@ enum it_action {
 
 typedef enum it_action (*iter_fn)(struct dm_buffer *b, void *context);
 
-static void __cache_iterate(struct buffer_cache *bc, int list_mode,
+static void __cache_iterate(struct dm_buffer_cache *bc, int list_mode,
 			    iter_fn fn, void *context, struct lock_history *lh)
 {
 	struct lru *lru = &bc->lru[list_mode];
@@ -781,7 +781,7 @@ static void __cache_iterate(struct buffer_cache *bc, int list_mode,
 	} while (le != first);
 }
 
-static void cache_iterate(struct buffer_cache *bc, int list_mode,
+static void cache_iterate(struct dm_buffer_cache *bc, int list_mode,
 			  iter_fn fn, void *context)
 {
 	struct lock_history lh;
@@ -824,7 +824,7 @@ static bool __cache_insert(struct rb_root *root, struct dm_buffer *b)
 	return true;
 }
 
-static bool cache_insert(struct buffer_cache *bc, struct dm_buffer *b)
+static bool cache_insert(struct dm_buffer_cache *bc, struct dm_buffer *b)
 {
 	bool r;
 
@@ -848,7 +848,7 @@ static bool cache_insert(struct buffer_cache *bc, struct dm_buffer *b)
  *
  * Not threadsafe.
  */
-static bool cache_remove(struct buffer_cache *bc, struct dm_buffer *b)
+static bool cache_remove(struct dm_buffer_cache *bc, struct dm_buffer *b)
 {
 	bool r;
 
@@ -894,7 +894,7 @@ static struct dm_buffer *__find_next(struct rb_root *root, sector_t block)
 	return best;
 }
 
-static void __remove_range(struct buffer_cache *bc,
+static void __remove_range(struct dm_buffer_cache *bc,
 			   struct rb_root *root,
 			   sector_t begin, sector_t end,
 			   b_predicate pred, b_release release)
@@ -921,7 +921,7 @@ static void __remove_range(struct buffer_cache *bc,
 	}
 }
 
-static void cache_remove_range(struct buffer_cache *bc,
+static void cache_remove_range(struct dm_buffer_cache *bc,
 			       sector_t begin, sector_t end,
 			       b_predicate pred, b_release release)
 {
@@ -988,7 +988,7 @@ struct dm_bufio_client {
 	 */
 	unsigned long oldest_buffer;
 
-	struct buffer_cache cache;
+	struct dm_buffer_cache cache;
 };
 
 static DEFINE_STATIC_KEY_FALSE(no_sleep_enabled);
-- 
2.40.0

--
dm-devel mailing list
dm-devel@redhat.com
https://listman.redhat.com/mailman/listinfo/dm-devel


  parent reply	other threads:[~2023-03-22 18:20 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-22 18:18 [dm-devel] [dm-6.4 PATCH 0/8] dm bufio, thin: improve concurrent IO performance Mike Snitzer
2023-03-22 18:18 ` [dm-devel] [dm-6.4 PATCH 1/8] dm: split discards further if target sets max_discard_granularity Mike Snitzer
2023-03-23  8:00   ` Joe Thornber
2023-03-23  8:45     ` Mike Snitzer
2023-03-22 18:18 ` [dm-devel] [dm-6.4 PATCH 2/8] dm bio prison v1: improve concurrent IO performance Mike Snitzer
2023-03-22 18:18 ` [dm-devel] [dm-6.4 PATCH 3/8] dm bufio: remove unused dm_bufio_release_move interface Mike Snitzer
2023-03-22 18:18 ` [dm-devel] [dm-6.4 PATCH 4/8] dm bufio: move dm_buffer struct Mike Snitzer
2023-03-22 18:18 ` [dm-devel] [dm-6.4 PATCH 5/8] dm bufio: improve concurrent IO performance Mike Snitzer
2023-03-23  7:51   ` Joe Thornber
2023-03-23  9:51     ` Mike Snitzer
2023-03-22 18:18 ` [dm-devel] [dm-6.4 PATCH 6/8] dm bufio: move dm_bufio_client members to avoid spanning cachelines Mike Snitzer
2023-03-22 18:18 ` Mike Snitzer [this message]
2023-03-22 18:18 ` [dm-devel] [dm-6.4 PATCH 8/8] dm thin: speed up cell_defer_no_holder() Mike Snitzer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230322181845.29848-8-snitzer@kernel.org \
    --to=snitzer@kernel.org \
    --cc=dm-devel@redhat.com \
    --cc=ebiggers@kernel.org \
    --cc=ejt@redhat.com \
    --cc=heinzm@redhat.com \
    --cc=keescook@chromium.org \
    --cc=luomeng12@huawei.com \
    --cc=mpatocka@redhat.com \
    --cc=nhuck@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox