- if (elt->cancelled) {
- self->last_part_successful = FALSE;
- self->no_more_parts = TRUE;
- return FALSE;
- }
-
- return TRUE;
-}
-
-/* Called without the slab_mutex held, this function sets up a new slab_source_state
- * object based on the configuratino of the Xfer Element. */
-static inline gboolean
-slab_source_setup(
- XferDestTaperSplitter *self,
- slab_source_state *state)
-{
- state->tmp_slab = NULL;
- state->slice_fd = -1;
- state->slice = NULL;
- state->slice_remaining = 0;
- state->next_serial = G_MAXUINT64;
-
- /* if we're to retry the part, rewind to the beginning */
- if (self->retry_part) {
- if (self->use_mem_cache) {
- /* rewind device_slab to point to the mem_cache_slab */
- g_mutex_lock(self->slab_mutex);
- if (self->device_slab)
- unref_slab(self, self->device_slab);
- self->device_slab = self->mem_cache_slab;
- if(self->device_slab != NULL)
- self->device_slab->refcount++;
- g_mutex_unlock(self->slab_mutex);
- } else {
- g_assert(self->part_slices);
-
- g_mutex_lock(self->slab_mutex);
-
- /* we're going to read from the disk cache until we get to the oldest useful
- * slab in memory, so it had best exist */
- g_assert(self->oldest_slab != NULL);
-
- /* point device_slab at the oldest slab we have */
- self->oldest_slab->refcount++;
- if (self->device_slab)
- unref_slab(self, self->device_slab);
- self->device_slab = self->oldest_slab;
-
- /* and increment it until it is at least the slab we want to start from */
- while (self->device_slab->serial < self->part_first_serial) {
- next_slab(self, &self->device_slab);
- }