Skip to contentSkip to conversation

dm writecache: remove unused member pointer in writeback_struct

PATCH Huaisheng Ye 2 participants 4 messages Aug 11, 2019 Device mapper

lore
Share & tools
lore
#0 lore raw

From: Huaisheng Ye <[email protected]>

The stucture member pointer page in writeback_struct never has been used actually. Remove it.

---
 drivers/md/dm-writecache.c | 1 -
 1 file changed, 1 deletion(-)
drivers/md/dm-writecache.c +0 -1
index 1cb137f..5c7009d 100644
@@ -190,7 +190,6 @@ struct writeback_struct {
 	struct dm_writecache *wc;
 	struct wc_entry **wc_list;
 	unsigned wc_list_n;
-	struct page *page;
 	struct wc_entry *wc_list_inline[WB_LIST_INLINE];
 	struct bio bio;
 };
Signature · 1 line
1.8.3.1
#1 lore raw

dm writecache: add unlikely for getting two block with same LBA

From: Huaisheng Ye <[email protected]>

In function writecache_writeback, entries g and f has same original sector only happens at entry f has been committed, but entry g has NOT yet.

The probability of this happening is very low in the following
256 blocks at most of entry e, so add unlikely for the result.

---
 drivers/md/dm-writecache.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/md/dm-writecache.c +2 -2
index 5c7009d..3643084 100644
@@ -1628,8 +1628,8 @@ static void writecache_writeback(struct work_struct *work)
 			if (unlikely(!next_node))
 				break;
 			g = container_of(next_node, struct wc_entry, rb_node);
-			if (read_original_sector(wc, g) ==
-			    read_original_sector(wc, f)) {
+			if (unlikely(read_original_sector(wc, g) ==
+			    read_original_sector(wc, f))) {
 				f = g;
 				continue;
 			}
Signature · 1 line
1.8.3.1
maintainer Acked-by
#2 lore raw

Re: dm writecache: add unlikely for getting two block with same LBA

Quoted 10 lines · Huaisheng Ye

From: Huaisheng Ye <[email protected]>

In function writecache_writeback, entries g and f has same original sector only happens at entry f has been committed, but entry g has NOT yet.

The probability of this happening is very low in the following
256 blocks at most of entry e, so add unlikely for the result.

Quoted 23 lines
---
 drivers/md/dm-writecache.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/md/dm-writecache.c +2 -2
index 5c7009d..3643084 100644
@@ -1628,8 +1628,8 @@ static void writecache_writeback(struct work_struct *work)
 			if (unlikely(!next_node))
 				break;
 			g = container_of(next_node, struct wc_entry, rb_node);
-			if (read_original_sector(wc, g) ==
-			    read_original_sector(wc, f)) {
+			if (unlikely(read_original_sector(wc, g) ==
+			    read_original_sector(wc, f))) {
 				f = g;
 				continue;
 			}
Signature · 1 line
1.8.3.1
maintainer Acked-by
#3 lore raw
In reply to Huaisheng Ye
Quoted 6 lines · Huaisheng Ye

From: Huaisheng Ye <[email protected]>

The stucture member pointer page in writeback_struct never has been used actually. Remove it.

Quoted 20 lines
---
 drivers/md/dm-writecache.c | 1 -
 1 file changed, 1 deletion(-)
drivers/md/dm-writecache.c +0 -1
index 1cb137f..5c7009d 100644
@@ -190,7 +190,6 @@ struct writeback_struct {
 	struct dm_writecache *wc;
 	struct wc_entry **wc_list;
 	unsigned wc_list_n;
-	struct page *page;
 	struct wc_entry *wc_list_inline[WB_LIST_INLINE];
 	struct bio bio;
 };
Signature · 1 line
1.8.3.1