fs/block_dev.c:1644:5: sparse: symbol 'blkdev_mmap' was not declared. Sho
Subsystems (3)
PATCH 20/21 fs/block_dev.c:1644:5: sparse: symbol 'blkdev_mmap' was not declared. Sho
Hi Jens,
FYI, there are new sparse warnings show up in
tree: git://git.kernel.dk/linux-block.git for-3.7/core head: 62ac665ff9fc07497ca524bd20d6a96893d11071 commit: b87570f5d349661814b262dd5fc40787700f80d6 [20/21] Fix a crash when block device is read and block size is changed at the same time
+ fs/block_dev.c:1644:5: sparse: symbol 'blkdev_mmap' was not declared. Should it be static?
Please consider folding the attached diff :-)
---
0-DAY kernel build testing backend Open Source Technology Centre
Fengguang Wu, Yuanhan Liu Intel Corporation
fs/block_dev.c +1 -1
@@ -1641,7 +1641,7 @@ ssize_t blkdev_aio_write(struct kiocb *iocb, const struct iovec *iov, }EXPORT_SYMBOL_GPL (blkdev_aio_write); -int blkdev_mmap (struct file *file,struct vm_area_struct *vma) +static int blkdev_mmap (struct file *file,struct vm_area_struct *vma) {int ret;struct block_device *bdev =I_BDEV (file->f_mapping->host);
Re: [block:for-3.7/core 20/21] fs/block_dev.c:1644:5: sparse: symbol 'blkdev_mmap' was not declared.
Quoted 11 lines · Fengguang Wu
Hi Jens,
FYI, there are new sparse warnings show up in
tree: git://git.kernel.dk/linux-block.git for-3.7/core head: 62ac665ff9fc07497ca524bd20d6a96893d11071 commit: b87570f5d349661814b262dd5fc40787700f80d6 [20/21] Fix a crash when block device is read and block size is changed at the same time+
fs/block_dev.c:1644:5: sparse: symbol 'blkdev_mmap' was not declared. Should it be static?Please consider folding the attached diff :-)
Thanks Wu, you are (as usual) exceptionally fast :-)
Patch applied.
Signature · 1 line
Jens Axboe
Mikulas Patocka
maintainerPATCH 1/1 percpu-rw-semaphore: fix typos
Quoted 9 lines · Jens Axboe
Quoted 8 lines · Fengguang Wu
Hi Jens,
FYI, there are new sparse warnings show up in
tree: git://git.kernel.dk/linux-block.git for-3.7/core head: 62ac665ff9fc07497ca524bd20d6a96893d11071 commit: b87570f5d349661814b262dd5fc40787700f80d6 [20/21] Fix a crash when block device is read and block size is changed at the same time
Quoted 10 lines
Quoted 3 lines
+
fs/block_dev.c:1644:5: sparse: symbol 'blkdev_mmap' was not declared. Should it be static?Please consider folding the attached diff :-)
Thanks Wu, you are (as usual) exceptionally fast :-)
Patch applied.
Signature · 1 line
Jens Axboe
One more patch for this thing, fixing some typos in the documentation.
--- Documentation/percpu-rw-semaphore.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
Index: linux-2.6-copy/Documentation/percpu-rw-semaphore.txt
=================================--- linux-2.6-copy.orig/Documentation/percpu-rw-semaphore.txt 2012-09-26 17:06:05.000000000 +0200
+++ linux-2.6-copy/Documentation/percpu-rw-semaphore.txt 2012-09-26 17:06:32.000000000 +0200
@@ -9,10 +9,10 @@ cores take the lock for reading, the cac
is bouncing between L1 caches of the cores, causing performance degradation.
-Locking for reading it very fast, it uses RCU and it avoids any atomic +Locking for reading is very fast, it uses RCU and it avoids any atomic
instruction in the lock and unlock path. On the other hand, locking for writing is very expensive, it calls synchronize_rcu() that can take
-hundreds of microseconds.
+hundreds of milliseconds.
The lock is declared with "struct percpu_rw_semaphore" type. The lock is initialized percpu_init_rwsem, it returns 0 on success and
Mikulas Patocka
maintainerPATCH 1/1 percpu-rw-semaphore: lock splice methods
Hi Jens
I actually forgot to lock functions generic_file_splice_read and generic_file_splice_write when submitting the commit b87570f5d349661814b262dd5fc40787700f80d6. They must be locked too.
Please apply this.
Mikulas
---
blockdev: use rwlock for splice
A rwlock that prevents changing block size while IO is being submitted needs to be taken around generic_file_splice_read and generic_file_splice_write functions. These functions manipulate the page cache directly so block size must not change under them.
--- fs/block_dev.c | 37 +++++++++++++++++++++++++++++++++++-- 1 file changed, 35 insertions(+), 2 deletions(-)
fs/block_dev.c +35 -2
@@ -1662,6 +1662,39 @@ static int blkdev_mmap(struct file *filereturn ret; } +static ssize_t blkdev_splice_read (struct file *file,loff_t *ppos, +struct pipe_inode_info *pipe,size_t len, +unsigned int flags) +{ +ssize_t ret; +struct block_device *bdev =I_BDEV (file->f_mapping->host); + +percpu_down_read (&bdev->bd_block_size_semaphore); + + ret =generic_file_splice_read (file, ppos, pipe, len, flags); + +percpu_up_read (&bdev->bd_block_size_semaphore); + +return ret; +} + +static ssize_t blkdev_splice_write (struct pipe_inode_info *pipe, +struct file *file,loff_t *ppos,size_t len, +unsigned int flags) +{ +ssize_t ret; +struct block_device *bdev =I_BDEV (file->f_mapping->host); + +percpu_down_read (&bdev->bd_block_size_semaphore); + + ret =generic_file_splice_write (pipe, file, ppos, len, flags); + +percpu_up_read (&bdev->bd_block_size_semaphore); + +return ret; +} + +/* * Try to release a page associated with block device when the system * is under memory pressure.
@@ -1700,8 +1733,8 @@ const struct file_operations def_blk_fop#ifdef CONFIG_COMPAT .compat_ioctl = compat_blkdev_ioctl, #endif - .splice_read = generic_file_splice_read, - .splice_write = generic_file_splice_write, + .splice_read = blkdev_splice_read, + .splice_write = blkdev_splice_write, };int ioctl_by_bdev (struct block_device *bdev,unsigned cmd,unsigned long arg)