[dm-devel] [PATCH] dm writecache: correct uncommitted_block when discarding uncommitted entry

2020-06-15 Thread Huaisheng Ye
From: Huaisheng Ye When uncommitted entry has been discarded, correct wc->uncommitted_block for getting the exact number. Signed-off-by: Huaisheng Ye --- drivers/md/dm-writecache.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/md/dm-writecache.c b/drivers/md/dm-writecach

[dm-devel] [PATCH] dm writecache: skip writecache_wait when using pmem mode

2020-06-15 Thread Huaisheng Ye
From: Huaisheng Ye The array bio_in_progress is only used with ssd mode. So skip writecache_wait_for_ios in writecache_discard when pmem mode. Signed-off-by: Huaisheng Ye --- drivers/md/dm-writecache.c | 6 -- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/md/dm

[dm-devel] [PATCH] dm writecache: reinitialize lru in writeback instead of endio

2020-06-01 Thread Huaisheng Ye
From: Huaisheng Ye When wc_entry has been removed from wbl->list in writeback, it will be not used again except waiting to be set free in writecache_free_entry. That is a little of annoying, it has to reinitialize lru of wc_entry in endio before calling writecache_free_entry. Us

[PATCH] dm writecache: skip writecache_wait for pmem mode

2019-09-02 Thread Huaisheng Ye
From: Huaisheng Ye The array bio_in_progress[2] only have chance to be increased and decreased with ssd mode. For pmem mode, they are not involved at all. So skip writecache_wait_for_ios in writecache_flush for pmem. Suggested-by: Doris Yu Signed-off-by: Huaisheng Ye --- drivers/md/dm

[PATCH 1/3] dm writecache: remove unused member pointer in writeback_struct

2019-08-25 Thread Huaisheng Ye
From: Huaisheng Ye The stucture member pointer page in writeback_struct never has been used actually. Remove it. Signed-off-by: Huaisheng Ye Acked-by: Mikulas Patocka --- drivers/md/dm-writecache.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/md/dm-writecache.c b/drivers/md/dm

[PATCH 3/3] dm writecache: optimize performance by sorting the blocks for writeback_all

2019-08-25 Thread Huaisheng Ye
From: Huaisheng Ye During the process of writeback, the blocks, which have been placed in wbl.list for writeback soon, are partially ordered for the contiguous ones. When writeback_all has been set, for most cases, also by default, there will be a lot of blocks in pmem need to writeback

[PATCH 2/3] dm writecache: add unlikely for getting two block with same LBA

2019-08-25 Thread Huaisheng Ye
From: Huaisheng Ye 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. Signed-off-by: Huaisheng Ye Acked

[PATCH 0/3] optimize writecache_writeback for performance

2019-08-25 Thread Huaisheng Ye
From: Huaisheng Ye Patch 1 and 2 are used for cleaning the code, and they have got Acked-by from Mikulas. Patch 3 is used for performance optimization when writeback_all, which could save more than half of time. Of course, if the blocks in writecache are more uncontinuous and disordered

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

2019-08-11 Thread Huaisheng Ye
From: Huaisheng Ye 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

dm writecache: remove unused member pointer in writeback_struct

2019-08-11 Thread Huaisheng Ye
From: Huaisheng Ye The stucture member pointer page in writeback_struct never has been used actually. Remove it. Signed-off-by: Huaisheng Ye --- drivers/md/dm-writecache.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/md/dm-writecache.c b/drivers/md/dm-writecache.c index 1cb137f

[dm-devel] [PATCH v2 4/4] dm writecache: avoid unnecessary lookups in writecache_find_entry

2019-04-26 Thread Huaisheng Ye
From: Huaisheng Ye Only when entry has been found, that would only be necessary to check the lowest or highest seq-count. Add local variable "found" in writecache_find_entry, if no entry has been found, it is meaningless that having a useless rb_prev or rb_next. This patch is no

[dm-devel] [PATCH v2 2/4] dm writecache: add unlikely for returned value of rb_next/prev

2019-04-26 Thread Huaisheng Ye
From: Huaisheng Ye In functions writecache_discard() and writecache_find_entry() there is a high probablity that the pointer of structure rb_node won't equal NULL. Add unlikely for the pointer node NULL. Signed-off-by: Huaisheng Ye Acked-by: Mikulas Patocka Signed-off-by: Mike Snitzer

[dm-devel] [PATCH v2 0/4] Misc dm writecache patches

2019-04-26 Thread Huaisheng Ye
From: Huaisheng Ye This patch set is a collection about some patches for dm-writecache. Patches 0001-0003 have got Acked-by or Signed-off-by from the author and dm maintainer. Patches 0004 is still under review. Any comments and suggestion are welcome. Huaisheng Ye (4): dm writecache

[dm-devel] [PATCH v2 1/4] dm writecache: remove needless dereferences in __writecache_writeback_pmem()

2019-04-26 Thread Huaisheng Ye
From: Huaisheng Ye bio is already available so there is no need to access it in terms of the wb pointer. Signed-off-by: Huaisheng Ye Signed-off-by: Mike Snitzer --- drivers/md/dm-writecache.c | 12 ++-- 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/md/dm

[dm-devel] [PATCH] dm-writecache: avoid unnecessary lookups in writecache_find_entry

2019-04-23 Thread Huaisheng Ye
From: Huaisheng Ye Only when entry has been found, that would only be necessary to check the lowest or highest seq-count. Add local variable "found" in writecache_find_entry, if no entry has been found, it is meaningless that having a useless rb_prev or rb_next. Signed-off-by: Hu

[dm-devel] [PATCH] dm-writecache: remove unused member page_offset in writeback_struct

2019-04-23 Thread Huaisheng Ye
From: Huaisheng Ye The structure member page_offset in writeback_struct never has been used actually. Remove it. Signed-off-by: Huaisheng Ye --- drivers/md/dm-writecache.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/md/dm-writecache.c b/drivers/md/dm-writecache.c index

[dm-devel] [PATCH] dm-writecache: add unlikely for returned value of rb_next/prev

2019-04-15 Thread Huaisheng Ye
From: Huaisheng Ye In functions writecache_discard and writecache_find_entry, there is high probablity that the pointer of structure rb_node doesn't equal to NULL. Add unlikly for the pointer node. Signed-off-by: Huaisheng Ye --- drivers/md/dm-writecache.c | 4 ++-- 1 file changed, 2

[dm-devel] [PATCH] dm-writecache: simplify the using of pointer wb

2019-04-15 Thread Huaisheng Ye
From: Huaisheng Ye In function __writecache_writeback_pmem, the pointer bio has been already there, it doesn't need to seek bio's address from pointer wb. Signed-off-by: Huaisheng Ye --- drivers/md/dm-writecache.c | 12 ++-- 1 file changed, 6 insertions(+), 6 deletions(-) diff --git

[dm-devel] [PATCH] dm-writecache: fix typo when alloc workqueue for writeback_wq

2019-02-21 Thread Huaisheng Ye
From: Huaisheng Ye The workqueue's name should be "writecache-writeback" instead of "writecache-writeabck". Signed-off-by: Huaisheng Ye --- drivers/md/dm-writecache.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/md/dm-writecache.c b/driver

[dm-devel] [PATCH v3 3/5] dm-writecache: expand pmem_reinit for struct dm_writecache

2019-01-31 Thread Huaisheng Ye
From: Huaisheng Ye When use persistent memory as cache data device, sometimes the super block of pmem has messy data stored in it. That would have risk to lead fn ctr failed to work due to invalid magic or version. Here we expand pmem_reinit to optional parameters in order to solve this issue

[dm-devel] [PATCH v3 5/5] dm-writecache: output seq_count within status

2019-01-31 Thread Huaisheng Ye
From: Huaisheng Ye seq_count is important for flush operations, output it within status for debugging and analyzing code behavior. Signed-off-by: Huaisheng Ye --- drivers/md/dm-writecache.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/md/dm-writecache.c b

[dm-devel] [PATCH v3 1/5] dm-writecache: remove unused size to writecache_flush_region

2019-01-31 Thread Huaisheng Ye
From: Huaisheng Ye writecache_flush_region doesn't use size to calculate flush region. That uses _set_bits to mark the region in dirty_bitmap directly. Signed-off-by: Huaisheng Ye --- drivers/md/dm-writecache.c | 12 ++-- 1 file changed, 6 insertions(+), 6 deletions(-) diff --git

[dm-devel] [PATCH v3 2/5] dm-writecache: get rid of memory_data flush to writecache_flush_entry

2019-01-31 Thread Huaisheng Ye
From: Huaisheng Ye writecache_flush_region only works when SSD mode. If wc->pmem_mode sets, writecache_flush_region doesn't need to be called in writecache_flush_entry. Signed-off-by: Huaisheng Ye --- drivers/md/dm-writecache.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers

[dm-devel] [PATCH v3 4/5] Documentation/device-mapper: add optional parameter reinit

2019-01-31 Thread Huaisheng Ye
From: Huaisheng Ye Add intro and usage guide for reinit. Signed-off-by: Huaisheng Ye --- Documentation/device-mapper/writecache.txt | 4 1 file changed, 4 insertions(+) diff --git a/Documentation/device-mapper/writecache.txt b/Documentation/device-mapper/writecache.txt index 01532b3

[dm-devel] [PATCH v3 0/5] Optimize writecache when using pmem as cache

2019-01-31 Thread Huaisheng Ye
From: Huaisheng Ye This patch set could be used for dm-writecache when use persistent memory as cache data device. Patch 1 and 2 go towards removing unused parameter and codes which actually doesn't really work. Patch 3 and 4 are targeted at solving problem fn ctr failed to work due to invalid

[dm-devel] [RFC PATCH v2 3/4] dm-writecache: expand pmem_reinit for struct dm_writecache

2019-01-09 Thread Huaisheng Ye
From: Huaisheng Ye When use persistent memory as cache data device, sometimes the super block of pmem has messy data stored in it. That would have risk to lead fn ctr failed to work due to invalid magic or version. Here we expand pmem_reinit to optional parameters in order to solve this issue

[dm-devel] [RFC PATCH v2 4/4] Documentation/device-mapper: add optional parameter reinit

2019-01-09 Thread Huaisheng Ye
From: Huaisheng Ye Add intro and usage guide for reinit. Signed-off-by: Huaisheng Ye --- Documentation/device-mapper/writecache.txt | 4 1 file changed, 4 insertions(+) diff --git a/Documentation/device-mapper/writecache.txt b/Documentation/device-mapper/writecache.txt index 01532b3

[dm-devel] [RFC PATCH v2 2/4] dm-writecache: get rid of memory_data flush to writecache_flush_entry

2019-01-09 Thread Huaisheng Ye
From: Huaisheng Ye writecache_flush_region only works when SSD mode. If wc->pmem_mode sets, writecache_flush_region doesn't need to be called in writecache_flush_entry. Signed-off-by: Huaisheng Ye --- drivers/md/dm-writecache.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers

[dm-devel] [RFC PATCH v2 0/4] add parameter for pmem cache device init

2019-01-09 Thread Huaisheng Ye
From: Huaisheng Ye This patch set could be used for dm-writecache when use persistent memory as cache data device. Patch 1 and 2 go towards removing unused parameter and codes which actually doesn't really work. Patch 3 and 4 are targeted at solving problem fn ctr failed to work due to invalid

[dm-devel] [RFC PATCH v2 1/4] dm-writecache: remove unused size to writecache_flush_region

2019-01-09 Thread Huaisheng Ye
From: Huaisheng Ye writecache_flush_region doesn't use size to calculate flush region. That uses _set_bits to mark the region in dirty_bitmap directly. Signed-off-by: Huaisheng Ye --- drivers/md/dm-writecache.c | 12 ++-- 1 file changed, 6 insertions(+), 6 deletions(-) diff --git

[dm-devel] [PATCH 1/2] dm-writecache: remove unused size to writecache_flush_region

2019-01-03 Thread Huaisheng Ye
From: Huaisheng Ye writecache_flush_region doesn't use size to calculate flush region. That uses _set_bits to mark the region in dirty_bitmap directly. Signed-off-by: Huaisheng Ye --- drivers/md/dm-writecache.c | 12 ++-- 1 file changed, 6 insertions(+), 6 deletions(-) diff --git

[dm-devel] [PATCH 2/2] dm-writecache: get rid of memory_data flush to writecache_flush_entry

2019-01-03 Thread Huaisheng Ye
From: Huaisheng Ye writecache_flush_region only works when SSD mode. If wc->pmem_mode sets, writecache_flush_region doesn't need to be called in writecache_flush_entry. Signed-off-by: Huaisheng Ye --- drivers/md/dm-writecache.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers

Re: [dm-devel] Snapshot target and DAX-capable devices

2018-12-13 Thread Huaisheng Ye
lkml/2018/11/21/281 In the beginning, I haven't considered the situation of mmap write faults. >From Dan's reply and this email thread, now I have a more clear understanding. The question is that, even the virtual dm block device has been informed that the mmap may have write operations through PROT

[dm-devel] [RFC PATCH v2 1/3] dm: enable dax_operations for dm-snapshot

2018-11-21 Thread Huaisheng Ye
From: Huaisheng Ye Reconstruct origin_dax_direct_access and expand functions origin_dax_copy_to/from_iter for DAX operations of dm-snapshot. Here is the call trace of origin_dax_copy_to_iter, origin_dax_copy_to_iter will callin dm-linear (-real) for further dax_operation. [518597.924019] Call

[dm-devel] [RFC PATCH 1/3] dm: enable dax_operations for dm-snapshot

2018-11-21 Thread Huaisheng Ye
From: Huaisheng Ye Reconstruct origin_dax_direct_access and expand functions origin_dax_copy_to/from_iter for DAX operations of dm-snapshot. Here is the call trace of origin_dax_copy_to_iter, origin_dax_copy_to_iter will callin dm-linear (-real) for further dax_operation. [518597.924019] Call

[dm-devel] [RFC PATCH v2 3/3] dm: expand valid types for dm-ioctl

2018-11-21 Thread Huaisheng Ye
From: Huaisheng Ye If use DAX way to mount the origin device of dm_snapshot, when merging back snapshot to origin, system call table_load during the construction of snapshot-merge will try to detect new dm_table's type equals to the existed md's type or not. The existed type equals

[dm-devel] [RFC PATCH v2 0/3] realize dax_operations for dm-snapshot

2018-11-21 Thread Huaisheng Ye
From: Huaisheng Ye Changes v1->v2: Add NULL funtions for origin_dax_direct_access and origin_dax_copy_from/to_iter in order to avoid building error when CONFIG_DAX_DRIVER has NOT been enabled. [v1]: https://lkml.org/lkml/2018/11/20/759 This series patches are u

[dm-devel] [RFC PATCH 2/3] dm: expand hc_map in mapped_device for lack of map

2018-11-21 Thread Huaisheng Ye
From: Huaisheng Ye Sometimes dm_swap_table couldn't be used in time. For example, during the origin construction of dm-snapshot, the sys_ioctl table_load will try to detect the lower device origin-real whether support direct access or not. But origin-real md's struct dm-table pointer has

[dm-devel] [RFC PATCH v2 2/3] dm: expand hc_map in mapped_device for lack of map

2018-11-21 Thread Huaisheng Ye
From: Huaisheng Ye Sometimes dm_swap_table couldn't be used in time. For example, during the origin construction of dm-snapshot, the sys_ioctl table_load will try to detect the lower device origin-real whether support direct access or not. But origin-real md's struct dm-table pointer has

[dm-devel] [RFC PATCH 0/3] realize dax_operations for dm-snapshot

2018-11-21 Thread Huaisheng Ye
From: Huaisheng Ye This series patches are used to realize the dax_operations for dm-snapshot with persistent memory device. Here are the steps about how to verify the function. 1. Configure the persistent memory to fs-dax mode and create namespace with ndctl; 2. find them in /dev; # ndctl

[dm-devel] [RFC PATCH 3/3] dm: expand valid types for dm-ioctl

2018-11-21 Thread Huaisheng Ye
From: Huaisheng Ye If use DAX way to mount the origin device of dm_snapshot, when merging back snapshot to origin, system call table_load during the construction of snapshot-merge will try to detect new dm_table's type equals to the existed md's type or not. The existed type equals

[dm-devel] [PATCH v3 4/6] dax/super: Do not request a pointer kaddr when not required

2018-07-30 Thread Huaisheng Ye
From: Huaisheng Ye Function __bdev_dax_supported doesn't need to get local pointer kaddr from direct_access. Using NULL instead of having to pass in a useless local pointer that caller then just throw away. Signed-off-by: Huaisheng Ye Reviewed-by: Ross Zwisler --- drivers/dax/super.c | 3

[dm-devel] [PATCH v3 6/6] filesystem-dax: Do not request kaddr and pfn when not required

2018-07-30 Thread Huaisheng Ye
From: Huaisheng Ye Some functions within fs/dax don't need to get local pointer kaddr or variable pfn from direct_access. Using NULL instead of having to pass in useless pointer or variable that caller then just throw away. Signed-off-by: Huaisheng Ye Reviewed-by: Ross Zwisler --- fs/dax.c

[dm-devel] [PATCH v3 0/6] kaddr and pfn can be NULL to ->direct_access()

2018-07-30 Thread Huaisheng Ye
From: Huaisheng Ye Changes since v2 [2]: * Collect Martin and Mike's acks for dcssblk and dm-writecache; * Rebase the series of patch to v4.18-rc7. Changes since v1 [1]: * Involve the previous patches for pfn can be NULL. * Reword the patch descriptions according to Christian's comment

[dm-devel] [PATCH v3 5/6] md/dm-writecache: Don't request pointer dummy_addr when not required

2018-07-30 Thread Huaisheng Ye
From: Huaisheng Ye Function persistent_memory_claim doesn't need to get local pointer dummy_addr from direct_access. Using NULL instead of having to pass in a useless local pointer that caller then just throw away. Suggested-by: Ross Zwisler Signed-off-by: Huaisheng Ye Reviewed-by: Ross

[dm-devel] [PATCH v3 2/6] s390, dcssblk: kaddr and pfn can be NULL to ->direct_access()

2018-07-30 Thread Huaisheng Ye
From: Huaisheng Ye dcssblk_direct_access() needs to check the validity of pointers kaddr and pfn for NULL assignment. If anyone equals to NULL, it doesn't need to calculate the value. If either of them is equal to NULL, that is to say callers may have no need for kaddr or pfn, so this patch

[dm-devel] [PATCH v3 1/6] libnvdimm, pmem: kaddr and pfn can be NULL to ->direct_access()

2018-07-30 Thread Huaisheng Ye
From: Huaisheng Ye pmem_direct_access() needs to check the validity of pointers kaddr and pfn for NULL assignment. If anyone equals to NULL, it doesn't need to calculate the value. If pointer equals to NULL, that is to say callers may have no need for kaddr or pfn, so this patch is prepared

[dm-devel] [PATCH v3 3/6] tools/testing/nvdimm: kaddr and pfn can be NULL to ->direct_access()

2018-07-30 Thread Huaisheng Ye
From: Huaisheng Ye The mock / test version of pmem_direct_access() needs to check the validity of pointers kaddr and pfn for NULL assignment. If anyone equals to NULL, it doesn't need to calculate the value. If pointer equals to NULL, that is to say callers may have no need for kaddr or pfn, so

[dm-devel] [PATCH v2 5/6] md/dm-writecache: Don't request pointer dummy_addr when not required

2018-07-26 Thread Huaisheng Ye
From: Huaisheng Ye Function persistent_memory_claim doesn't need to get local pointer dummy_addr from direct_access. Using NULL instead of having to pass in a useless local pointer that caller then just throw away. Suggested-by: Ross Zwisler Signed-off-by: Huaisheng Ye --- drivers/md/dm

[dm-devel] [PATCH v2 4/6] dax/super: Do not request a pointer kaddr when not required

2018-07-26 Thread Huaisheng Ye
From: Huaisheng Ye Function __bdev_dax_supported doesn't need to get local pointer kaddr from direct_access. Using NULL instead of having to pass in a useless local pointer that caller then just throw away. Signed-off-by: Huaisheng Ye --- drivers/dax/super.c | 3 +-- 1 file changed, 1

[dm-devel] [PATCH v2 0/6] kaddr and pfn can be NULL to ->direct_access()

2018-07-26 Thread Huaisheng Ye
From: Huaisheng Ye Changes since v1 [1]: * Involve the previous patches for pfn can be NULL. * Reword the patch descriptions according to Christian's comment. * According to Ross's suggestion, replace local pointer dummy_addr with NULL within md/dm-writecache for direct_access. [1]: https

[dm-devel] [PATCH v2 1/6] libnvdimm, pmem: kaddr and pfn can be NULL to ->direct_access()

2018-07-26 Thread Huaisheng Ye
From: Huaisheng Ye pmem_direct_access() needs to check the validity of pointers kaddr and pfn for NULL assignment. If anyone equals to NULL, it doesn't need to calculate the value. If pointer equals to NULL, that is to say callers may have no need for kaddr or pfn, so this patch is prepared

[dm-devel] [PATCH v2 2/6] s390, dcssblk: kaddr and pfn can be NULL to ->direct_access()

2018-07-26 Thread Huaisheng Ye
From: Huaisheng Ye dcssblk_direct_access() needs to check the validity of pointers kaddr and pfn for NULL assignment. If anyone equals to NULL, it doesn't need to calculate the value. If either of them is equal to NULL, that is to say callers may have no need for kaddr or pfn, so this patch

[dm-devel] [PATCH v2 6/6] filesystem-dax: Do not request kaddr and pfn when not required

2018-07-26 Thread Huaisheng Ye
From: Huaisheng Ye Some functions within fs/dax don't need to get local pointer kaddr or variable pfn from direct_access. Using NULL instead of having to pass in useless pointer or variable that caller then just throw away. Signed-off-by: Huaisheng Ye --- fs/dax.c | 13 - 1 file

[dm-devel] [PATCH v2 3/6] tools/testing/nvdimm: kaddr and pfn can be NULL to ->direct_access()

2018-07-26 Thread Huaisheng Ye
From: Huaisheng Ye The mock / test version of pmem_direct_access() needs to check the validity of pointers kaddr and pfn for NULL assignment. If anyone equals to NULL, it doesn't need to calculate the value. If pointer equals to NULL, that is to say callers may have no need for kaddr or pfn, so