<html>
  <head>
    <meta content="text/html; charset=windows-1252"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    On 2014/9/26 18:33, Heinz Mauelshagen wrote:<br>
    <blockquote cite="mid:54254116.5090908@redhat.com" type="cite">
      <meta content="text/html; charset=windows-1252"
        http-equiv="Content-Type">
      <br>
      Romu,<br>
      <br>
      did you initialize the metadata device before trying to create the
      era target?<br>
      Zeroes in the first KBs will do.<br>
    </blockquote>
    <br>
    Thanks Heinz, it solved the problem.  Is it the proper way to
    initialize the metadata device of an era target or just a
    workaround?<br>
    <br>
    Thanks<br>
    Romu<br>
    <br>
    <blockquote cite="mid:54254116.5090908@redhat.com" type="cite"> Yes,
      check for NULL in era_destroy is needed to  handle the error path
      you hit properly.<br>
      <br>
      Heinz<br>
      <br>
      <div class="moz-cite-prefix">On 09/26/2014 05:16 AM, Romu Hu
        wrote:<br>
      </div>
      <blockquote cite="mid:5424DA99.2070308@gmail.com" type="cite">
        <meta content="text/html; charset=windows-1252"
          http-equiv="Content-Type">
        On 2014/9/25 22:57, Heinz Mauelshagen wrote:<br>
        <blockquote cite="mid:54242D6D.4090004@redhat.com" type="cite">
          <meta content="text/html; charset=windows-1252"
            http-equiv="Content-Type">
          Romu,<br>
          <br>
          "dmsetup create MyEra --table "0 20971520 /dev/mapper/mpathbp1
          /dev/mapper/mpathap1 8"<br>
          <br>
          should read<br>
          <br>
          dmsetup create MyEra --table "0 20971520 era
          /dev/mapper/mpathbp1 /dev/mapper/mpathap1 8"<br>
        </blockquote>
        <br>
        Sorry my bad.<br>
        <br>
        I ran 'dmsetup create MyEra --table "0 20971520 era
        /dev/mapper/mpathbp1 /dev/mapper/mpathap1 8"' but kernel
        (2.6.32-494.el6.i686) oopsed:<br>
        <br>
        <tt>Sep 25 18:34:11 localhost kernel: device-mapper: era:
          sb_check failed: magic 0: wanted 2126579579</tt><tt><br>
        </tt><tt>Sep 25 18:34:11 localhost kernel: device-mapper: block
          manager: superblock validator check failed for block 0</tt><tt><br>
        </tt><tt>Sep 25 18:34:11 localhost kernel: device-mapper: era:
          couldn't read_lock superblock</tt><tt><br>
        </tt><tt>Sep 25 18:34:11 localhost kernel: BUG: unable to handle
          kernel NULL pointer dereference at 00000008</tt><tt><br>
        </tt><tt>Sep 25 18:34:11 localhost kernel: IP:
          [<f7e2b3c7>] era_destroy+0x7/0x60 [dm_era]Sep 25
          18:34:11 localhost kernel: *pdpt = 0000000032457001 *pde =
          00000003fb5fa067</tt><tt><br>
        </tt><tt>Sep 25 18:34:11 localhost kernel: Oops: 0000 [#1] SMP</tt><tt><br>
        </tt><tt>Sep 25 18:34:11 localhost kernel: last sysfs file:
          /sys/module/dm_persistent_data/initstate</tt><br>
        <br>
        Perhaps this should be cherry-picked?<br>
        <a moz-do-not-send="true" class="moz-txt-link-freetext"
href="https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=989f26f5ad308f40a95f280bf9cd75e558d4f18d">https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=989f26f5ad308f40a95f280bf9cd75e558d4f18d</a><br>
        <br>
        The log says sb_check failed, anything wrong with the dmsetup
        command parameters?<br>
        <br>
        Thanks<br>
        Romu<br>
        <br>
        <blockquote cite="mid:54242D6D.4090004@redhat.com" type="cite">
          <div class="moz-cite-prefix">On 09/25/2014 04:02 PM, Romu
            wrote:<br>
          </div>
          <blockquote
cite="mid:CANoG8sWXjR5LmZvY2K1ebOr=kS+A=-EPveqh=XsqD0v6bWcc2g@mail.gmail.com"
            type="cite">
            <div dir="ltr">
              <div class="gmail_extra">
                <div class="gmail_quote">2014-09-25 18:19 GMT+08:00
                  Heinz Mauelshagen <span dir="ltr"><<a
                      moz-do-not-send="true"
                      href="mailto:heinzm@redhat.com" target="_blank">heinzm@redhat.com</a>></span>:<br>
                  <blockquote class="gmail_quote" style="margin:0px 0px
                    0px
0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
                    <div bgcolor="#FFFFFF" text="#000000"><span class="">
                        On 09/25/2014 08:10 AM, Romu Hu wrote:<br>
                        <blockquote type="cite"> On 2014/9/24 12:10,
                          Brassow Jonathan wrote:<br>
                          <blockquote type="cite">On Sep 22, 2014, at
                            7:35 AM, Romu wrote:
                            <div><br>
                              <blockquote type="cite"><span
style="border-collapse:separate;font-family:Helvetica;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal;text-align:-webkit-auto;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;font-size:medium">I
                                  tried the following command to set up
                                  my era target but the command
                                  immediately panics the system and the
                                  system reboots.
                                  <div><br>
                                  </div>
                                  <div># dmsetup create MyEra --table "0
                                    41941903 era
                                    /dev/mapper/VG-CacheDataLV_cmeta
                                    /dev/mapper/VG-OriginLV 4096"<br>
                                  </div>
                                  <div><br>
                                  </div>
                                  <div>The metadata dev and the origin
                                    dev are all part of a LVM cache LV. 
                                    VG-CacheDataLV_cmeta is the cache
                                    metadata LV on the smaller and
                                    faster device, VG-OriginLV is the
                                    origin LV on the faster and slower
                                    device, 41941903 is the total sector
                                    number of the device of OriginLV
                                    (the LV takes 100% space of the
                                    device), 4096 is the block size of
                                    OriginLV, I have run 'mkfs.ext4
                                    /dev/mapper/VG-OriginLV' before
                                    running the dmsetup command.<br>
                                  </div>
                                  <div><br>
                                  </div>
                                  <div>Below is the message in
                                    /var/log/messages after running the
                                    dmsetup comnmand:</div>
                                  <div><br>
                                  </div>
                                  <div>kernel: device-mapper: era:
                                    sb_check failed: magic 1623043:
                                    wanted <a moz-do-not-send="true"
                                      href="tel:2126579579"
                                      value="+12126579579"
                                      target="_blank">2126579579</a><br>
                                  </div>
                                  <div>
                                    <div>kernel: device-mapper: block
                                      manager: superblock validator
                                      check failed for block 0</div>
                                    <div>kernel: device-mapper: era:
                                      couldn't read_lock superblock</div>
                                  </div>
                                  <div><br>
                                  </div>
                                  <div><br>
                                  </div>
                                  <div>Any idea?</div>
                                </span><br>
                              </blockquote>
                            </div>
                            <br>
                            <div>Sorry, I haven't used dm-era yet. 
                              However, it does appear that you are
                              perhaps specifying the wrong devices when
                              creating the era device?  Looks like you
                              might be allowing the era target and the
                              cache target to use the same metadata area
                              at the same time - causing them to corrupt
                              each other's metadata area?</div>
                            <div><br>
                            </div>
                            <div> brassow</div>
                          </blockquote>
                          <br>
                          I think the dmsetup command to set up an era
                          target should be something like this:<br>
                          <br>
                          <tt><span
style="border-collapse:separate;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;font-size:medium">#
                              dmsetup create MyEra --table "0
                              sector_number era metadeta_dev origin_dev
                              block_size"</span></tt><br>
                          <br>
                          My questions:<br>
                          <br>
                          1) How to calculate sector_number?  According
                          to <a moz-do-not-send="true"
                            href="https://www.kernel.org/doc/Documentation/device-mapper/era.txt"
                            target="_blank">https://www.kernel.org/doc/Documentation/device-mapper/era.txt</a>,
                          I guess it should be (4 * nr_blocks) bytes +
                          buffers, but what is nr_blocks and what is
                          buffers?<br>
                        </blockquote>
                        <br>
                      </span> No calculation: it's the size of your era
                      target in sectors. Typically "blockdev --getsz
                      origin_dev"<span class=""><br>
                        <br>
                        <blockquote type="cite"> 2) Any documentation
                          for dmsetup tables?<br>
                        </blockquote>
                        <br>
                      </span> Look for examples in the kernel source
                      trees Documentaion/device.mapper.<br>
                      <br>
                      table line syntax is: "start_sector
                      length_in_sectors <target>
                      <target_arguments{0,N}>"<span class=""><br>
                        <br>
                        <blockquote type="cite"> 3) Both my metadata_dev
                          and origin_dev are 10G partitions, is this all
                          right?<br>
                        </blockquote>
                        <br>
                      </span> Metadata device size is plenty but that
                      depends on how many eras with how many updates you
                      want to have.<span class=""><br>
                        <br>
                        <blockquote type="cite"> 4) My origin_dev is a
                          ext4 filesystem with a block size of 4096, so
                          the block_size in the command line should also
                          be 4096?<br>
                        </blockquote>
                        <br>
                      </span> You may use 4096 = _8_ sectors, you used
                      4096 sectors = 2MB below.<br>
                      It's the granularity the era target housekeeps
                      blocks for.<span class=""><br>
                        <br>
                        <blockquote type="cite"> <br>
                          I tried the following command:<br>
                          <br>
                          <tt># dmsetup create MyEra --table "0 160000
                            era /dev/mapper/mpathap1
                            /dev/mapper/mpathbp1 4096"</tt><br>
                        </blockquote>
                        <br>
                      </span> May not be  same physical device for data
                      and metadata!<br>
                      If it is, thta'd explain your oops.<br>
                      <br>
                      <tt># dmsetup create MyEra --table "0 $(blockdev
                        --getsz </tt><tt><tt>/dev/mapper/mpathbp)</tt>
                        era whatever_disctinct_metadata_device
                        /dev/mapper/mpathbp1 8"</tt><br>
                      <br>
                      Would use 8 sector block size (which is tiny!)
                      with disctinct metadata and data devices
                      (presumabyl your ext4 sits on <tt>/dev/mapper/mpathbp1)</tt><span
                        class=""><font color="#888888"><br>
                          <br>
                          Heinz<br>
                        </font></span></div>
                  </blockquote>
                  <div><br>
                  </div>
                  <div>Heinz, thank you for your help!</div>
                  <div><br>
                  </div>
                  <div>My origin dev is 10G so total sector number
                    is 20971520.  /dev/mapper/mpathbp1 (/dev/dm-6) is
                    the metadata dev, /dev/mapper/mpathap1 (/dev/dm-7)
                    is the origin dev, they are on different LUNs.</div>
                  <div><br>
                  </div>
                  <div>I tried the following commands:</div>
                  <div><br>
                  </div>
                  <div># dmsetup create MyEra --table "0 20971520
                    /dev/mapper/mpathbp1 /dev/mapper/mpathap1 8"<br>
                  </div>
                  <div># Target type name /dev/mapper/mpathbp1 is too
                    long.</div>
                  <div>
                    <div># Command failed</div>
                  </div>
                  <div><br>
                  </div>
                  <div># dmsetup create MyEra --table "0 20971520
                    /dev/dm-6 /dev/dm-7 8"<br>
                  </div>
                  <div># device-mapper: reload ioctl on MyEra failed:
                    Invalid argument</div>
                  <div>
                    <div># Command failed</div>
                  </div>
                  <div><br>
                  </div>
                  <div>And when executing the second command I see the
                    following in /var/log/messages:</div>
                  <div><br>
                  </div>
                  <div>
                    <div>Sep 25 06:37:48 localhost kernel:
                      device-mapper: table: 253:8: /dev/dm-6: unknown
                      target type</div>
                    <div>Sep 25 06:37:48 localhost kernel:
                      device-mapper: ioctl: error adding target to table</div>
                    <div>Sep 25 06:37:48 localhost multipathd: dm-8:
                      remove map (uevent)</div>
                    <div>Sep 25 06:37:48 localhost multipathd: dm-8:
                      devmap not registered, can't remove</div>
                    <div>Sep 25 06:37:48 localhost multipathd: dm-8:
                      remove map (uevent)</div>
                    <div>Sep 25 06:37:48 localhost multipathd: dm-8:
                      devmap not registered, can't remove</div>
                  </div>
                  <div><br>
                  </div>
                  <div>Then I run 'mkfs.ext4 /dev/dm-6' and tried the
                    second command again but got the same result.</div>
                  <div><br>
                  </div>
                  <div>Any idea?</div>
                  <div><br>
                  </div>
                  <div>Thanks</div>
                  <div>Romu</div>
                </div>
              </div>
            </div>
            <br>
            <fieldset class="mimeAttachmentHeader"></fieldset>
            <br>
            <pre wrap="">--
dm-devel mailing list
<a moz-do-not-send="true" class="moz-txt-link-abbreviated" href="mailto:dm-devel@redhat.com">dm-devel@redhat.com</a>
<a moz-do-not-send="true" class="moz-txt-link-freetext" href="https://www.redhat.com/mailman/listinfo/dm-devel">https://www.redhat.com/mailman/listinfo/dm-devel</a></pre>
          </blockquote>
          <br>
          <br>
          <fieldset class="mimeAttachmentHeader"></fieldset>
          <br>
          <pre wrap="">--
dm-devel mailing list
<a moz-do-not-send="true" class="moz-txt-link-abbreviated" href="mailto:dm-devel@redhat.com">dm-devel@redhat.com</a>
<a moz-do-not-send="true" class="moz-txt-link-freetext" href="https://www.redhat.com/mailman/listinfo/dm-devel">https://www.redhat.com/mailman/listinfo/dm-devel</a></pre>
        </blockquote>
        <br>
        <br>
        <fieldset class="mimeAttachmentHeader"></fieldset>
        <br>
        <pre wrap="">--
dm-devel mailing list
<a moz-do-not-send="true" class="moz-txt-link-abbreviated" href="mailto:dm-devel@redhat.com">dm-devel@redhat.com</a>
<a moz-do-not-send="true" class="moz-txt-link-freetext" href="https://www.redhat.com/mailman/listinfo/dm-devel">https://www.redhat.com/mailman/listinfo/dm-devel</a></pre>
      </blockquote>
      <br>
      <pre class="moz-signature" cols="72">-- 
===============================================================
Heinz Mauelshagen                               +49 2626 141200
Consulting Development Engineer             FAX +49 2626 924446
Red Hat GmbH
Am Sonnenhang 11
56242 Marienrachdorf
Germany                                       <a moz-do-not-send="true" class="moz-txt-link-abbreviated" href="mailto:heinzm@redhat.com">heinzm@redhat.com</a>
===============================================================</pre>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <br>
      <pre wrap="">--
dm-devel mailing list
<a class="moz-txt-link-abbreviated" href="mailto:dm-devel@redhat.com">dm-devel@redhat.com</a>
<a class="moz-txt-link-freetext" href="https://www.redhat.com/mailman/listinfo/dm-devel">https://www.redhat.com/mailman/listinfo/dm-devel</a></pre>
    </blockquote>
    <br>
  </body>
</html>