Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ZFS_IOC_RECV should only call zvol_create_minors() on zvols #2388

Closed
wants to merge 1 commit into from

Conversation

ryao
Copy link
Contributor

@ryao ryao commented Jun 11, 2014

Signed-off-by: Richard Yao ryao@gentoo.org

@behlendorf
Copy link
Contributor

Does this solve any particular issue? It should be harmless, although it might be somewhat expensive to call dmu_objset_find().

@behlendorf behlendorf added this to the 0.6.4 milestone Jun 11, 2014
@behlendorf behlendorf added the Bug label Jun 11, 2014
@ryao
Copy link
Contributor Author

ryao commented Jun 11, 2014

perf profiling revealed significant time spent in these functions on a system without zvols during a recv. I know of one company that is explicitly disabling this in their own builds because they found that it wastes CPU time. This is the intermediate approach.

@ryao
Copy link
Contributor Author

ryao commented Jul 2, 2014

@behlendorf I refreshed this with a proper commit message. I was juggling a few things at the time, so the lack of a commit message slipped by me.

@behlendorf
Copy link
Contributor

@ryao I'm all for optimizing this case but we should be doing it in the zvol_create_minors() function. There are multiple callers of this function and they would all benefit from this optimization. Also we need to handle this recursively so the patch as proposed isn't quite right.

My suggestion would be to adopt the FreeBSD code for this. They've already solved exactly this problem for presumably the same reason. Let's avoid doing our own thing if possible. It looks like we could almost use the zvol_create_snapshots and zvol_create_minors functions from FreeBSD verbatim.

@bprotopopov
Copy link
Contributor

There is a related pull request #2479 where zvol_create_minors() is optimized and is made aware of snapshots vs. zvols. In case of receive() creating snapshots, "tofs@tosnap" could be passed to zvol_create_minors() to avoid dmu_objset_find() and to _zvol_create_minor() for the snapshot directly if snapshots are visible (or do nothing if not visible).

@behlendorf
Copy link
Contributor

@bprotopopov What do you think about starting with the freebsd zvol_create_minors() which is already aware of snapshots and extending it to be aware of the snapdev property. This should address both #2479, this issue, and any other zvol_create_minors() callers. I'd feel better about merging a fix which basically syncs us up with freebsd which has similar zvol issues.

@bprotopopov
Copy link
Contributor

@behlendorf that sounds reasonable, let me take a quick look at the freebsd zvol_create_minors().

To be honest, I found that with 10s of thousands of snapshots and thousands of zvols, Linux udev sybsystem is stretched to the max. In extreme cases, I would say, the best thing is to avoid the device framework completely, and integrate block interface consumers with ZFS in a way similar to COMSTAR integration in Solaris.

For "medium scale", udev should be OK, and if one makes sure one does not scan datasets unnecessarily in dmu_objset_find(), one should be able to improve scalability significantly, as my testing has shown.

@bprotopopov
Copy link
Contributor

@behlendorf so I took a look at freebsd code at https://github.com/freebsd/freebsd/blob/master/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c (hope this is the right reference).

Generally, the code seems similar but a bit less streamlined :) then the zfs code for Linux. Seems like FreeBSD does not have a notion similar to the snapdev property, so they do not need to traverse snapshots of a zvol on change of the property value to create/destroy devices for the snapshots. This would be different for Linux where if zvol_create_minors() gets a name of a zvol, the function would need to go through the snaps, I believe, if snapdev == visible. So, the optimizations here are somewhat limited.

Essentially, the FreeBSD code does something very similar to what I did in the pull request, but it uses dmu_snapshot_list_next() instead of dmu_objset_find() to traverse snapshots of a zvol, which could be a good idea, I need to look a bit further.

FransUrbo pushed a commit to FransUrbo/zfs that referenced this pull request Aug 19, 2014
…e_minors() on zvols.

ZFS_IOC_RECV should only call zvol_create_minors() on zvols

perf profiling revealed significant time spent in these functions on a
system without zvols during a recv. I know of one company that is
explicitly disabling this in their own builds because they found that it
wastes CPU time. This is the intermediate approach.

Signed-off-by: Richard Yao <ryao@gentoo.org>
FransUrbo pushed a commit to FransUrbo/zfs that referenced this pull request Aug 21, 2014
…e_minors() on zvols.

ZFS_IOC_RECV should only call zvol_create_minors() on zvols

perf profiling revealed significant time spent in these functions on a
system without zvols during a recv. I know of one company that is
explicitly disabling this in their own builds because they found that it
wastes CPU time. This is the intermediate approach.

Signed-off-by: Richard Yao <ryao@gentoo.org>
FransUrbo pushed a commit to FransUrbo/zfs that referenced this pull request Aug 29, 2014
…e_minors() on zvols.

ZFS_IOC_RECV should only call zvol_create_minors() on zvols

perf profiling revealed significant time spent in these functions on a
system without zvols during a recv. I know of one company that is
explicitly disabling this in their own builds because they found that it
wastes CPU time. This is the intermediate approach.

Signed-off-by: Richard Yao <ryao@gentoo.org>
FransUrbo pushed a commit to FransUrbo/zfs that referenced this pull request Sep 5, 2014
…e_minors() on zvols.

ZFS_IOC_RECV should only call zvol_create_minors() on zvols

perf profiling revealed significant time spent in these functions on a
system without zvols during a recv. I know of one company that is
explicitly disabling this in their own builds because they found that it
wastes CPU time. This is the intermediate approach.

Signed-off-by: Richard Yao <ryao@gentoo.org>
FransUrbo pushed a commit to FransUrbo/zfs that referenced this pull request Sep 5, 2014
…e_minors() on zvols.

ZFS_IOC_RECV should only call zvol_create_minors() on zvols

perf profiling revealed significant time spent in these functions on a
system without zvols during a recv. I know of one company that is
explicitly disabling this in their own builds because they found that it
wastes CPU time. This is the intermediate approach.

Signed-off-by: Richard Yao <ryao@gentoo.org>
FransUrbo pushed a commit to FransUrbo/zfs that referenced this pull request Sep 5, 2014
…e_minors() on zvols.

ZFS_IOC_RECV should only call zvol_create_minors() on zvols

perf profiling revealed significant time spent in these functions on a
system without zvols during a recv. I know of one company that is
explicitly disabling this in their own builds because they found that it
wastes CPU time. This is the intermediate approach.

Signed-off-by: Richard Yao <ryao@gentoo.org>
FransUrbo pushed a commit to FransUrbo/zfs that referenced this pull request Sep 5, 2014
…e_minors() on zvols.

ZFS_IOC_RECV should only call zvol_create_minors() on zvols

perf profiling revealed significant time spent in these functions on a
system without zvols during a recv. I know of one company that is
explicitly disabling this in their own builds because they found that it
wastes CPU time. This is the intermediate approach.

Signed-off-by: Richard Yao <ryao@gentoo.org>
FransUrbo pushed a commit to FransUrbo/zfs that referenced this pull request Sep 7, 2014
…e_minors() on zvols.

ZFS_IOC_RECV should only call zvol_create_minors() on zvols

perf profiling revealed significant time spent in these functions on a
system without zvols during a recv. I know of one company that is
explicitly disabling this in their own builds because they found that it
wastes CPU time. This is the intermediate approach.

Signed-off-by: Richard Yao <ryao@gentoo.org>
FransUrbo pushed a commit to FransUrbo/zfs that referenced this pull request Sep 10, 2014
…e_minors() on zvols.

ZFS_IOC_RECV should only call zvol_create_minors() on zvols

perf profiling revealed significant time spent in these functions on a
system without zvols during a recv. I know of one company that is
explicitly disabling this in their own builds because they found that it
wastes CPU time. This is the intermediate approach.

Signed-off-by: Richard Yao <ryao@gentoo.org>
FransUrbo pushed a commit to FransUrbo/zfs that referenced this pull request Sep 14, 2014
…e_minors() on zvols.

ZFS_IOC_RECV should only call zvol_create_minors() on zvols

perf profiling revealed significant time spent in these functions on a
system without zvols during a recv. I know of one company that is
explicitly disabling this in their own builds because they found that it
wastes CPU time. This is the intermediate approach.

Signed-off-by: Richard Yao <ryao@gentoo.org>
@ryao
Copy link
Contributor Author

ryao commented Sep 22, 2014

@behlendorf This is a rather nice improvement, but the things that I can do on my own time are limited. I am running through outstanding pull requests in the issue tracker to flush them from my to do list, so I have opted to just move this into zvol_create_minors(). This change could be reverted in the future should someone have time to rebase it on the FreeBSD code.

@behlendorf
Copy link
Contributor

@ryao I'm not thrilled about this, it would be best to adopt the long term solution. But since we clearly don't have the time to devote to it I'm willing to live with this as a stop gap.

@ryao ryao force-pushed the recv branch 2 times, most recently from 9d51f15 to 0de11b3 Compare September 23, 2014 22:13
perf profiling revealed significant time spent in these functions on a
system without zvols during a recv. I know of one company that is
explicitly disabling this in their own builds because they found that it
wastes CPU time. This is the intermediate approach.

Signed-off-by: Richard Yao <ryao@gentoo.org>
@behlendorf behlendorf added Bug - Minor and removed Bug labels Feb 6, 2015
@behlendorf
Copy link
Contributor

@ryao Can you rebase this against master and repush it to get a fresh round of tests from the buildbot.

@behlendorf
Copy link
Contributor

This patch causes zconfig.sh test 3 to fail in the buildbot. Presumably this is caused by a zvol not being created when it should be.

1    persistent zpool.cache             Pass
2    scan disks for pools to import     Pass
3    zpool import/export device         Fail (7)

@behlendorf
Copy link
Contributor

Replaced by #3830

@behlendorf behlendorf closed this Jan 23, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Component: ZVOL ZFS Volumes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants