From patchwork Wed Jun 19 08:03:10 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Qu Wenruo X-Patchwork-Id: 11006023 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 987EC1932 for ; Thu, 20 Jun 2019 07:21:49 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8187B28521 for ; Thu, 20 Jun 2019 07:21:49 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7628D28538; Thu, 20 Jun 2019 07:21:49 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id E3E9628521 for ; Thu, 20 Jun 2019 07:21:48 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id B193E3003A49; Thu, 20 Jun 2019 07:21:47 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 560991001DC3; Thu, 20 Jun 2019 07:21:47 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id E2BA08E1F; Thu, 20 Jun 2019 07:21:44 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x5J83tYO006777 for ; Wed, 19 Jun 2019 04:03:56 -0400 Received: by smtp.corp.redhat.com (Postfix) id 0AEA05C225; Wed, 19 Jun 2019 08:03:55 +0000 (UTC) Delivered-To: dm-devel@redhat.com Received: from mx1.redhat.com (ext-mx17.extmail.prod.ext.phx2.redhat.com [10.5.110.46]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 064935C221 for ; Wed, 19 Jun 2019 08:03:52 +0000 (UTC) Received: from mx1.suse.de (mx2.suse.de [195.135.220.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 94C5B305D46D for ; Wed, 19 Jun 2019 08:03:19 +0000 (UTC) X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 29E8EAF55; Wed, 19 Jun 2019 08:03:18 +0000 (UTC) From: Qu Wenruo To: dm-devel@redhat.com Date: Wed, 19 Jun 2019 16:03:10 +0800 Message-Id: <20190619080312.11549-1-wqu@suse.com> MIME-Version: 1.0 X-Greylist: Sender passed SPF test, Sender IP whitelisted by DNSRBL, ACL 216 matched, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.46]); Wed, 19 Jun 2019 08:03:37 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.46]); Wed, 19 Jun 2019 08:03:37 +0000 (UTC) for IP:'195.135.220.15' DOMAIN:'mx2.suse.de' HELO:'mx1.suse.de' FROM:'wqu@suse.com' RCPT:'' X-RedHat-Spam-Score: -2.298 (RCVD_IN_DNSWL_MED, SPF_HELO_NONE, SPF_NONE) 195.135.220.15 mx2.suse.de 195.135.220.15 mx2.suse.de X-Scanned-By: MIMEDefang 2.84 on 10.5.110.46 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: dm-devel@redhat.com X-Mailman-Approved-At: Thu, 20 Jun 2019 03:21:43 -0400 Cc: linux-btrfs@vger.kernel.org Subject: [dm-devel] [PATCH 0/2] dm log writes: Add support for filter bios based on its type X-BeenThere: dm-devel@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: device-mapper development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: dm-devel-bounces@redhat.com Errors-To: dm-devel-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.42]); Thu, 20 Jun 2019 07:21:48 +0000 (UTC) X-Virus-Scanned: ClamAV using ClamSMTP Current dm-log-writes will record all bios, no matter if the bios is METADATA (normally what we care) or is DATA (normally we cares less for the log-replay context). This causes a lot of extra space required for log device. E.g write 10M, sync, overwrite that 10M file, this would cause over 20M for log device just for the data. This patchset introduces two way to specify the dump type: - dump_type=%s optional option for constructor The default dump_type is ALL, thus no behavior change. - dump_type=%s message type to change type on the fly Also to cooperate the new dump_type= option, always output the dump_type for STATUSTYPE_TABLE. A common use case would be: # dmsetup create log --table 0 $(blockdev --getsz $dev) log-writes $dev $log_dev # mkfs.btrfs -f /dev/mapper/log # dmsetup suspend log # dmsetup message log 0 dump_type=METADATA|FUA|FLUSH|DISCARD|MARK # dmsetup resume log # mount /dev/mapper/log # # umount # dmsetup remove log # Now the log device will not record data writes, thus hugely reduce the space requirement for log device, allowing more operations to be down before hitting the space limit. Currently btrfs check doesn't check data checksum by default, thus even we have wrong data on-disk, we should be fine checking the metadata. I'm not 100% sure if this applies to other filesystems, but as long as metadata writes is marked correctly, other filesystems can also benifit from this feature. Qu Wenruo (2): dm log writes: Allow dm-log-writes to filter bios based on types to reduce log device space usage dm log writes: Introduce dump_type= message type to change dump_type on the fly drivers/md/dm-log-writes.c | 177 ++++++++++++++++++++++++++++++++++--- 1 file changed, 167 insertions(+), 10 deletions(-)