diff mbox

remove unused blkdev_dax_capable() function

Message ID 3280835.MNk2ItMooy@wuerfel (mailing list archive)
State New, archived
Headers show

Commit Message

Arnd Bergmann May 18, 2016, 7:54 a.m. UTC
The change from blkdev_dax_capable() to bdev_dax_capable() removed the only user
of the former, so we now get a build warning:

fs/block_dev.c:1244:13: error: 'blkdev_dax_capable' defined but not used [-Werror=unused-function]
 static bool blkdev_dax_capable(struct block_device *bdev)

This removes the now-unused function.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Fixes: a8078b1fc616 ("block: Update blkdev_dax_capable() for consistency")
---
On Tuesday 10 May 2016 10:23:57 Toshi Kani wrote:
> @@ -1295,7 +1330,7 @@ static int __blkdev_get(struct block_device *bdev, fmode_t mode, int for_part)
>  
>                         if (!ret) {
>                                 bd_set_size(bdev,(loff_t)get_capacity(disk)<<9);
> -                               if (!blkdev_dax_capable(bdev))
> +                               if (!bdev_dax_capable(bdev))
>                                         bdev->bd_inode->i_flags &= ~S_DAX;
> 

It's not entirely from the patch description what the intention was here
in keeping two slightly different implementations of the same function
in one file, my best guess is that it was not intentional and we should
just remove this.


--
To unsubscribe from this list: send the line "unsubscribe linux-block" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Comments

Kani, Toshi May 18, 2016, 2:01 p.m. UTC | #1
On Wed, 2016-05-18 at 09:54 +0200, Arnd Bergmann wrote:
> The change from blkdev_dax_capable() to bdev_dax_capable() removed the
> only user of the former, so we now get a build warning:
> 
> fs/block_dev.c:1244:13: error: 'blkdev_dax_capable' defined but not used
> [-Werror=unused-function]
>  static bool blkdev_dax_capable(struct block_device *bdev)
> 
> This removes the now-unused function.
> 
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> Fixes: a8078b1fc616 ("block: Update blkdev_dax_capable() for
> consistency")
 :
> It's not entirely from the patch description what the intention was here
> in keeping two slightly different implementations of the same function
> in one file, my best guess is that it was not intentional and we should
> just remove this.

Thanks for the build fix.  Looks like there was a conflict
between 8044aae6f374 and a8078b1fc616d, which resulted this build error.
Both patches moved blkdev_dax_capable() from block/ioctl.c
to fs/block_dev.c.

Acked-by: Toshi Kani <toshi.kani@hpe.com>

Thanks,
-Toshi
--
To unsubscribe from this list: send the line "unsubscribe linux-block" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Verma, Vishal L May 18, 2016, 7:30 p.m. UTC | #2
On Wed, May 18, 2016 at 09:54:08AM +0200, Arnd Bergmann wrote:
> The change from blkdev_dax_capable() to bdev_dax_capable() removed the only user
> of the former, so we now get a build warning:
> 
> fs/block_dev.c:1244:13: error: 'blkdev_dax_capable' defined but not used [-Werror=unused-function]
>  static bool blkdev_dax_capable(struct block_device *bdev)
> 
> This removes the now-unused function.
> 
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> Fixes: a8078b1fc616 ("block: Update blkdev_dax_capable() for consistency")
> ---
> On Tuesday 10 May 2016 10:23:57 Toshi Kani wrote:
> > @@ -1295,7 +1330,7 @@ static int __blkdev_get(struct block_device *bdev, fmode_t mode, int for_part)
> >  
> >                         if (!ret) {
> >                                 bd_set_size(bdev,(loff_t)get_capacity(disk)<<9);
> > -                               if (!blkdev_dax_capable(bdev))
> > +                               if (!bdev_dax_capable(bdev))
> >                                         bdev->bd_inode->i_flags &= ~S_DAX;
> > 
> 
> It's not entirely from the patch description what the intention was here
> in keeping two slightly different implementations of the same function
> in one file, my best guess is that it was not intentional and we should
> just remove this.
> 

Good catch - like Toshi said, this was indeed a mis-merge.

Stephen, for reference, I've added a branch with the expected conflict
resolution at:

https://git.kernel.org/cgit/linux/kernel/git/nvdimm/nvdimm.git/ libnvdimm-for-4.7-merge

Thanks,
	-Vishal
--
To unsubscribe from this list: send the line "unsubscribe linux-block" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
kernel test robot May 20, 2016, 11:32 a.m. UTC | #3
Hi,

[auto build test ERROR on next-20160517]
[cannot apply to v4.6-rc7 v4.6-rc6 v4.6-rc5 v4.6]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Arnd-Bergmann/remove-unused-blkdev_dax_capable-function/20160518-155729
config: m68k-allyesconfig (attached as .config)
compiler: m68k-linux-gcc (GCC) 4.9.0
reproduce:
        wget https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # save the attached .config to linux build tree
        make.cross ARCH=m68k 

All errors (new ones prefixed by >>):

   fs/block_dev.c: In function '__blkdev_get':
>> fs/block_dev.c:1242:5: error: implicit declaration of function 'blkdev_dax_capable' [-Werror=implicit-function-declaration]
        if (!blkdev_dax_capable(bdev))
        ^
   cc1: some warnings being treated as errors

vim +/blkdev_dax_capable +1242 fs/block_dev.c

d3374825 NeilBrown    2009-01-09  1236  					goto restart;
d3374825 NeilBrown    2009-01-09  1237  				}
1196f8b8 Tejun Heo    2011-04-21  1238  			}
7e69723f Tejun Heo    2011-05-23  1239  
5a023cdb Dan Williams 2015-11-30  1240  			if (!ret) {
7e69723f Tejun Heo    2011-05-23  1241  				bd_set_size(bdev,(loff_t)get_capacity(disk)<<9);
5a023cdb Dan Williams 2015-11-30 @1242  				if (!blkdev_dax_capable(bdev))
5a023cdb Dan Williams 2015-11-30  1243  					bdev->bd_inode->i_flags &= ~S_DAX;
5a023cdb Dan Williams 2015-11-30  1244  			}
7e69723f Tejun Heo    2011-05-23  1245  

:::::: The code at line 1242 was first introduced by commit
:::::: 5a023cdba50c5f5f2bc351783b3131699deb3937 block: enable dax for raw block devices

:::::: TO: Dan Williams <dan.j.williams@intel.com>
:::::: CC: Dan Williams <dan.j.williams@intel.com>

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation
Kani, Toshi May 20, 2016, 3:48 p.m. UTC | #4
FYI, fs/block_dev.c has multiple updates since then including the code in
question. I just built tot -next m64 kernel with the attached config file,
and confirmed no compile error on the file.
-Toshi

On Fri, 2016-05-20 at 19:32 +0800, kbuild test robot wrote:
> Hi,

> 

> [auto build test ERROR on next-20160517]

> [cannot apply to v4.6-rc7 v4.6-rc6 v4.6-rc5 v4.6]

> [if your patch is applied to the wrong git tree, please drop us a note to

> help improve the system]

> 

> url:    https://github.com/0day-ci/linux/commits/Arnd-Bergmann/remove-unu

> sed-blkdev_dax_capable-function/20160518-155729

> config: m68k-allyesconfig (attached as .config)

> compiler: m68k-linux-gcc (GCC) 4.9.0

> reproduce:

>         wget https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.g

> it/plain/sbin/make.cross -O ~/bin/make.cross

>         chmod +x ~/bin/make.cross

>         # save the attached .config to linux build tree

>         make.cross ARCH=m68k 

> 

> All errors (new ones prefixed by >>):

> 

>    fs/block_dev.c: In function '__blkdev_get':

> > 

> > > 

> > > fs/block_dev.c:1242:5: error: implicit declaration of function

> > > 'blkdev_dax_capable' [-Werror=implicit-function-declaration]

>         if (!blkdev_dax_capable(bdev))

>         ^

>    cc1: some warnings being treated as errors

> 

> vim +/blkdev_dax_capable +1242 fs/block_dev.c

> 

> d3374825 NeilBrown    2009-01-09  1236  					

> goto restart;

> d3374825 NeilBrown    2009-01-09  1237  				}

> 1196f8b8 Tejun Heo    2011-04-21  1238  			}

> 7e69723f Tejun Heo    2011-05-23  1239  

> 5a023cdb Dan Williams 2015-11-30  1240  			if (!ret)

> {

> 7e69723f Tejun Heo    2011-05-23  1241  				b

> d_set_size(bdev,(loff_t)get_capacity(disk)<<9);

> 5a023cdb Dan Williams 2015-11-30 @1242  				i

> f (!blkdev_dax_capable(bdev))

> 5a023cdb Dan Williams 2015-11-30  1243  					

> bdev->bd_inode->i_flags &= ~S_DAX;

> 5a023cdb Dan Williams 2015-11-30  1244  			}

> 7e69723f Tejun Heo    2011-05-23  1245  

> 

> :::::: The code at line 1242 was first introduced by commit

> :::::: 5a023cdba50c5f5f2bc351783b3131699deb3937 block: enable dax for raw

> block devices

> 

> :::::: TO: Dan Williams <dan.j.williams@intel.com>

> :::::: CC: Dan Williams <dan.j.williams@intel.com>

> 

> ---

> 0-DAY kernel test infrastructure                Open Source Technology

> Center

> https://lists.01.org/pipermail/kbuild-all                   Intel

> Corporation
diff mbox

Patch

diff --git a/fs/block_dev.c b/fs/block_dev.c
index 97f324642b5f..dad77225a721 100644
--- a/fs/block_dev.c
+++ b/fs/block_dev.c
@@ -1241,33 +1241,6 @@  void bd_set_size(struct block_device *bdev, loff_t size)
 }
 EXPORT_SYMBOL(bd_set_size);
 
-static bool blkdev_dax_capable(struct block_device *bdev)
-{
-	struct gendisk *disk = bdev->bd_disk;
-
-	if (!disk->fops->direct_access || !IS_ENABLED(CONFIG_FS_DAX))
-		return false;
-
-	/*
-	 * If the partition is not aligned on a page boundary, we can't
-	 * do dax I/O to it.
-	 */
-	if ((bdev->bd_part->start_sect % (PAGE_SIZE / 512))
-			|| (bdev->bd_part->nr_sects % (PAGE_SIZE / 512)))
-		return false;
-
-	/*
-	 * If the device has known bad blocks, force all I/O through the
-	 * driver / page cache.
-	 *
-	 * TODO: support finer grained dax error handling
-	 */
-	if (disk->bb && disk->bb->count)
-		return false;
-
-	return true;
-}
-
 static void __blkdev_put(struct block_device *bdev, fmode_t mode, int for_part);
 
 /*