Lines 82-87
u_int g_eli_batch = 0;
Link Here
|
82 |
SYSCTL_UINT(_kern_geom_eli, OID_AUTO, batch, CTLFLAG_RWTUN, &g_eli_batch, 0, |
82 |
SYSCTL_UINT(_kern_geom_eli, OID_AUTO, batch, CTLFLAG_RWTUN, &g_eli_batch, 0, |
83 |
"Use crypto operations batching"); |
83 |
"Use crypto operations batching"); |
84 |
|
84 |
|
|
|
85 |
uma_zone_t g_eli_zone; |
86 |
static u_int g_eli_uma_reserve = 1; |
87 |
SYSCTL_UINT(_kern_geom_eli, OID_AUTO, uma_reserve, CTLFLAG_RDTUN, |
88 |
&g_eli_uma_reserve, 0, "Items to pre-allocate in dedicated uma zone " |
89 |
"and reserve for writes to onetime disks"); |
90 |
|
91 |
u_int g_eli_all_writes_use_uma = 0; |
92 |
SYSCTL_UINT(_kern_geom_eli, OID_AUTO, use_uma_for_all_writes, CTLFLAG_RDTUN, |
93 |
&g_eli_all_writes_use_uma, 0, "Use the dedicated uma zone for all writes. " |
94 |
"May reduce write latency but also inflates memory use a bit"); |
95 |
|
85 |
/* |
96 |
/* |
86 |
* Passphrase cached during boot, in order to be more user-friendly if |
97 |
* Passphrase cached during boot, in order to be more user-friendly if |
87 |
* there are multiple providers using the same passphrase. |
98 |
* there are multiple providers using the same passphrase. |
Lines 246-252
g_eli_write_done(struct bio *bp)
Link Here
|
246 |
pbp->bio_inbed++; |
257 |
pbp->bio_inbed++; |
247 |
if (pbp->bio_inbed < pbp->bio_children) |
258 |
if (pbp->bio_inbed < pbp->bio_children) |
248 |
return; |
259 |
return; |
249 |
free(pbp->bio_driver2, M_ELI); |
260 |
sc = pbp->bio_to->geom->softc; |
|
|
261 |
if (g_eli_all_writes_use_uma || |
262 |
(sc->sc_flags & G_ELI_FLAG_ONETIME) != 0) |
263 |
uma_zfree(g_eli_zone, pbp->bio_driver2); |
264 |
else |
265 |
free(pbp->bio_driver2, M_ELI); |
250 |
pbp->bio_driver2 = NULL; |
266 |
pbp->bio_driver2 = NULL; |
251 |
if (pbp->bio_error != 0) { |
267 |
if (pbp->bio_error != 0) { |
252 |
G_ELI_LOGREQ(0, pbp, "%s() failed (error=%d)", __func__, |
268 |
G_ELI_LOGREQ(0, pbp, "%s() failed (error=%d)", __func__, |
Lines 258-264
g_eli_write_done(struct bio *bp)
Link Here
|
258 |
/* |
274 |
/* |
259 |
* Write is finished, send it up. |
275 |
* Write is finished, send it up. |
260 |
*/ |
276 |
*/ |
261 |
sc = pbp->bio_to->geom->softc; |
|
|
262 |
g_io_deliver(pbp, pbp->bio_error); |
277 |
g_io_deliver(pbp, pbp->bio_error); |
263 |
if (sc != NULL) |
278 |
if (sc != NULL) |
264 |
atomic_subtract_int(&sc->sc_inflight, 1); |
279 |
atomic_subtract_int(&sc->sc_inflight, 1); |
Lines 1254-1259
static void
Link Here
|
1254 |
g_eli_init(struct g_class *mp) |
1269 |
g_eli_init(struct g_class *mp) |
1255 |
{ |
1270 |
{ |
1256 |
|
1271 |
|
|
|
1272 |
g_eli_zone = uma_zcreate("g_eli", ELI_ZONE_ITEM_SIZE, NULL, NULL, |
1273 |
NULL, NULL, 0, UMA_ZONE_NOFREE); |
1274 |
/* Increase the chances that items are available when needed. */ |
1275 |
uma_prealloc(g_eli_zone, g_eli_uma_reserve); |
1276 |
uma_zone_reserve(g_eli_zone, g_eli_uma_reserve); |
1277 |
|
1257 |
g_eli_pre_sync = EVENTHANDLER_REGISTER(shutdown_pre_sync, |
1278 |
g_eli_pre_sync = EVENTHANDLER_REGISTER(shutdown_pre_sync, |
1258 |
g_eli_shutdown_pre_sync, mp, SHUTDOWN_PRI_FIRST); |
1279 |
g_eli_shutdown_pre_sync, mp, SHUTDOWN_PRI_FIRST); |
1259 |
if (g_eli_pre_sync == NULL) |
1280 |
if (g_eli_pre_sync == NULL) |
Lines 1264-1269
static void
Link Here
|
1264 |
g_eli_fini(struct g_class *mp) |
1285 |
g_eli_fini(struct g_class *mp) |
1265 |
{ |
1286 |
{ |
1266 |
|
1287 |
|
|
|
1288 |
uma_zdestroy(g_eli_zone); |
1267 |
if (g_eli_pre_sync != NULL) |
1289 |
if (g_eli_pre_sync != NULL) |
1268 |
EVENTHANDLER_DEREGISTER(shutdown_pre_sync, g_eli_pre_sync); |
1290 |
EVENTHANDLER_DEREGISTER(shutdown_pre_sync, g_eli_pre_sync); |
1269 |
} |
1291 |
} |