From patchwork Mon Apr 20 18:36:43 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrey Shinkevich X-Patchwork-Id: 11499643 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id D61C592C for ; Mon, 20 Apr 2020 18:38:41 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id B660220724 for ; Mon, 20 Apr 2020 18:38:41 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org B660220724 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=virtuozzo.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:40654 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jQbJY-0003jN-Tz for patchwork-qemu-devel@patchwork.kernel.org; Mon, 20 Apr 2020 14:38:40 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:44860 helo=eggs1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jQbI4-000118-9G for qemu-devel@nongnu.org; Mon, 20 Apr 2020 14:37:09 -0400 Received: from Debian-exim by eggs1p.gnu.org with spam-scanned (Exim 4.90_1) (envelope-from ) id 1jQbI0-0003yW-SE for qemu-devel@nongnu.org; Mon, 20 Apr 2020 14:37:08 -0400 Received: from relay.sw.ru ([185.231.240.75]:39812) by eggs1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jQbHs-0003NI-R3; Mon, 20 Apr 2020 14:36:56 -0400 Received: from dhcp-172-16-25-136.sw.ru ([172.16.25.136] helo=localhost.sw.ru) by relay.sw.ru with esmtp (Exim 4.92.3) (envelope-from ) id 1jQbHj-0001xO-GL; Mon, 20 Apr 2020 21:36:47 +0300 From: Andrey Shinkevich To: qemu-block@nongnu.org Subject: [PATCH 4/7] copy-on-read: Support refreshing filename Date: Mon, 20 Apr 2020 21:36:43 +0300 Message-Id: <1587407806-109784-5-git-send-email-andrey.shinkevich@virtuozzo.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1587407806-109784-1-git-send-email-andrey.shinkevich@virtuozzo.com> References: <1587407806-109784-1-git-send-email-andrey.shinkevich@virtuozzo.com> Received-SPF: pass client-ip=185.231.240.75; envelope-from=andrey.shinkevich@virtuozzo.com; helo=relay.sw.ru X-detected-operating-system: by eggs1p.gnu.org: First seen = 2020/04/20 14:36:51 X-ACL-Warn: Detected OS = Linux 3.1-3.10 [fuzzy] X-Received-From: 185.231.240.75 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kwolf@redhat.com, vsementsov@virtuozzo.com, armbru@redhat.com, qemu-devel@nongnu.org, andrey.shinkevich@virtuozzo.com, den@openvz.org, mreitz@redhat.com, jsnow@redhat.com, dgilbert@redhat.com Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" Signed-off-by: Andrey Shinkevich --- block/copy-on-read.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/block/copy-on-read.c b/block/copy-on-read.c index ad6577d..e45eab9 100644 --- a/block/copy-on-read.c +++ b/block/copy-on-read.c @@ -21,6 +21,7 @@ */ #include "qemu/osdep.h" +#include "qemu/cutils.h" #include "block/block_int.h" #include "qemu/module.h" @@ -141,6 +142,11 @@ static bool cor_recurse_is_first_non_filter(BlockDriverState *bs, return bdrv_recurse_is_first_non_filter(bs->file->bs, candidate); } +static void cor_refresh_filename(BlockDriverState *bs) +{ + pstrcpy(bs->exact_filename, sizeof(bs->exact_filename), + bs->file->bs->filename); +} static BlockDriver bdrv_copy_on_read = { .format_name = "copy-on-read", @@ -161,6 +167,7 @@ static BlockDriver bdrv_copy_on_read = { .bdrv_lock_medium = cor_lock_medium, .bdrv_recurse_is_first_non_filter = cor_recurse_is_first_non_filter, + .bdrv_refresh_filename = cor_refresh_filename, .has_variable_length = true, .is_filter = true,