OSDN Git Service

Btrfs: move finish_wait out of the loop
authorLiu Bo <bo.li.liu@oracle.com>
Fri, 1 Sep 2017 22:14:28 +0000 (16:14 -0600)
committerDavid Sterba <dsterba@suse.com>
Mon, 30 Oct 2017 11:27:55 +0000 (12:27 +0100)
If we're still going to wait after schedule(), we don't have to do
finish_wait() to remove our %wait_queue_entry since prepare_to_wait()
won't add the same %wait_queue_entry twice.

Signed-off-by: Liu Bo <bo.li.liu@oracle.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/ioctl.c

index 6c7a49f..1d4f8a7 100644 (file)
@@ -622,8 +622,8 @@ static void btrfs_wait_for_no_snapshotting_writes(struct btrfs_root *root)
                if (writers)
                        schedule();
 
-               finish_wait(&root->subv_writers->wait, &wait);
        } while (writers);
+       finish_wait(&root->subv_writers->wait, &wait);
 }
 
 static int create_snapshot(struct btrfs_root *root, struct inode *dir,