[PATCH 03/11] fs: move __get_super() out of loop

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



__get_super_thawed() calls __get_super() multiple times. I can't see a case
where __get_super() would return another valid superblock when called
again, so move the call to __get_super() out of the loop. This is done in
preparation for the next patch.

Signed-off-by: Sascha Hauer <s.hauer@xxxxxxxxxxxxxx>
---
 fs/super.c | 15 ++++++++++++---
 1 file changed, 12 insertions(+), 3 deletions(-)

diff --git a/fs/super.c b/fs/super.c
index 5960578a4076..f85d1ea194ae 100644
--- a/fs/super.c
+++ b/fs/super.c
@@ -786,17 +786,26 @@ EXPORT_SYMBOL(get_super);
 static struct super_block *__get_super_thawed(struct block_device *bdev,
 					      bool excl)
 {
+	struct super_block *s = __get_super(bdev, excl);
+	if (!s)
+		return NULL;
+
 	while (1) {
-		struct super_block *s = __get_super(bdev, excl);
-		if (!s || s->s_writers.frozen == SB_UNFROZEN)
+		if (s->s_writers.frozen == SB_UNFROZEN)
 			return s;
+
 		if (!excl)
 			up_read(&s->s_umount);
 		else
 			up_write(&s->s_umount);
+
 		wait_event(s->s_writers.wait_unfrozen,
 			   s->s_writers.frozen == SB_UNFROZEN);
-		put_super(s);
+
+		if (!excl)
+			down_read(&sb->s_umount);
+		else
+			down_write(&sb->s_umount);
 	}
 }
 
-- 
2.20.1




[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux