From patchwork Fri Mar 14 09:40:08 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shaohua Li X-Patchwork-Id: 3832141 X-Patchwork-Delegate: snitzer@redhat.com Return-Path: X-Original-To: patchwork-dm-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id A137C9F2BB for ; Fri, 14 Mar 2014 10:22:50 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id AD476202F8 for ; Fri, 14 Mar 2014 10:22:49 +0000 (UTC) Received: from mx3-phx2.redhat.com (mx3-phx2.redhat.com [209.132.183.24]) by mail.kernel.org (Postfix) with ESMTP id 7D4CF20204 for ; Fri, 14 Mar 2014 10:22:48 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by mx3-phx2.redhat.com (8.13.8/8.13.8) with ESMTP id s2EAGxff024076; Fri, 14 Mar 2014 06:17:00 -0400 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id s2EAGwRu023763 for ; Fri, 14 Mar 2014 06:16:58 -0400 Received: from mx1.redhat.com (ext-mx11.extmail.prod.ext.phx2.redhat.com [10.5.110.16]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id s2EAGvRq018467; Fri, 14 Mar 2014 06:16:58 -0400 Received: from mail-pb0-f42.google.com (mail-pb0-f42.google.com [209.85.160.42]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s2EAGtia017762; Fri, 14 Mar 2014 06:16:55 -0400 Received: by mail-pb0-f42.google.com with SMTP id rr13so2441474pbb.29 for ; Fri, 14 Mar 2014 03:16:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-type:content-disposition:in-reply-to:user-agent; bh=rw6pFl19Arydenacven5wZ6TZcrs8G6rq7Oyugpwg4Q=; b=Y2+p54Oiycw6lFPMtnUgCjUnNo2AZcU8MjqS1GwtmJGOlpap7Ush23bk6L/xelQVif dND8+S6eDMhwTNeFEaCQCjuFpMZO9p7diDSQYJQofmY98AMW1ZzgMNJhlpuXQAr6Hn+c H7Hg0ICBW+1YgYBMPOV0ZJtLogpPEw30VaRqXOunABZ4owaF2nTYdyP7RcQpC/tFZ6tp wQs5dnGTVtOKOPAfrCKInPKDtNiBj/1jtYiX/W5OAW9ukWDGsIdx3ho6ABRerfgZcl5d q7y2SLBpWsxCOFBD8HVdZpM6mYlleqnwhh5WnZA0V+/BSsKORqwKWPmfT6O/7w/fMwWx wfpQ== X-Received: by 10.68.11.199 with SMTP id s7mr8374987pbb.12.1394792215179; Fri, 14 Mar 2014 03:16:55 -0700 (PDT) Received: from shli-virt ([180.154.214.120]) by mx.google.com with ESMTPSA id hc4sm15147837pbc.29.2014.03.14.03.16.39 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 14 Mar 2014 03:16:53 -0700 (PDT) Date: Fri, 14 Mar 2014 17:40:08 +0800 From: Shaohua Li To: Mike Snitzer Message-ID: <20140314094008.GA2386@kernel.org> References: <20140218101304.GA24889@kernel.org> <20140307075733.GB21790@kernel.org> <20140310135256.GA28665@redhat.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20140310135256.GA28665@redhat.com> User-Agent: Mutt/1.5.21 (2010-09-15) X-RedHat-Spam-Score: -3 (BAYES_00, DCC_REPUT_00_12, DKIM_SIGNED, DKIM_VALID, FREEMAIL_FROM, RCVD_IN_DNSWL_LOW, SPF_PASS) X-Scanned-By: MIMEDefang 2.68 on 10.5.11.23 X-Scanned-By: MIMEDefang 2.68 on 10.5.110.16 X-loop: dm-devel@redhat.com Cc: axboe@kernel.dk, dm-devel@redhat.com, linux-kernel@vger.kernel.org, agk@redhat.com Subject: Re: [dm-devel] [patch v3]DM: dm-insitu-comp: a compressed DM target for SSD X-BeenThere: dm-devel@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk Reply-To: device-mapper development 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-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID,T_RP_MATCHES_RCVD,UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP On Mon, Mar 10, 2014 at 09:52:56AM -0400, Mike Snitzer wrote: > On Fri, Mar 07 2014 at 2:57am -0500, > Shaohua Li wrote: > > > ping! > > Hi, > > I intend to get dm-insitu-comp reviewed for 3.15. Sorry I haven't > gotten back with you before now, been busy tending to 3.14-rc issues. > > I took a quick first pass over your code a couple weeks ago. Looks to > be in great shape relative to coding conventions and the more DM > specific conventions. Clearly demonstrates you have a good command of > DM concepts and quirks. > > But one thing that would really help get dm-insitu-comp into 3.15 is to > show that the code is working as you'd expect. To that end, it'd be > great if you'd be willing to add dm-insitu-comp support to the > device-mapper-test-suite, see: > https://github.com/jthornber/device-mapper-test-suite > > I recently added barebones/simple dm-crypt support, see: > https://github.com/jthornber/device-mapper-test-suite/commit/c865bcd4e48228e18626d94327fb2485cf9ec9a1 > > But It may be that activation/test code for the other targets (e.g. thin > or cache) are more useful examples to follow for implemnting > dm-insitu-comp stack activation, see: > https://github.com/jthornber/device-mapper-test-suite/blob/master/lib/dmtest/pool-stack.rb > https://github.com/jthornber/device-mapper-test-suite/blob/master/lib/dmtest/cache_stack.rb > > All said, implementing dm-insitu-comp support for dmts (including some > tests that establish it is working as intended) isn't a hard requirement > for getting the target upstream but it would _really_ help. Ok, I added some simple tests in the test suites. Thanks, Shaohua --- dm-devel mailing list dm-devel@redhat.com https://www.redhat.com/mailman/listinfo/dm-devel --- lib/dmtest/suites/insitu-comp.rb | 1 lib/dmtest/tests/insitu-comp/insitu-comp_tests.rb | 120 ++++++++++++++++++++++ 2 files changed, 121 insertions(+) Index: device-mapper-test-suite/lib/dmtest/suites/insitu-comp.rb =================================================================== --- /dev/null 1970-01-01 00:00:00.000000000 +0000 +++ device-mapper-test-suite/lib/dmtest/suites/insitu-comp.rb 2014-03-14 17:16:14.043519177 +0800 @@ -0,0 +1 @@ +require 'dmtest/tests/insitu-comp/insitu-comp_tests' Index: device-mapper-test-suite/lib/dmtest/tests/insitu-comp/insitu-comp_tests.rb =================================================================== --- /dev/null 1970-01-01 00:00:00.000000000 +0000 +++ device-mapper-test-suite/lib/dmtest/tests/insitu-comp/insitu-comp_tests.rb 2014-03-14 17:16:14.043519177 +0800 @@ -0,0 +1,120 @@ +require 'dmtest/config' +require 'dmtest/git' +require 'dmtest/log' +require 'dmtest/utils' +require 'dmtest/fs' +require 'dmtest/tags' +require 'dmtest/thinp-test' +require 'dmtest/cache-status' +require 'dmtest/disk-units' +require 'dmtest/test-utils' +require 'dmtest/tests/cache/fio_subvolume_scenario' + +require 'pp' + +#------------------------------------------------------------ + +class InsitucompStack + include DM + include DM::LexicalOperators + include Utils + + def initialize(dm, dev, opts) + @dm = dm + @dev = dev + @opts = opts + end + + def activate(&block) + with_dev(table) do |comp| + @comp = comp + block.call(comp) + end + end + + def table + total_blocks = dev_size(@dev) >> 3 + data_blocks = total_blocks - 1 + rem = data_blocks % (4096 * 8 + 5) + data_blocks /= 4096 * 8 + 5 + meta_blocks = data_blocks * 5 + data_blocks *= 4096 * 8 + + cnt = rem + rem /= (4096 * 8 / 5 + 1) + data_blocks += rem * (4096 * 8 / 5) + meta_blocks += rem + + cnt %= (4096 * 8 / 5 + 1) + meta_blocks += 1 + data_blocks += cnt - 1 + + sector_count = data_blocks << 3 + + writethrough = @opts.fetch(:writethrough, true) + if writethrough + t = Table.new(Target.new('insitu_comp', sector_count, @dev, 'writethrough')) + else + wb_interval = @opts.fetch(:writeback_interval, 5) + t = Table.new(Target.new('insitu_comp', sector_count, @dev, 'writeback', wb_interval)) + end + t + end + + private + def dm_interface + @dm + end +end + +#------------------------------------------------------------ + +class InsitucompTests < ThinpTestCase + include Utils + include DiskUnits + include FioSubVolumeScenario + + def test_basic_setup_writethrough + test_basic_setup() + end + + def test_basic_setup_writeback + test_basic_setup(false, 5) + end + + def test_fio_writethrough + test_fio() + end + + def test_fio_writeback + test_fio(false, 5) + end + + private + def alloc_stack(writethrough, wbinterval) + if writethrough + stack = InsitucompStack.new(@dm, @data_dev, :writethrough => true) + else + stack = InsitucompStack.new(@dm, @data_dev, :writethrough => false, :writeback_interval => wbinterval) + end + stack + end + + private + def test_basic_setup(writethrough = true, wbinterval = 5) + stack = alloc_stack(writethrough, wbinterval) + stack.activate do |comp| + wipe_device(comp) + end + end + + private + def test_fio(writethrough = true, wbinterval = 5) + stack = alloc_stack(writethrough, wbinterval) + stack.activate do |comp| + do_fio(comp, :ext4, + :outfile => AP("fio_dm_insitu-comp" + (writethrough ? "-wt.out" : "-wb.out")), + :cfgfile => LP("tests/cache/database-funtime.fio")) + end + end +end