Hard-code ashift=12 patch

21 views
Skip to first unread message

Gordan Bobic

unread,
Feb 20, 2014, 7:53:29 AM2/20/14
to zfs-...@googlegroups.com
I _think_ this does that, but please review and treat with caution until somebody with more knowledge of ZFS internals says it's OK.

--- src/lib/libzpool/vdev_label.c.orig    2014-02-20 12:02:29.306170588 +0000
+++ src/lib/libzpool/vdev_label.c    2014-02-20 12:02:44.646155572 +0000
@@ -277,7 +277,7 @@
         VERIFY(nvlist_add_uint64(nv, ZPOOL_CONFIG_METASLAB_SHIFT,
             vd->vdev_ms_shift) == 0);
         VERIFY(nvlist_add_uint64(nv, ZPOOL_CONFIG_ASHIFT,
-            vd->vdev_ashift) == 0);
+            12) == 0);
         VERIFY(nvlist_add_uint64(nv, ZPOOL_CONFIG_ASIZE,
             vd->vdev_asize) == 0);
         VERIFY(nvlist_add_uint64(nv, ZPOOL_CONFIG_IS_LOG,

According to zdb to pool I created with this patch does show up as ashift=12.

Gordan

Emmanuel Anne

unread,
Feb 20, 2014, 1:12:35 PM2/20/14
to zfs-...@googlegroups.com
if it works it's ok.
I think the vdev init for ashift is in vdev_file_open line 136 of lib/libzpool/vdev_file.c:
        *ashift = SPA_MINBLOCKSHIFT;
that's probably here that ashift should normally be modified (default value here, it shouldn't prevent it from reading other pools with different ashift values).
Not tested of course.


--
--
To post to this group, send email to zfs-...@googlegroups.com
To visit our Web site, click on http://zfs-fuse.net/
---
You received this message because you are subscribed to the Google Groups "zfs-fuse" group.
To unsubscribe from this group and stop receiving emails from it, send an email to zfs-fuse+u...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Gordan Bobic

unread,
Feb 20, 2014, 7:46:19 PM2/20/14
to zfs-...@googlegroups.com
Hmm, that doesn't appear to have worked. zdb is still reporting the
ashift of the pool I created with the modified package to be 9.

I could shange the SPA_MINBLOCKSHIFT definition to 12, but I think that
would prevent zfs-fuse from importing an existing ashift=9 pool, would
it not?

Gordan

On 02/20/2014 06:12 PM, Emmanuel Anne wrote:
> if it works it's ok.
> I think the vdev init for ashift is in vdev_file_open line 136 of
> lib/libzpool/vdev_file.c:
> *ashift = SPA_MINBLOCKSHIFT;
> that's probably here that ashift should normally be modified (default
> value here, it shouldn't prevent it from reading other pools with
> different ashift values).
> Not tested of course.
>
>
> 2014-02-20 13:53 GMT+01:00 Gordan Bobic <gordan...@gmail.com
> <mailto:gordan...@gmail.com>>:
>
> I _think_ this does that, but please review and treat with caution
> until somebody with more knowledge of ZFS internals says it's OK.
>
> --- src/lib/libzpool/vdev_label.c.orig 2014-02-20
> 12:02:29.306170588 +0000
> +++ src/lib/libzpool/vdev_label.c 2014-02-20 12:02:44.646155572 +0000
> @@ -277,7 +277,7 @@
> VERIFY(nvlist_add_uint64(nv, ZPOOL_CONFIG_METASLAB_SHIFT,
> vd->vdev_ms_shift) == 0);
> VERIFY(nvlist_add_uint64(nv, ZPOOL_CONFIG_ASHIFT,
> - vd->vdev_ashift) == 0);
> + 12) == 0);
> VERIFY(nvlist_add_uint64(nv, ZPOOL_CONFIG_ASIZE,
> vd->vdev_asize) == 0);
> VERIFY(nvlist_add_uint64(nv, ZPOOL_CONFIG_IS_LOG,
>
> According to zdb to pool I created with this patch does show up as
> ashift=12.
>
> Gordan
>
> --
> --
> To post to this group, send email to zfs-...@googlegroups.com
> <mailto:zfs-...@googlegroups.com>
> To visit our Web site, click on http://zfs-fuse.net/
> ---
> You received this message because you are subscribed to the Google
> Groups "zfs-fuse" group.
> To unsubscribe from this group and stop receiving emails from it,
> send an email to zfs-fuse+u...@googlegroups.com
> <mailto:zfs-fuse%2Bunsu...@googlegroups.com>.

Gordan Bobic

unread,
Feb 20, 2014, 8:17:15 PM2/20/14
to zfs-...@googlegroups.com
Well that's embarrasing - the reason that hadn't worked was because I
was using the unpatched binaries rather than the new patches ones I just
build. *facepalm*

This mod does indeed work for making newly created pools ashift=12,
after which the same pool is importable with the unpatched zfs-fuse.

It looks good. :)

Gordan

On 02/20/2014 06:12 PM, Emmanuel Anne wrote:
> if it works it's ok.
> I think the vdev init for ashift is in vdev_file_open line 136 of
> lib/libzpool/vdev_file.c:
> *ashift = SPA_MINBLOCKSHIFT;
> that's probably here that ashift should normally be modified (default
> value here, it shouldn't prevent it from reading other pools with
> different ashift values).
> Not tested of course.
>
>
> 2014-02-20 13:53 GMT+01:00 Gordan Bobic <gordan...@gmail.com
> <mailto:gordan...@gmail.com>>:
>
> I _think_ this does that, but please review and treat with caution
> until somebody with more knowledge of ZFS internals says it's OK.
>
> --- src/lib/libzpool/vdev_label.c.orig 2014-02-20
> 12:02:29.306170588 +0000
> +++ src/lib/libzpool/vdev_label.c 2014-02-20 12:02:44.646155572 +0000
> @@ -277,7 +277,7 @@
> VERIFY(nvlist_add_uint64(nv, ZPOOL_CONFIG_METASLAB_SHIFT,
> vd->vdev_ms_shift) == 0);
> VERIFY(nvlist_add_uint64(nv, ZPOOL_CONFIG_ASHIFT,
> - vd->vdev_ashift) == 0);
> + 12) == 0);
> VERIFY(nvlist_add_uint64(nv, ZPOOL_CONFIG_ASIZE,
> vd->vdev_asize) == 0);
> VERIFY(nvlist_add_uint64(nv, ZPOOL_CONFIG_IS_LOG,
>
> According to zdb to pool I created with this patch does show up as
> ashift=12.
>
> Gordan
>
> --
> --
> To post to this group, send email to zfs-...@googlegroups.com
> <mailto:zfs-...@googlegroups.com>
> To visit our Web site, click on http://zfs-fuse.net/
> ---
> You received this message because you are subscribed to the Google
> Groups "zfs-fuse" group.
> To unsubscribe from this group and stop receiving emails from it,
> send an email to zfs-fuse+u...@googlegroups.com
> <mailto:zfs-fuse%2Bunsu...@googlegroups.com>.
Reply all
Reply to author
Forward
0 new messages