On Fri, 28 Sep 2012 11:19:29 -0400 (EDT)
Mikulas Patocka <mpato...@redhat.com> wrote:
> > -   if (!prio_tree_empty(&mapping->i_mmap) ||
> > +   if (!RB_EMPTY_ROOT(&mapping->i_mmap) ||
> >         !list_empty(&mapping->i_mmap_nonlinear)) {
> >             mutex_unlock(&mapping->i_mmap_mutex);
> >             percpu_up_write(&bdev->bd_block_size_semaphore);
> > -- 
> > 1.7.10.280.gaa39
> > 
> > -- 
> > Cheers,
> > Stephen Rothwell                    s...@canb.auug.org.au
> 
> ... or replace it with
> 
> if (mapping_mapped(&mapping)) { ...

yup..

From: Andrew Morton <a...@linux-foundation.org>
Subject: fs/block_dev.c:set_blocksize(): use mapping_mapped()

... instead of open-coding it.

Suggested-by: Mikulas Patocka <mpato...@redhat.com>
Cc: Stephen Rothwell <s...@canb.auug.org.au>
Signed-off-by: Andrew Morton <a...@linux-foundation.org>
---

 fs/block_dev.c |    4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff -puN fs/block_dev.c~fs-block_devc-set_blocksize-use-mapping_mapped 
fs/block_dev.c
--- a/fs/block_dev.c~fs-block_devc-set_blocksize-use-mapping_mapped
+++ a/fs/block_dev.c
@@ -27,7 +27,6 @@
 #include <linux/namei.h>
 #include <linux/log2.h>
 #include <linux/cleancache.h>
-#include <linux/rbtree.h>
 #include <asm/uaccess.h>
 #include "internal.h"
 
@@ -133,8 +132,7 @@ int set_blocksize(struct block_device *b
        /* Check that the block device is not memory mapped */
        mapping = bdev->bd_inode->i_mapping;
        mutex_lock(&mapping->i_mmap_mutex);
-       if (!RB_EMPTY_ROOT(&mapping->i_mmap) ||
-           !list_empty(&mapping->i_mmap_nonlinear)) {
+       if (mapping_mapped(mapping)) {
                mutex_unlock(&mapping->i_mmap_mutex);
                percpu_up_write(&bdev->bd_block_size_semaphore);
                return -EBUSY;
_

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to