linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/1] device-dax: delete a redundancy check in dev_dax_validate_align()
@ 2020-11-20  9:20 Zhen Lei
  2020-11-20  9:27 ` Leizhen (ThunderTown)
  0 siblings, 1 reply; 3+ messages in thread
From: Zhen Lei @ 2020-11-20  9:20 UTC (permalink / raw)
  To: Dan Williams, Vishal Verma, Dave Jiang, linux-nvdimm, linux-kernel
  Cc: Zhen Lei

After we have done the alignment check for the length of each range, the
alignment check for dev_dax_size(dev_dax) is no longer needed, because it
get the sum of the length of each range.

Signed-off-by: Zhen Lei <thunder.leizhen@huawei.com>
---
 drivers/dax/bus.c | 7 -------
 1 file changed, 7 deletions(-)

diff --git a/drivers/dax/bus.c b/drivers/dax/bus.c
index 1efae11d947a..35f9238c0139 100644
--- a/drivers/dax/bus.c
+++ b/drivers/dax/bus.c
@@ -1109,16 +1109,9 @@ static ssize_t align_show(struct device *dev,
 
 static ssize_t dev_dax_validate_align(struct dev_dax *dev_dax)
 {
-	resource_size_t dev_size = dev_dax_size(dev_dax);
 	struct device *dev = &dev_dax->dev;
 	int i;
 
-	if (dev_size > 0 && !alloc_is_aligned(dev_dax, dev_size)) {
-		dev_dbg(dev, "%s: align %u invalid for size %pa\n",
-			__func__, dev_dax->align, &dev_size);
-		return -EINVAL;
-	}
-
 	for (i = 0; i < dev_dax->nr_range; i++) {
 		size_t len = range_len(&dev_dax->ranges[i].range);
 
-- 
2.26.0.106.g9fadedd



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

* Re: [PATCH 1/1] device-dax: delete a redundancy check in dev_dax_validate_align()
  2020-11-20  9:20 [PATCH 1/1] device-dax: delete a redundancy check in dev_dax_validate_align() Zhen Lei
@ 2020-11-20  9:27 ` Leizhen (ThunderTown)
  2020-12-17 21:49   ` Dan Williams
  0 siblings, 1 reply; 3+ messages in thread
From: Leizhen (ThunderTown) @ 2020-11-20  9:27 UTC (permalink / raw)
  To: Dan Williams, Vishal Verma, Dave Jiang, linux-nvdimm, linux-kernel



On 2020/11/20 17:20, Zhen Lei wrote:
> After we have done the alignment check for the length of each range, the
> alignment check for dev_dax_size(dev_dax) is no longer needed, because it
> get the sum of the length of each range.

For example:
x/M + y/M = (x + y)/M
If x/M is a integer and y/M is also a integer, then (x + y)/M must be a integer.

> 
> Signed-off-by: Zhen Lei <thunder.leizhen@huawei.com>
> ---
>  drivers/dax/bus.c | 7 -------
>  1 file changed, 7 deletions(-)
> 
> diff --git a/drivers/dax/bus.c b/drivers/dax/bus.c
> index 1efae11d947a..35f9238c0139 100644
> --- a/drivers/dax/bus.c
> +++ b/drivers/dax/bus.c
> @@ -1109,16 +1109,9 @@ static ssize_t align_show(struct device *dev,
>  
>  static ssize_t dev_dax_validate_align(struct dev_dax *dev_dax)
>  {
> -	resource_size_t dev_size = dev_dax_size(dev_dax);
>  	struct device *dev = &dev_dax->dev;
>  	int i;
>  
> -	if (dev_size > 0 && !alloc_is_aligned(dev_dax, dev_size)) {
> -		dev_dbg(dev, "%s: align %u invalid for size %pa\n",
> -			__func__, dev_dax->align, &dev_size);
> -		return -EINVAL;
> -	}
> -
>  	for (i = 0; i < dev_dax->nr_range; i++) {
>  		size_t len = range_len(&dev_dax->ranges[i].range);
>  
> 


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

* Re: [PATCH 1/1] device-dax: delete a redundancy check in dev_dax_validate_align()
  2020-11-20  9:27 ` Leizhen (ThunderTown)
@ 2020-12-17 21:49   ` Dan Williams
  0 siblings, 0 replies; 3+ messages in thread
From: Dan Williams @ 2020-12-17 21:49 UTC (permalink / raw)
  To: Leizhen (ThunderTown)
  Cc: Vishal Verma, Dave Jiang, linux-nvdimm, linux-kernel

On Fri, Nov 20, 2020 at 1:27 AM Leizhen (ThunderTown)
<thunder.leizhen@huawei.com> wrote:
>
>
>
> On 2020/11/20 17:20, Zhen Lei wrote:
> > After we have done the alignment check for the length of each range, the
> > alignment check for dev_dax_size(dev_dax) is no longer needed, because it
> > get the sum of the length of each range.
>
> For example:
> x/M + y/M = (x + y)/M
> If x/M is a integer and y/M is also a integer, then (x + y)/M must be a integer.
>

True... I was going to say that the different error messages might be
useful, but those are debug statements anyways, so I'll apply this.

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

end of thread, other threads:[~2020-12-17 21:50 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-20  9:20 [PATCH 1/1] device-dax: delete a redundancy check in dev_dax_validate_align() Zhen Lei
2020-11-20  9:27 ` Leizhen (ThunderTown)
2020-12-17 21:49   ` Dan Williams

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).