Re: [PATCH 5/5] dax,iomap: Add helper dax_iomap_zero() to zero a range

2020-02-05 Thread Vivek Goyal
On Wed, Feb 05, 2020 at 10:36:09AM -0800, Christoph Hellwig wrote:
> > +int dax_iomap_zero(loff_t pos, unsigned offset, unsigned size,
> > + struct iomap *iomap)
> >  {
> > pgoff_t pgoff;
> > long rc, id;
> > +   sector_t sector = iomap_sector(iomap, pos & PAGE_MASK);
> >  
> > -   rc = bdev_dax_pgoff(bdev, sector, PAGE_SIZE, );
> > +   rc = bdev_dax_pgoff(iomap->bdev, sector, PAGE_SIZE, );
> > if (rc)
> > return rc;
> >  
> > id = dax_read_lock();
> > -   rc = dax_zero_page_range(dax_dev, pgoff, offset, size);
> > +   rc = dax_zero_page_range(iomap->dax_dev, pgoff, offset, size);
> > dax_read_unlock(id);
> > return rc;
> >  }
> > -EXPORT_SYMBOL_GPL(__dax_zero_page_range);
> > +EXPORT_SYMBOL_GPL(dax_iomap_zero);
> 
> This function is only used by fs/iomap/buffered-io.c, so no need to
> export it.

Will do.

> 
> >  #ifdef CONFIG_FS_DAX
> > -int __dax_zero_page_range(struct block_device *bdev,
> > -   struct dax_device *dax_dev, sector_t sector,
> > -   unsigned int offset, unsigned int length);
> > +int dax_iomap_zero(loff_t pos, unsigned offset, unsigned size,
> > + struct iomap *iomap);
> >  #else
> > -static inline int __dax_zero_page_range(struct block_device *bdev,
> > -   struct dax_device *dax_dev, sector_t sector,
> > -   unsigned int offset, unsigned int length)
> > +static inline int dax_iomap_zero(loff_t pos, unsigned offset, unsigned 
> > size,
> > +struct iomap *iomap)
> >  {
> > return -ENXIO;
> >  }
> 
> Given that the only caller is under an IS_DAX() check you could just
> declare the function unconditionally and let the compiler optimize
> away the guaranteed dead call for the !CONFIG_FS_DAX case, like we
> do with various other functions.

Sure, will do.

Vivek
___
Linux-nvdimm mailing list -- linux-nvdimm@lists.01.org
To unsubscribe send an email to linux-nvdimm-le...@lists.01.org


Re: [PATCH 5/5] dax,iomap: Add helper dax_iomap_zero() to zero a range

2020-02-05 Thread Christoph Hellwig
> +int dax_iomap_zero(loff_t pos, unsigned offset, unsigned size,
> +   struct iomap *iomap)
>  {
>   pgoff_t pgoff;
>   long rc, id;
> + sector_t sector = iomap_sector(iomap, pos & PAGE_MASK);
>  
> - rc = bdev_dax_pgoff(bdev, sector, PAGE_SIZE, );
> + rc = bdev_dax_pgoff(iomap->bdev, sector, PAGE_SIZE, );
>   if (rc)
>   return rc;
>  
>   id = dax_read_lock();
> - rc = dax_zero_page_range(dax_dev, pgoff, offset, size);
> + rc = dax_zero_page_range(iomap->dax_dev, pgoff, offset, size);
>   dax_read_unlock(id);
>   return rc;
>  }
> -EXPORT_SYMBOL_GPL(__dax_zero_page_range);
> +EXPORT_SYMBOL_GPL(dax_iomap_zero);

This function is only used by fs/iomap/buffered-io.c, so no need to
export it.

>  #ifdef CONFIG_FS_DAX
> -int __dax_zero_page_range(struct block_device *bdev,
> - struct dax_device *dax_dev, sector_t sector,
> - unsigned int offset, unsigned int length);
> +int dax_iomap_zero(loff_t pos, unsigned offset, unsigned size,
> +   struct iomap *iomap);
>  #else
> -static inline int __dax_zero_page_range(struct block_device *bdev,
> - struct dax_device *dax_dev, sector_t sector,
> - unsigned int offset, unsigned int length)
> +static inline int dax_iomap_zero(loff_t pos, unsigned offset, unsigned size,
> +  struct iomap *iomap)
>  {
>   return -ENXIO;
>  }

Given that the only caller is under an IS_DAX() check you could just
declare the function unconditionally and let the compiler optimize
away the guaranteed dead call for the !CONFIG_FS_DAX case, like we
do with various other functions.
___
Linux-nvdimm mailing list -- linux-nvdimm@lists.01.org
To unsubscribe send an email to linux-nvdimm-le...@lists.01.org


Re: [PATCH 5/5] dax,iomap: Add helper dax_iomap_zero() to zero a range

2020-02-03 Thread kbuild test robot
Hi Vivek,

I love your patch! Yet something to improve:

[auto build test ERROR on dm/for-next]
[also build test ERROR on s390/features xfs-linux/for-next linus/master 
linux-nvdimm/libnvdimm-for-next v5.5 next-20200203]
[if your patch is applied to the wrong git tree, please drop us a note to help
improve the system. BTW, we also suggest to use '--base' option to specify the
base tree in git format-patch, please see https://stackoverflow.com/a/37406982]

url:
https://github.com/0day-ci/linux/commits/Vivek-Goyal/dax-pmem-Provide-a-dax-operation-to-zero-range-of-memory/20200204-082750
base:   
https://git.kernel.org/pub/scm/linux/kernel/git/device-mapper/linux-dm.git 
for-next
config: s390-alldefconfig (attached as .config)
compiler: s390-linux-gcc (GCC) 7.5.0
reproduce:
wget 
https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O 
~/bin/make.cross
chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
GCC_VERSION=7.5.0 make.cross ARCH=s390 

If you fix the issue, kindly add following tag
Reported-by: kbuild test robot 

All errors (new ones prefixed by >>):

>> drivers/s390/block/dcssblk.c:65:21: error: 'dcssblk_dax_zero_page_range' 
>> undeclared here (not in a function); did you mean 
>> 'generic_dax_zero_page_range'?
 .zero_page_range = dcssblk_dax_zero_page_range,
^~~
generic_dax_zero_page_range
   drivers/s390/block/dcssblk.c:945:12: warning: 'dcssblk_dax_zero_page_range' 
defined but not used [-Wunused-function]
static int dcssblk_dax_zero_page_range(struct dax_device *dax_dev,pgoff_t 
pgoff,
   ^~~

vim +65 drivers/s390/block/dcssblk.c

b3a9a0c36e1f7b Dan Williams   2018-05-02  59  
7a2765f6e82063 Dan Williams   2017-01-26  60  static const struct 
dax_operations dcssblk_dax_ops = {
7a2765f6e82063 Dan Williams   2017-01-26  61.direct_access = 
dcssblk_dax_direct_access,
7bf7eac8d64805 Dan Williams   2019-05-16  62.dax_supported = 
generic_fsdax_supported,
5d61e43b3975c0 Dan Williams   2017-06-27  63.copy_from_iter = 
dcssblk_dax_copy_from_iter,
b3a9a0c36e1f7b Dan Williams   2018-05-02  64.copy_to_iter = 
dcssblk_dax_copy_to_iter,
c5cb636194a0d8 Vivek Goyal2020-02-03 @65.zero_page_range = 
dcssblk_dax_zero_page_range,
^1da177e4c3f41 Linus Torvalds 2005-04-16  66  };
^1da177e4c3f41 Linus Torvalds 2005-04-16  67  

:: The code at line 65 was first introduced by commit
:: c5cb636194a0d8d33d549903c92189385db48406 s390,dax: Add dax 
zero_page_range operation to dcssblk driver

:: TO: Vivek Goyal 
:: CC: 0day robot 

---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/hyperkitty/list/kbuild-...@lists.01.org Intel Corporation
___
Linux-nvdimm mailing list -- linux-nvdimm@lists.01.org
To unsubscribe send an email to linux-nvdimm-le...@lists.01.org