~ubuntu-branches/ubuntu/quantal/zfs-fuse/quantal

« back to all changes in this revision

Viewing changes to src/lib/libzpool/dmu_object.c

  • Committer: Bazaar Package Importer
  • Author(s): Mike Hommey, Mike Hommey, Seth Heeren
  • Date: 2010-06-30 18:03:52 UTC
  • mfrom: (1.1.3 upstream)
  • Revision ID: james.westby@ubuntu.com-20100630180352-d3jq25ytbcl23q3y
Tags: 0.6.9-1
* New upstream release.

[ Mike Hommey ]
* debian/control:
  - Build depend on libssl-dev and libattr1-dev, now required to build.
  - Build depend on docbook-xml to avoid xsltproc I/O error loading
    docbook DTD.
  - Add suggestions for a NFS server and kpartx.
* debian/man/*, debian/copyright, debian/rules: Remove manual pages, they
  are now shipped upstream.
* debian/copyright: Change download link.
* src/SConstruct:
  - Add an optim option to the build system.
  - Add support for DESTDIR.
  - Force debug=1 to mean optim, no strip, no debug.
  - Use -ffunction-sections, -fdata-sections, and --gc-sections flags to
    reduce the binary sizes.
* src/lib/libumem/SConscript: Cleanup src/lib/libumem when cleaning up
  build directory.
* src/cmd/*/SConscript: Don't link zfs, zpool and zdb against libssl.
* src/lib/libumem/SConscript: Only build static libumem.
* src/lib/libumem/sol_compat.h:
  - Add atomic cas support for sparc.
  - Use atomic functions from libsolcompat in libumem on unsupported
    platforms.
* debian/rules:
  - Set optimization level in build system according to DEB_BUILD_OPTIONS.
  - Build with debug=1 to have unstripped binaries ; dh_strip will do the
    right thing.
  - Don't depend on the local location of the docbook XSLT stylesheets.
    Use the catalogged url in place of the full path.
  - Don't clean src/.sconsign.dblite and src/path.pyc.
  - Set all destination directories when installing with scons.
  - Install bash completion and zfsrc files.
  - Don't use scons cache when building.
* debian/prerm: Remove /var/lib/zfs/zpool.cache in prerm.
* debian/dirs: Create /etc/bash_completion.d.
* debian/watch: Fix watch file.
* debian/rules, debian/control, debian/compat: Switch to dh.
* debian/README.Debian: Update README.Debian.
* debian/zfs-fuse.man.xml: Update zfs-fuse manual page.
* debian/zfs-fuse.init: Start sharing datasets marked as such at daemon
  startup.
* debian/rules, debian/control: Use config.guess and config.sub from
  autotools-dev.

[ Seth Heeren ]
* debian/zfs-fuse.man.xml:
  Added notes on the precedence, zfsrc, commandline, initscript vs.
  /etc/default/zfs-fuse on some systems.
* debian/zfs-fuse.init, debian/zfs-fuse.default: Deprecating DAEMON_OPTS.
* debian/zfs-fuse.init:
  - Removing import -a -f.
  - Removing the now unnecessary 'sleep 2'.
  - Extended shutdown wait to allow for zfs-fuse daemon's own shutdown
    timeouts.
  - Re-ordered dubious PATH setting.
* debian/zfs-fuse.init: Move existing zpool.cache to new location if
  possible.

Show diffs side-by-side

added added

removed removed

Lines of Context:
32
32
dmu_object_alloc(objset_t *os, dmu_object_type_t ot, int blocksize,
33
33
    dmu_object_type_t bonustype, int bonuslen, dmu_tx_t *tx)
34
34
{
35
 
        objset_impl_t *osi = os->os;
36
35
        uint64_t object;
37
36
        uint64_t L2_dnode_count = DNODES_PER_BLOCK <<
38
 
            (osi->os_meta_dnode->dn_indblkshift - SPA_BLKPTRSHIFT);
 
37
            (os->os_meta_dnode->dn_indblkshift - SPA_BLKPTRSHIFT);
39
38
        dnode_t *dn = NULL;
40
39
        int restarted = B_FALSE;
41
40
 
42
 
        mutex_enter(&osi->os_obj_lock);
 
41
        mutex_enter(&os->os_obj_lock);
43
42
        for (;;) {
44
 
                object = osi->os_obj_next;
 
43
                object = os->os_obj_next;
45
44
                /*
46
45
                 * Each time we polish off an L2 bp worth of dnodes
47
46
                 * (2^13 objects), move to another L2 bp that's still
51
50
                 */
52
51
                if (P2PHASE(object, L2_dnode_count) == 0) {
53
52
                        uint64_t offset = restarted ? object << DNODE_SHIFT : 0;
54
 
                        int error = dnode_next_offset(osi->os_meta_dnode,
 
53
                        int error = dnode_next_offset(os->os_meta_dnode,
55
54
                            DNODE_FIND_HOLE,
56
55
                            &offset, 2, DNODES_PER_BLOCK >> 2, 0);
57
56
                        restarted = B_TRUE;
58
57
                        if (error == 0)
59
58
                                object = offset >> DNODE_SHIFT;
60
59
                }
61
 
                osi->os_obj_next = ++object;
 
60
                os->os_obj_next = ++object;
62
61
 
63
62
                /*
64
63
                 * XXX We should check for an i/o error here and return
66
65
                 * dmu_tx_assign(), but there is currently no mechanism
67
66
                 * to do so.
68
67
                 */
69
 
                (void) dnode_hold_impl(os->os, object, DNODE_MUST_BE_FREE,
 
68
                (void) dnode_hold_impl(os, object, DNODE_MUST_BE_FREE,
70
69
                    FTAG, &dn);
71
70
                if (dn)
72
71
                        break;
73
72
 
74
73
                if (dmu_object_next(os, &object, B_TRUE, 0) == 0)
75
 
                        osi->os_obj_next = object - 1;
 
74
                        os->os_obj_next = object - 1;
76
75
        }
77
76
 
78
77
        dnode_allocate(dn, ot, blocksize, 0, bonustype, bonuslen, tx);
79
78
        dnode_rele(dn, FTAG);
80
79
 
81
 
        mutex_exit(&osi->os_obj_lock);
 
80
        mutex_exit(&os->os_obj_lock);
82
81
 
83
82
        dmu_tx_add_new_object(tx, os, object);
84
83
        return (object);
94
93
        if (object == DMU_META_DNODE_OBJECT && !dmu_tx_private_ok(tx))
95
94
                return (EBADF);
96
95
 
97
 
        err = dnode_hold_impl(os->os, object, DNODE_MUST_BE_FREE, FTAG, &dn);
 
96
        err = dnode_hold_impl(os, object, DNODE_MUST_BE_FREE, FTAG, &dn);
98
97
        if (err)
99
98
                return (err);
100
99
        dnode_allocate(dn, ot, blocksize, 0, bonustype, bonuslen, tx);
116
115
        if (object == DMU_META_DNODE_OBJECT)
117
116
                return (EBADF);
118
117
 
119
 
        err = dnode_hold_impl(os->os, object, DNODE_MUST_BE_ALLOCATED,
 
118
        err = dnode_hold_impl(os, object, DNODE_MUST_BE_ALLOCATED,
120
119
            FTAG, &dn);
121
120
        if (err)
122
121
                return (err);
166
165
 
167
166
        ASSERT(object != DMU_META_DNODE_OBJECT || dmu_tx_private_ok(tx));
168
167
 
169
 
        err = dnode_hold_impl(os->os, object, DNODE_MUST_BE_ALLOCATED,
 
168
        err = dnode_hold_impl(os, object, DNODE_MUST_BE_ALLOCATED,
170
169
            FTAG, &dn);
171
170
        if (err)
172
171
                return (err);
185
184
        uint64_t offset = (*objectp + 1) << DNODE_SHIFT;
186
185
        int error;
187
186
 
188
 
        error = dnode_next_offset(os->os->os_meta_dnode,
 
187
        error = dnode_next_offset(os->os_meta_dnode,
189
188
            (hole ? DNODE_FIND_HOLE : 0), &offset, 0, DNODES_PER_BLOCK, txg);
190
189
 
191
190
        *objectp = offset >> DNODE_SHIFT;