nvdimm.lists.linux.dev archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/6] kaddr and pfn can be NULL to ->direct_access()
@ 2018-07-25 16:28 Huaisheng Ye
  2018-07-25 16:28 ` [PATCH v2 1/6] libnvdimm, pmem: " Huaisheng Ye
                   ` (7 more replies)
  0 siblings, 8 replies; 13+ messages in thread
From: Huaisheng Ye @ 2018-07-25 16:28 UTC (permalink / raw)
  To: linux-nvdimm, dan.j.williams
  Cc: axboe, linux-s390, snitzer, chengnt, linux-fsdevel,
	heiko.carstens, linux-kernel, willy, colyli, bart.vanassche,
	dm-devel, viro, gregkh, schwidefsky, jack, agk

From: Huaisheng Ye <yehs1@lenovo.com>

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://lkml.org/lkml/2018/7/24/199

Some functions within fs/dax, dax/super and md/dm-writecache don't
need to get local pointer kaddr or variable pfn from direct_access.
Assigning NULL to kaddr or pfn to ->direct_access() is more
straightforward and simple than offering a useless local pointer or
variable.

So all ->direct_access() need to check the validity of pointer kaddr
and pfn for NULL assignment. If either of them is equal to NULL, that
is to say callers may have no need for kaddr or pfn, so this series of
patch are prepared for allowing them to pass in NULL instead of having
to pass in a local pointer or variable that they then just throw away.

Huaisheng Ye (6):
  libnvdimm, pmem: kaddr and pfn can be NULL to ->direct_access()
  s390, dcssblk: kaddr and pfn can be NULL to ->direct_access()
  tools/testing/nvdimm: kaddr and pfn can be NULL to ->direct_access()
  dax/super: Do not request a pointer kaddr when not required
  md/dm-writecache: Don't request pointer dummy_addr when not required
  filesystem-dax: Do not request kaddr and pfn when not required

 drivers/dax/super.c             |  3 +--
 drivers/md/dm-writecache.c      |  3 +--
 drivers/nvdimm/pmem.c           |  7 +++++--
 drivers/s390/block/dcssblk.c    |  8 +++++---
 fs/dax.c                        | 13 ++++---------
 tools/testing/nvdimm/pmem-dax.c | 12 ++++++++----
 6 files changed, 24 insertions(+), 22 deletions(-)

-- 
1.8.3.1


_______________________________________________
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm

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

* [PATCH v2 1/6] libnvdimm, pmem: kaddr and pfn can be NULL to ->direct_access()
  2018-07-25 16:28 [PATCH v2 0/6] kaddr and pfn can be NULL to ->direct_access() Huaisheng Ye
@ 2018-07-25 16:28 ` Huaisheng Ye
  2018-07-25 16:28 ` [PATCH v2 2/6] s390, dcssblk: " Huaisheng Ye
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 13+ messages in thread
From: Huaisheng Ye @ 2018-07-25 16:28 UTC (permalink / raw)
  To: linux-nvdimm, dan.j.williams
  Cc: axboe, linux-s390, snitzer, chengnt, linux-fsdevel,
	heiko.carstens, linux-kernel, willy, colyli, bart.vanassche,
	dm-devel, viro, gregkh, schwidefsky, jack, agk

From: Huaisheng Ye <yehs1@lenovo.com>

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 for allowing them to pass in
NULL instead of having to pass in a pointer or local variable that
they then just throw away.

Signed-off-by: Huaisheng Ye <yehs1@lenovo.com>
---
 drivers/nvdimm/pmem.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/nvdimm/pmem.c b/drivers/nvdimm/pmem.c
index 8b1fd7f..ecf9024 100644
--- a/drivers/nvdimm/pmem.c
+++ b/drivers/nvdimm/pmem.c
@@ -227,8 +227,11 @@ __weak long __pmem_direct_access(struct pmem_device *pmem, pgoff_t pgoff,
 	if (unlikely(is_bad_pmem(&pmem->bb, PFN_PHYS(pgoff) / 512,
 					PFN_PHYS(nr_pages))))
 		return -EIO;
-	*kaddr = pmem->virt_addr + offset;
-	*pfn = phys_to_pfn_t(pmem->phys_addr + offset, pmem->pfn_flags);
+
+	if (kaddr)
+		*kaddr = pmem->virt_addr + offset;
+	if (pfn)
+		*pfn = phys_to_pfn_t(pmem->phys_addr + offset, pmem->pfn_flags);
 
 	/*
 	 * If badblocks are present, limit known good range to the
-- 
1.8.3.1


_______________________________________________
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm

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

* [PATCH v2 2/6] s390, dcssblk: kaddr and pfn can be NULL to ->direct_access()
  2018-07-25 16:28 [PATCH v2 0/6] kaddr and pfn can be NULL to ->direct_access() Huaisheng Ye
  2018-07-25 16:28 ` [PATCH v2 1/6] libnvdimm, pmem: " Huaisheng Ye
@ 2018-07-25 16:28 ` Huaisheng Ye
  2018-07-28  4:07   ` [External] " Huaisheng HS1 Ye
  2018-07-25 16:28 ` [PATCH v2 3/6] tools/testing/nvdimm: " Huaisheng Ye
                   ` (5 subsequent siblings)
  7 siblings, 1 reply; 13+ messages in thread
From: Huaisheng Ye @ 2018-07-25 16:28 UTC (permalink / raw)
  To: linux-nvdimm, dan.j.williams
  Cc: axboe, linux-s390, snitzer, chengnt, linux-fsdevel,
	heiko.carstens, linux-kernel, willy, colyli, bart.vanassche,
	dm-devel, viro, gregkh, schwidefsky, jack, agk

From: Huaisheng Ye <yehs1@lenovo.com>

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 is prepared for allowing
them to pass in NULL instead of having to pass in a pointer or local
variable that they then just throw away.

Signed-off-by: Huaisheng Ye <yehs1@lenovo.com>
---
 drivers/s390/block/dcssblk.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/drivers/s390/block/dcssblk.c b/drivers/s390/block/dcssblk.c
index ed60728..23e526c 100644
--- a/drivers/s390/block/dcssblk.c
+++ b/drivers/s390/block/dcssblk.c
@@ -922,9 +922,11 @@ static DEVICE_ATTR(save, S_IWUSR | S_IRUSR, dcssblk_save_show,
 	unsigned long dev_sz;
 
 	dev_sz = dev_info->end - dev_info->start + 1;
-	*kaddr = (void *) dev_info->start + offset;
-	*pfn = __pfn_to_pfn_t(PFN_DOWN(dev_info->start + offset),
-			PFN_DEV|PFN_SPECIAL);
+	if (kaddr)
+		*kaddr = (void *) dev_info->start + offset;
+	if (pfn)
+		*pfn = __pfn_to_pfn_t(PFN_DOWN(dev_info->start + offset),
+				PFN_DEV|PFN_SPECIAL);
 
 	return (dev_sz - offset) / PAGE_SIZE;
 }
-- 
1.8.3.1


_______________________________________________
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm

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

* [PATCH v2 3/6] tools/testing/nvdimm: kaddr and pfn can be NULL to ->direct_access()
  2018-07-25 16:28 [PATCH v2 0/6] kaddr and pfn can be NULL to ->direct_access() Huaisheng Ye
  2018-07-25 16:28 ` [PATCH v2 1/6] libnvdimm, pmem: " Huaisheng Ye
  2018-07-25 16:28 ` [PATCH v2 2/6] s390, dcssblk: " Huaisheng Ye
@ 2018-07-25 16:28 ` Huaisheng Ye
  2018-07-25 16:28 ` [PATCH v2 4/6] dax/super: Do not request a pointer kaddr when not required Huaisheng Ye
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 13+ messages in thread
From: Huaisheng Ye @ 2018-07-25 16:28 UTC (permalink / raw)
  To: linux-nvdimm, dan.j.williams
  Cc: axboe, linux-s390, snitzer, chengnt, linux-fsdevel,
	heiko.carstens, linux-kernel, willy, colyli, bart.vanassche,
	dm-devel, viro, gregkh, schwidefsky, jack, agk

From: Huaisheng Ye <yehs1@lenovo.com>

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 this patch is prepared for allowing them to pass in
NULL instead of having to pass in a local pointer or variable that
they then just throw away.

Suggested-by: Dan Williams <dan.j.williams@intel.com>
Signed-off-by: Huaisheng Ye <yehs1@lenovo.com>
---
 tools/testing/nvdimm/pmem-dax.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/tools/testing/nvdimm/pmem-dax.c b/tools/testing/nvdimm/pmem-dax.c
index b53596a..2e7fd82 100644
--- a/tools/testing/nvdimm/pmem-dax.c
+++ b/tools/testing/nvdimm/pmem-dax.c
@@ -31,17 +31,21 @@ long __pmem_direct_access(struct pmem_device *pmem, pgoff_t pgoff,
 	if (get_nfit_res(pmem->phys_addr + offset)) {
 		struct page *page;
 
-		*kaddr = pmem->virt_addr + offset;
+		if (kaddr)
+			*kaddr = pmem->virt_addr + offset;
 		page = vmalloc_to_page(pmem->virt_addr + offset);
-		*pfn = page_to_pfn_t(page);
+		if (pfn)
+			*pfn = page_to_pfn_t(page);
 		pr_debug_ratelimited("%s: pmem: %p pgoff: %#lx pfn: %#lx\n",
 				__func__, pmem, pgoff, page_to_pfn(page));
 
 		return 1;
 	}
 
-	*kaddr = pmem->virt_addr + offset;
-	*pfn = phys_to_pfn_t(pmem->phys_addr + offset, pmem->pfn_flags);
+	if (kaddr)
+		*kaddr = pmem->virt_addr + offset;
+	if (pfn)
+		*pfn = phys_to_pfn_t(pmem->phys_addr + offset, pmem->pfn_flags);
 
 	/*
 	 * If badblocks are present, limit known good range to the
-- 
1.8.3.1


_______________________________________________
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm

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

* [PATCH v2 4/6] dax/super: Do not request a pointer kaddr when not required
  2018-07-25 16:28 [PATCH v2 0/6] kaddr and pfn can be NULL to ->direct_access() Huaisheng Ye
                   ` (2 preceding siblings ...)
  2018-07-25 16:28 ` [PATCH v2 3/6] tools/testing/nvdimm: " Huaisheng Ye
@ 2018-07-25 16:28 ` Huaisheng Ye
  2018-07-25 16:28 ` [PATCH v2 5/6] md/dm-writecache: Don't request pointer dummy_addr " Huaisheng Ye
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 13+ messages in thread
From: Huaisheng Ye @ 2018-07-25 16:28 UTC (permalink / raw)
  To: linux-nvdimm, dan.j.williams
  Cc: axboe, linux-s390, snitzer, chengnt, linux-fsdevel,
	heiko.carstens, linux-kernel, willy, colyli, bart.vanassche,
	dm-devel, viro, gregkh, schwidefsky, jack, agk

From: Huaisheng Ye <yehs1@lenovo.com>

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 <yehs1@lenovo.com>
---
 drivers/dax/super.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/dax/super.c b/drivers/dax/super.c
index 45276ab..6e928f3 100644
--- a/drivers/dax/super.c
+++ b/drivers/dax/super.c
@@ -89,7 +89,6 @@ bool __bdev_dax_supported(struct block_device *bdev, int blocksize)
 	struct request_queue *q;
 	pgoff_t pgoff;
 	int err, id;
-	void *kaddr;
 	pfn_t pfn;
 	long len;
 	char buf[BDEVNAME_SIZE];
@@ -122,7 +121,7 @@ bool __bdev_dax_supported(struct block_device *bdev, int blocksize)
 	}
 
 	id = dax_read_lock();
-	len = dax_direct_access(dax_dev, pgoff, 1, &kaddr, &pfn);
+	len = dax_direct_access(dax_dev, pgoff, 1, NULL, &pfn);
 	dax_read_unlock(id);
 
 	put_dax(dax_dev);
-- 
1.8.3.1


_______________________________________________
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm

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

* [PATCH v2 5/6] md/dm-writecache: Don't request pointer dummy_addr when not required
  2018-07-25 16:28 [PATCH v2 0/6] kaddr and pfn can be NULL to ->direct_access() Huaisheng Ye
                   ` (3 preceding siblings ...)
  2018-07-25 16:28 ` [PATCH v2 4/6] dax/super: Do not request a pointer kaddr when not required Huaisheng Ye
@ 2018-07-25 16:28 ` Huaisheng Ye
  2018-07-27 19:33   ` Mike Snitzer
  2018-07-25 16:28 ` [PATCH v2 6/6] filesystem-dax: Do not request kaddr and pfn " Huaisheng Ye
                   ` (2 subsequent siblings)
  7 siblings, 1 reply; 13+ messages in thread
From: Huaisheng Ye @ 2018-07-25 16:28 UTC (permalink / raw)
  To: linux-nvdimm, dan.j.williams
  Cc: axboe, linux-s390, snitzer, chengnt, linux-fsdevel,
	heiko.carstens, linux-kernel, willy, colyli, bart.vanassche,
	dm-devel, viro, gregkh, schwidefsky, jack, agk

From: Huaisheng Ye <yehs1@lenovo.com>

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 <ross.zwisler@linux.intel.com>
Signed-off-by: Huaisheng Ye <yehs1@lenovo.com>
---
 drivers/md/dm-writecache.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/md/dm-writecache.c b/drivers/md/dm-writecache.c
index 87107c9..9d79084 100644
--- a/drivers/md/dm-writecache.c
+++ b/drivers/md/dm-writecache.c
@@ -268,9 +268,8 @@ static int persistent_memory_claim(struct dm_writecache *wc)
 		i = 0;
 		do {
 			long daa;
-			void *dummy_addr;
 			daa = dax_direct_access(wc->ssd_dev->dax_dev, i, p - i,
-						&dummy_addr, &pfn);
+						NULL, &pfn);
 			if (daa <= 0) {
 				r = daa ? daa : -EINVAL;
 				goto err3;
-- 
1.8.3.1


_______________________________________________
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm

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

* [PATCH v2 6/6] filesystem-dax: Do not request kaddr and pfn when not required
  2018-07-25 16:28 [PATCH v2 0/6] kaddr and pfn can be NULL to ->direct_access() Huaisheng Ye
                   ` (4 preceding siblings ...)
  2018-07-25 16:28 ` [PATCH v2 5/6] md/dm-writecache: Don't request pointer dummy_addr " Huaisheng Ye
@ 2018-07-25 16:28 ` Huaisheng Ye
  2018-07-25 17:23 ` [PATCH v2 0/6] kaddr and pfn can be NULL to ->direct_access() Ross Zwisler
  2018-07-25 21:35 ` Dave Jiang
  7 siblings, 0 replies; 13+ messages in thread
From: Huaisheng Ye @ 2018-07-25 16:28 UTC (permalink / raw)
  To: linux-nvdimm, dan.j.williams
  Cc: axboe, linux-s390, snitzer, chengnt, linux-fsdevel,
	heiko.carstens, linux-kernel, willy, colyli, bart.vanassche,
	dm-devel, viro, gregkh, schwidefsky, jack, agk

From: Huaisheng Ye <yehs1@lenovo.com>

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 <yehs1@lenovo.com>
---
 fs/dax.c | 13 ++++---------
 1 file changed, 4 insertions(+), 9 deletions(-)

diff --git a/fs/dax.c b/fs/dax.c
index 6411928..959a533 100644
--- a/fs/dax.c
+++ b/fs/dax.c
@@ -647,7 +647,6 @@ static int copy_user_dax(struct block_device *bdev, struct dax_device *dax_dev,
 {
 	void *vto, *kaddr;
 	pgoff_t pgoff;
-	pfn_t pfn;
 	long rc;
 	int id;
 
@@ -656,7 +655,7 @@ static int copy_user_dax(struct block_device *bdev, struct dax_device *dax_dev,
 		return rc;
 
 	id = dax_read_lock();
-	rc = dax_direct_access(dax_dev, pgoff, PHYS_PFN(size), &kaddr, &pfn);
+	rc = dax_direct_access(dax_dev, pgoff, PHYS_PFN(size), &kaddr, NULL);
 	if (rc < 0) {
 		dax_read_unlock(id);
 		return rc;
@@ -967,7 +966,6 @@ static int dax_iomap_pfn(struct iomap *iomap, loff_t pos, size_t size,
 {
 	const sector_t sector = dax_iomap_sector(iomap, pos);
 	pgoff_t pgoff;
-	void *kaddr;
 	int id, rc;
 	long length;
 
@@ -976,7 +974,7 @@ static int dax_iomap_pfn(struct iomap *iomap, loff_t pos, size_t size,
 		return rc;
 	id = dax_read_lock();
 	length = dax_direct_access(iomap->dax_dev, pgoff, PHYS_PFN(size),
-				   &kaddr, pfnp);
+				   NULL, pfnp);
 	if (length < 0) {
 		rc = length;
 		goto out;
@@ -1052,15 +1050,13 @@ int __dax_zero_page_range(struct block_device *bdev,
 		pgoff_t pgoff;
 		long rc, id;
 		void *kaddr;
-		pfn_t pfn;
 
 		rc = bdev_dax_pgoff(bdev, sector, PAGE_SIZE, &pgoff);
 		if (rc)
 			return rc;
 
 		id = dax_read_lock();
-		rc = dax_direct_access(dax_dev, pgoff, 1, &kaddr,
-				&pfn);
+		rc = dax_direct_access(dax_dev, pgoff, 1, &kaddr, NULL);
 		if (rc < 0) {
 			dax_read_unlock(id);
 			return rc;
@@ -1116,7 +1112,6 @@ int __dax_zero_page_range(struct block_device *bdev,
 		ssize_t map_len;
 		pgoff_t pgoff;
 		void *kaddr;
-		pfn_t pfn;
 
 		if (fatal_signal_pending(current)) {
 			ret = -EINTR;
@@ -1128,7 +1123,7 @@ int __dax_zero_page_range(struct block_device *bdev,
 			break;
 
 		map_len = dax_direct_access(dax_dev, pgoff, PHYS_PFN(size),
-				&kaddr, &pfn);
+				&kaddr, NULL);
 		if (map_len < 0) {
 			ret = map_len;
 			break;
-- 
1.8.3.1


_______________________________________________
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm

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

* Re: [PATCH v2 0/6] kaddr and pfn can be NULL to ->direct_access()
  2018-07-25 16:28 [PATCH v2 0/6] kaddr and pfn can be NULL to ->direct_access() Huaisheng Ye
                   ` (5 preceding siblings ...)
  2018-07-25 16:28 ` [PATCH v2 6/6] filesystem-dax: Do not request kaddr and pfn " Huaisheng Ye
@ 2018-07-25 17:23 ` Ross Zwisler
  2018-07-25 21:35 ` Dave Jiang
  7 siblings, 0 replies; 13+ messages in thread
From: Ross Zwisler @ 2018-07-25 17:23 UTC (permalink / raw)
  To: Huaisheng Ye
  Cc: jack, snitzer, heiko.carstens, dm-devel, agk, linux-s390,
	linux-nvdimm, willy, bart.vanassche, chengnt, colyli,
	schwidefsky, viro, axboe, gregkh, linux-kernel, linux-fsdevel

On Thu, Jul 26, 2018 at 12:28:43AM +0800, Huaisheng Ye wrote:
> From: Huaisheng Ye <yehs1@lenovo.com>
> 
> 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://lkml.org/lkml/2018/7/24/199
> 
> Some functions within fs/dax, dax/super and md/dm-writecache don't
> need to get local pointer kaddr or variable pfn from direct_access.
> Assigning NULL to kaddr or pfn to ->direct_access() is more
> straightforward and simple than offering a useless local pointer or
> variable.
> 
> So all ->direct_access() need to check the validity of pointer kaddr
> and pfn for NULL assignment. If either of them is equal to NULL, that
> is to say callers may have no need for kaddr or pfn, so this series of
> patch are prepared for allowing them to pass in NULL instead of having
> to pass in a local pointer or variable that they then just throw away.

Looks good.  For the series:

Reviewed-by: Ross Zwisler <ross.zwisler@linux.intel.com>
_______________________________________________
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm

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

* Re: [PATCH v2 0/6] kaddr and pfn can be NULL to ->direct_access()
  2018-07-25 16:28 [PATCH v2 0/6] kaddr and pfn can be NULL to ->direct_access() Huaisheng Ye
                   ` (6 preceding siblings ...)
  2018-07-25 17:23 ` [PATCH v2 0/6] kaddr and pfn can be NULL to ->direct_access() Ross Zwisler
@ 2018-07-25 21:35 ` Dave Jiang
  2018-07-26  1:29   ` [External] " Huaisheng HS1 Ye
  7 siblings, 1 reply; 13+ messages in thread
From: Dave Jiang @ 2018-07-25 21:35 UTC (permalink / raw)
  To: Huaisheng Ye, linux-nvdimm, dan.j.williams
  Cc: axboe, linux-s390, jack, snitzer, chengnt, heiko.carstens,
	linux-kernel, willy, colyli, bart.vanassche, dm-devel, viro,
	gregkh, schwidefsky, linux-fsdevel, agk

Pretty straight forward series. Huaisheng, I can apply the whole series
to libnvdimm if we can get ack's from maintainer of dcssblk and
dm-writecache for the respective bits.

On 07/25/2018 09:28 AM, Huaisheng Ye wrote:
> From: Huaisheng Ye <yehs1@lenovo.com>
> 
> 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://lkml.org/lkml/2018/7/24/199
> 
> Some functions within fs/dax, dax/super and md/dm-writecache don't
> need to get local pointer kaddr or variable pfn from direct_access.
> Assigning NULL to kaddr or pfn to ->direct_access() is more
> straightforward and simple than offering a useless local pointer or
> variable.
> 
> So all ->direct_access() need to check the validity of pointer kaddr
> and pfn for NULL assignment. If either of them is equal to NULL, that
> is to say callers may have no need for kaddr or pfn, so this series of
> patch are prepared for allowing them to pass in NULL instead of having
> to pass in a local pointer or variable that they then just throw away.
> 
> Huaisheng Ye (6):
>   libnvdimm, pmem: kaddr and pfn can be NULL to ->direct_access()
>   s390, dcssblk: kaddr and pfn can be NULL to ->direct_access()
>   tools/testing/nvdimm: kaddr and pfn can be NULL to ->direct_access()
>   dax/super: Do not request a pointer kaddr when not required
>   md/dm-writecache: Don't request pointer dummy_addr when not required
>   filesystem-dax: Do not request kaddr and pfn when not required
> 
>  drivers/dax/super.c             |  3 +--
>  drivers/md/dm-writecache.c      |  3 +--
>  drivers/nvdimm/pmem.c           |  7 +++++--
>  drivers/s390/block/dcssblk.c    |  8 +++++---
>  fs/dax.c                        | 13 ++++---------
>  tools/testing/nvdimm/pmem-dax.c | 12 ++++++++----
>  6 files changed, 24 insertions(+), 22 deletions(-)
> 
_______________________________________________
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm

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

* RE: [External]  Re: [PATCH v2 0/6] kaddr and pfn can be NULL to ->direct_access()
  2018-07-25 21:35 ` Dave Jiang
@ 2018-07-26  1:29   ` Huaisheng HS1 Ye
  0 siblings, 0 replies; 13+ messages in thread
From: Huaisheng HS1 Ye @ 2018-07-26  1:29 UTC (permalink / raw)
  To: Dave Jiang, ross.zwisler, linux-nvdimm, dan.j.williams, jack
  Cc: axboe, linux-s390, snitzer, NingTing Cheng, heiko.carstens,
	linux-kernel, willy, colyli, bart.vanassche, dm-devel, viro,
	gregkh, schwidefsky, linux-fsdevel, agk

> From: Dave Jiang <dave.jiang@intel.com>
> Sent: Thursday, July 26, 2018 5:36 AM
> Subject: [External] Re: [PATCH v2 0/6] kaddr and pfn can be NULL to ->direct_access()
> 
> Pretty straight forward series. Huaisheng, I can apply the whole series
> to libnvdimm if we can get ack's from maintainer of dcssblk and
> dm-writecache for the respective bits.

Thanks Dave and Ross.

Hi Jan an Dan,

The previous patch series for NULL-pfn had got your Reviewed-by or Signed-off-by.
Now I have expanded them to local pointer kaddr, can I get your Reviewed-by for current
patch series? Your acks are very important to me.

Cheers,
Huaisheng Ye
_______________________________________________
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm

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

* Re: [PATCH v2 5/6] md/dm-writecache: Don't request pointer dummy_addr when not required
  2018-07-25 16:28 ` [PATCH v2 5/6] md/dm-writecache: Don't request pointer dummy_addr " Huaisheng Ye
@ 2018-07-27 19:33   ` Mike Snitzer
  0 siblings, 0 replies; 13+ messages in thread
From: Mike Snitzer @ 2018-07-27 19:33 UTC (permalink / raw)
  To: Huaisheng Ye
  Cc: jack, heiko.carstens, dm-devel, agk, linux-s390, linux-nvdimm,
	willy, bart.vanassche, chengnt, colyli, schwidefsky, viro, axboe,
	gregkh, linux-kernel, linux-fsdevel

On Wed, Jul 25 2018 at 12:28pm -0400,
Huaisheng Ye <yehs2007@zoho.com> wrote:

> From: Huaisheng Ye <yehs1@lenovo.com>
> 
> 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 <ross.zwisler@linux.intel.com>
> Signed-off-by: Huaisheng Ye <yehs1@lenovo.com>

Acked-by: Mike Snitzer <snitzer@redhat.com>
_______________________________________________
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm

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

* RE: [External]  [PATCH v2 2/6] s390, dcssblk: kaddr and pfn can be NULL to ->direct_access()
  2018-07-25 16:28 ` [PATCH v2 2/6] s390, dcssblk: " Huaisheng Ye
@ 2018-07-28  4:07   ` Huaisheng HS1 Ye
  2018-07-30  5:14     ` Martin Schwidefsky
  0 siblings, 1 reply; 13+ messages in thread
From: Huaisheng HS1 Ye @ 2018-07-28  4:07 UTC (permalink / raw)
  To: linux-s390, schwidefsky, heiko.carstens, bart.vanassche,
	martin.petersen, axboe, keescook
  Cc: snitzer, linux-nvdimm, NingTing Cheng, linux-kernel, willy,
	colyli, dm-devel, viro, gregkh, linux-fsdevel, jack, agk

Dear Maintainers of Linux-s390,

Greetings.

May I have your ack's for this patch? The whole series would be applied
to libnvdimm if it could get your approval.
And any suggestion is welcome.

Cheers,
Huaisheng Ye

> From: Huaisheng Ye <yehs2007@zoho.com>
> Sent: Thursday, July 26, 2018 12:29 AM
> 
> From: Huaisheng Ye <yehs1@lenovo.com>
> 
> 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 is prepared for allowing
> them to pass in NULL instead of having to pass in a pointer or local
> variable that they then just throw away.
> 
> Signed-off-by: Huaisheng Ye <yehs1@lenovo.com>
> ---
>  drivers/s390/block/dcssblk.c | 8 +++++---
>  1 file changed, 5 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/s390/block/dcssblk.c b/drivers/s390/block/dcssblk.c
> index ed60728..23e526c 100644
> --- a/drivers/s390/block/dcssblk.c
> +++ b/drivers/s390/block/dcssblk.c
> @@ -922,9 +922,11 @@ static DEVICE_ATTR(save, S_IWUSR | S_IRUSR, dcssblk_save_show,
>  	unsigned long dev_sz;
> 
>  	dev_sz = dev_info->end - dev_info->start + 1;
> -	*kaddr = (void *) dev_info->start + offset;
> -	*pfn = __pfn_to_pfn_t(PFN_DOWN(dev_info->start + offset),
> -			PFN_DEV|PFN_SPECIAL);
> +	if (kaddr)
> +		*kaddr = (void *) dev_info->start + offset;
> +	if (pfn)
> +		*pfn = __pfn_to_pfn_t(PFN_DOWN(dev_info->start + offset),
> +				PFN_DEV|PFN_SPECIAL);
> 
>  	return (dev_sz - offset) / PAGE_SIZE;
>  }
> --
> 1.8.3.1
_______________________________________________
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm

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

* Re: [External]  [PATCH v2 2/6] s390, dcssblk: kaddr and pfn can be NULL to ->direct_access()
  2018-07-28  4:07   ` [External] " Huaisheng HS1 Ye
@ 2018-07-30  5:14     ` Martin Schwidefsky
  0 siblings, 0 replies; 13+ messages in thread
From: Martin Schwidefsky @ 2018-07-30  5:14 UTC (permalink / raw)
  To: Huaisheng HS1 Ye
  Cc: jack, snitzer, heiko.carstens, dm-devel, agk, linux-s390,
	linux-nvdimm, willy, bart.vanassche, keescook, NingTing Cheng,
	colyli, viro, axboe, gregkh, linux-kernel, linux-fsdevel

On Sat, 28 Jul 2018 04:07:25 +0000
Huaisheng HS1 Ye <yehs1@lenovo.com> wrote:

> May I have your ack's for this patch? The whole series would be applied
> to libnvdimm if it could get your approval.
> And any suggestion is welcome.

Sure, it is just two additional ifs. I did not think that this needed an
ack, but here you go:

Acked-by: Martin Schwidefsky <schwidefsky@de.ibm.com>

> 
> Cheers,
> Huaisheng Ye
> 
> > From: Huaisheng Ye <yehs2007@zoho.com>
> > Sent: Thursday, July 26, 2018 12:29 AM
> > 
> > From: Huaisheng Ye <yehs1@lenovo.com>
> > 
> > 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 is prepared for allowing
> > them to pass in NULL instead of having to pass in a pointer or local
> > variable that they then just throw away.
> > 
> > Signed-off-by: Huaisheng Ye <yehs1@lenovo.com>
> > ---
> >  drivers/s390/block/dcssblk.c | 8 +++++---
> >  1 file changed, 5 insertions(+), 3 deletions(-)
> > 
> > diff --git a/drivers/s390/block/dcssblk.c b/drivers/s390/block/dcssblk.c
> > index ed60728..23e526c 100644
> > --- a/drivers/s390/block/dcssblk.c
> > +++ b/drivers/s390/block/dcssblk.c
> > @@ -922,9 +922,11 @@ static DEVICE_ATTR(save, S_IWUSR | S_IRUSR, dcssblk_save_show,
> >  	unsigned long dev_sz;
> > 
> >  	dev_sz = dev_info->end - dev_info->start + 1;
> > -	*kaddr = (void *) dev_info->start + offset;
> > -	*pfn = __pfn_to_pfn_t(PFN_DOWN(dev_info->start + offset),
> > -			PFN_DEV|PFN_SPECIAL);
> > +	if (kaddr)
> > +		*kaddr = (void *) dev_info->start + offset;
> > +	if (pfn)
> > +		*pfn = __pfn_to_pfn_t(PFN_DOWN(dev_info->start + offset),
> > +				PFN_DEV|PFN_SPECIAL);
> > 
> >  	return (dev_sz - offset) / PAGE_SIZE;
> >  }
> > --
> > 1.8.3.1  
> 


-- 
blue skies,
   Martin.

"Reality continues to ruin my life." - Calvin.

_______________________________________________
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm

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

end of thread, other threads:[~2018-07-30  5:15 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-07-25 16:28 [PATCH v2 0/6] kaddr and pfn can be NULL to ->direct_access() Huaisheng Ye
2018-07-25 16:28 ` [PATCH v2 1/6] libnvdimm, pmem: " Huaisheng Ye
2018-07-25 16:28 ` [PATCH v2 2/6] s390, dcssblk: " Huaisheng Ye
2018-07-28  4:07   ` [External] " Huaisheng HS1 Ye
2018-07-30  5:14     ` Martin Schwidefsky
2018-07-25 16:28 ` [PATCH v2 3/6] tools/testing/nvdimm: " Huaisheng Ye
2018-07-25 16:28 ` [PATCH v2 4/6] dax/super: Do not request a pointer kaddr when not required Huaisheng Ye
2018-07-25 16:28 ` [PATCH v2 5/6] md/dm-writecache: Don't request pointer dummy_addr " Huaisheng Ye
2018-07-27 19:33   ` Mike Snitzer
2018-07-25 16:28 ` [PATCH v2 6/6] filesystem-dax: Do not request kaddr and pfn " Huaisheng Ye
2018-07-25 17:23 ` [PATCH v2 0/6] kaddr and pfn can be NULL to ->direct_access() Ross Zwisler
2018-07-25 21:35 ` Dave Jiang
2018-07-26  1:29   ` [External] " Huaisheng HS1 Ye

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).