kernel-janitors.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [block:for-3.7/core 20/21] fs/block_dev.c:1644:5: sparse: symbol 'blkdev_mmap' was not declared. Sho
@ 2012-09-26  7:42 Fengguang Wu
  2012-09-26  7:59 ` [block:for-3.7/core 20/21] fs/block_dev.c:1644:5: sparse: symbol 'blkdev_mmap' was not declared Jens Axboe
  0 siblings, 1 reply; 4+ messages in thread
From: Fengguang Wu @ 2012-09-26  7:42 UTC (permalink / raw)
  To: kernel-janitors

[-- Attachment #1: Type: text/plain, Size: 593 bytes --]

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

[-- Attachment #2: make-it-static-b87570f.diff --]
[-- Type: text/x-diff, Size: 462 bytes --]

diff --git a/fs/block_dev.c b/fs/block_dev.c
index cdfb625..5aa4683 100644
--- a/fs/block_dev.c
+++ b/fs/block_dev.c
@@ -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);

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

* Re: [block:for-3.7/core 20/21] fs/block_dev.c:1644:5: sparse: symbol 'blkdev_mmap' was not declared.
  2012-09-26  7:42 [block:for-3.7/core 20/21] fs/block_dev.c:1644:5: sparse: symbol 'blkdev_mmap' was not declared. Sho Fengguang Wu
@ 2012-09-26  7:59 ` Jens Axboe
  2012-09-26 15:10   ` [PATCH] percpu-rw-semaphore: fix typos Mikulas Patocka
  0 siblings, 1 reply; 4+ messages in thread
From: Jens Axboe @ 2012-09-26  7:59 UTC (permalink / raw)
  To: kernel-janitors

On 2012-09-26 09:42, Fengguang Wu wrote:
> 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.

-- 
Jens Axboe


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

* [PATCH] percpu-rw-semaphore: fix typos
@ 2012-09-26 15:10   ` Mikulas Patocka
  2012-10-04  0:58     ` [PATCH] percpu-rw-semaphore: lock splice methods Mikulas Patocka
  0 siblings, 1 reply; 4+ messages in thread
From: Mikulas Patocka @ 2012-09-26 15:10 UTC (permalink / raw)
  To: kernel-janitors



On Wed, 26 Sep 2012, Jens Axboe wrote:

> On 2012-09-26 09:42, Fengguang Wu wrote:
> > 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.
> 
> -- 
> Jens Axboe

One more patch for this thing, fixing some typos in the documentation.

Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>

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

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

* [PATCH] percpu-rw-semaphore: lock splice methods
  2012-09-26 15:10   ` [PATCH] percpu-rw-semaphore: fix typos Mikulas Patocka
@ 2012-10-04  0:58     ` Mikulas Patocka
  0 siblings, 0 replies; 4+ messages in thread
From: Mikulas Patocka @ 2012-10-04  0:58 UTC (permalink / raw)
  To: Jens Axboe; +Cc: dm-devel, kernel-janitors

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.

Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>

---
 fs/block_dev.c |   37 +++++++++++++++++++++++++++++++++++--
 1 file changed, 35 insertions(+), 2 deletions(-)

Index: linux-2.6-copy/fs/block_dev.c
=================================--- linux-2.6-copy.orig/fs/block_dev.c	2012-10-04 02:26:01.000000000 +0200
+++ linux-2.6-copy/fs/block_dev.c	2012-10-04 02:30:37.000000000 +0200
@@ -1662,6 +1662,39 @@ static int blkdev_mmap(struct file *file
 	return 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)

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

end of thread, other threads:[~2012-10-04  0:58 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-09-26  7:42 [block:for-3.7/core 20/21] fs/block_dev.c:1644:5: sparse: symbol 'blkdev_mmap' was not declared. Sho Fengguang Wu
2012-09-26  7:59 ` [block:for-3.7/core 20/21] fs/block_dev.c:1644:5: sparse: symbol 'blkdev_mmap' was not declared Jens Axboe
2012-09-26 15:10   ` [PATCH] percpu-rw-semaphore: fix typos Mikulas Patocka
2012-10-04  0:58     ` [PATCH] percpu-rw-semaphore: lock splice methods Mikulas Patocka

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