<html>
<head>
<meta content="text/html; charset=windows-1252"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<p>Acked-by: Maxim Patlasov <a class="moz-txt-link-rfc2396E"
href="mailto:mpatlasov@virtuozzo.com"><mpatlasov@virtuozzo.com></a></p>
<br>
<div class="moz-cite-prefix">On 08/19/2016 06:00 AM, Andrey Ryabinin
wrote:<br>
</div>
<blockquote
cite="mid:1471611621-6838-2-git-send-email-aryabinin@virtuozzo.com"
type="cite">
<pre wrap="">For encrypted ploop we will need to know what block_device was frozen
in ploop_freeze(), so we could thaw() it. We don't need to store super_block,
because we sould be able to get it from frozen block device.
<a class="moz-txt-link-freetext" href="https://jira.sw.ru/browse/PSBM-50858">https://jira.sw.ru/browse/PSBM-50858</a>
Signed-off-by: Andrey Ryabinin <a class="moz-txt-link-rfc2396E" href="mailto:aryabinin@virtuozzo.com"><aryabinin@virtuozzo.com></a>
---
drivers/block/ploop/dev.c | 13 +++++++------
include/linux/ploop/ploop.h | 2 +-
2 files changed, 8 insertions(+), 7 deletions(-)
diff --git a/drivers/block/ploop/dev.c b/drivers/block/ploop/dev.c
index 453d36e..8ed402f 100644
--- a/drivers/block/ploop/dev.c
+++ b/drivers/block/ploop/dev.c
@@ -4918,7 +4918,7 @@ static int ploop_push_backup_stop(struct ploop_device *plo, unsigned long arg)
static int ploop_freeze(struct ploop_device *plo, struct block_device *bdev)
{
-        struct super_block *sb = plo->sb;
+        struct super_block *sb;
        if (!test_bit(PLOOP_S_RUNNING, &plo->state))
                return -EINVAL;
@@ -4933,14 +4933,15 @@ static int ploop_freeze(struct ploop_device *plo, struct block_device *bdev)
        if (sb && IS_ERR(sb))
                return PTR_ERR(sb);
-        plo->sb = sb;
+        plo->frozen_bdev = bdev;
        plo->freeze_state = PLOOP_F_FROZEN;
        return 0;
}
-static int ploop_thaw(struct ploop_device *plo, struct block_device *bdev)
+static int ploop_thaw(struct ploop_device *plo)
{
-        struct super_block *sb = plo->sb;
+        struct block_device *bdev = plo->frozen_bdev;
+        struct super_block *sb = bdev->bd_super;
        int err;
        if (!test_bit(PLOOP_S_RUNNING, &plo->state))
@@ -4952,7 +4953,7 @@ static int ploop_thaw(struct ploop_device *plo, struct block_device *bdev)
        if (plo->freeze_state == PLOOP_F_THAWING)
                return -EBUSY;
-        plo->sb = NULL;
+        plo->frozen_bdev = NULL;
        plo->freeze_state = PLOOP_F_THAWING;
        mutex_unlock(&plo->ctl_mutex);
@@ -5086,7 +5087,7 @@ static int ploop_ioctl(struct block_device *bdev, fmode_t fmode, unsigned int cm
                err = ploop_freeze(plo, bdev);
                break;
        case PLOOP_IOC_THAW:
-                err = ploop_thaw(plo, bdev);
+                err = ploop_thaw(plo);
                break;
        default:
                err = -EINVAL;
diff --git a/include/linux/ploop/ploop.h b/include/linux/ploop/ploop.h
index b2ef6bd..8262a50 100644
--- a/include/linux/ploop/ploop.h
+++ b/include/linux/ploop/ploop.h
@@ -419,7 +419,7 @@ struct ploop_device
        struct block_device        *bdev;
        struct request_queue        *queue;
        struct task_struct        *thread;
-        struct super_block        *sb;
+        struct block_device        *frozen_bdev;
        int                        freeze_state;
        struct rb_node                link;
</pre>
</blockquote>
<br>
</body>
</html>