Deleted Added
full compact
dmu.c (307266) dmu.c (307292)
1/*
2 * CDDL HEADER START
3 *
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
7 *
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE

--- 117 unchanged lines hidden (view full) ---

126 { dnode_buf_byteswap, "dnode" },
127 { dmu_objset_byteswap, "objset" },
128 { zfs_znode_byteswap, "znode" },
129 { zfs_oldacl_byteswap, "oldacl" },
130 { zfs_acl_byteswap, "acl" }
131};
132
133int
1/*
2 * CDDL HEADER START
3 *
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
7 *
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE

--- 117 unchanged lines hidden (view full) ---

126 { dnode_buf_byteswap, "dnode" },
127 { dmu_objset_byteswap, "objset" },
128 { zfs_znode_byteswap, "znode" },
129 { zfs_oldacl_byteswap, "oldacl" },
130 { zfs_acl_byteswap, "acl" }
131};
132
133int
134dmu_buf_hold_noread_by_dnode(dnode_t *dn, uint64_t offset,
135 void *tag, dmu_buf_t **dbp)
136{
137 uint64_t blkid;
138 dmu_buf_impl_t *db;
139
140 blkid = dbuf_whichblock(dn, 0, offset);
141 rw_enter(&dn->dn_struct_rwlock, RW_READER);
142 db = dbuf_hold(dn, blkid, tag);
143 rw_exit(&dn->dn_struct_rwlock);
144
145 if (db == NULL) {
146 *dbp = NULL;
147 return (SET_ERROR(EIO));
148 }
149
150 *dbp = &db->db;
151 return (0);
152}
153int
134dmu_buf_hold_noread(objset_t *os, uint64_t object, uint64_t offset,
135 void *tag, dmu_buf_t **dbp)
136{
137 dnode_t *dn;
138 uint64_t blkid;
139 dmu_buf_impl_t *db;
140 int err;
141

--- 11 unchanged lines hidden (view full) ---

153 return (SET_ERROR(EIO));
154 }
155
156 *dbp = &db->db;
157 return (err);
158}
159
160int
154dmu_buf_hold_noread(objset_t *os, uint64_t object, uint64_t offset,
155 void *tag, dmu_buf_t **dbp)
156{
157 dnode_t *dn;
158 uint64_t blkid;
159 dmu_buf_impl_t *db;
160 int err;
161

--- 11 unchanged lines hidden (view full) ---

173 return (SET_ERROR(EIO));
174 }
175
176 *dbp = &db->db;
177 return (err);
178}
179
180int
181dmu_buf_hold_by_dnode(dnode_t *dn, uint64_t offset,
182 void *tag, dmu_buf_t **dbp, int flags)
183{
184 int err;
185 int db_flags = DB_RF_CANFAIL;
186
187 if (flags & DMU_READ_NO_PREFETCH)
188 db_flags |= DB_RF_NOPREFETCH;
189
190 err = dmu_buf_hold_noread_by_dnode(dn, offset, tag, dbp);
191 if (err == 0) {
192 dmu_buf_impl_t *db = (dmu_buf_impl_t *)(*dbp);
193 err = dbuf_read(db, NULL, db_flags);
194 if (err != 0) {
195 dbuf_rele(db, tag);
196 *dbp = NULL;
197 }
198 }
199
200 return (err);
201}
202
203int
161dmu_buf_hold(objset_t *os, uint64_t object, uint64_t offset,
162 void *tag, dmu_buf_t **dbp, int flags)
163{
164 int err;
165 int db_flags = DB_RF_CANFAIL;
166
167 if (flags & DMU_READ_NO_PREFETCH)
168 db_flags |= DB_RF_NOPREFETCH;

--- 1975 unchanged lines hidden ---
204dmu_buf_hold(objset_t *os, uint64_t object, uint64_t offset,
205 void *tag, dmu_buf_t **dbp, int flags)
206{
207 int err;
208 int db_flags = DB_RF_CANFAIL;
209
210 if (flags & DMU_READ_NO_PREFETCH)
211 db_flags |= DB_RF_NOPREFETCH;

--- 1975 unchanged lines hidden ---