search for: cache_start

Displaying 9 results from an estimated 9 matches for "cache_start".

2019 May 15
2
[nbdkit PATCH] Introduce cacheextents filter
...e. */ +static pthread_mutex_t lock = PTHREAD_MUTEX_INITIALIZER; + +/* The real size of the underlying plugin. */ +static uint64_t size; + +/* Cached extents from the last extents () call and its start and end for the + sake of simplicity. */ +struct nbdkit_extents *cache_extents; +static uint64_t cache_start; +static uint64_t cache_end; + +static void +cacheextents_unload (void) +{ + nbdkit_extents_free (cache_extents); +} + +static int +cacheextents_add (struct nbdkit_extents *extents) +{ + size_t i = 0; + + for (i = 0; i < nbdkit_extents_count (cache_extents); i++) { + struct nbdkit_extent e...
2019 Jun 11
5
[nbdkit PATCH v2] Introduce cacheextents filter
...EL NBDKIT_THREAD_MODEL_PARALLEL + +/* This lock protects the global state. */ +static pthread_mutex_t lock = PTHREAD_MUTEX_INITIALIZER; + +/* Cached extents from the last extents () call and its start and end for the + sake of simplicity. */ +struct nbdkit_extents *cache_extents; +static uint64_t cache_start; +static uint64_t cache_end; + +static void +cacheextents_unload (void) +{ + nbdkit_extents_free (cache_extents); +} + +static int +cacheextents_add (struct nbdkit_extents *extents, int *err) +{ + size_t i = 0; + + for (i = 0; i < nbdkit_extents_count (cache_extents); i++) { + struct nbdki...
2019 May 15
0
Re: [nbdkit PATCH] Introduce cacheextents filter
...*extents) > +{ > + size_t i = 0; > + size_t count = nbdkit_extents_count (extents); > + struct nbdkit_extent first = nbdkit_get_extent (extents, 0); > + struct nbdkit_extent last = nbdkit_get_extent (extents, count - 1); > + > + nbdkit_extents_free (cache_extents); > + cache_start = first.offset; > + cache_end = last.offset + last.length; > + cache_extents = nbdkit_extents_new (cache_start, cache_end); > + > + for (i = 0; i < count; i++) { > + struct nbdkit_extent ex = nbdkit_get_extent (extents, i); > + nbdkit_debug ("cacheextents: updatin...
2019 Jun 11
0
Re: [nbdkit PATCH v2] Introduce cacheextents filter
...t; +/* Cached extents from the last extents () call and its start and end for the > + sake of simplicity. */ The prevailing style seems to be the use of leading ' *' on subsequent comment lines, and */ on its own line. > +struct nbdkit_extents *cache_extents; > +static uint64_t cache_start; > +static uint64_t cache_end; > + > +static void > +cacheextents_unload (void) > +{ > + nbdkit_extents_free (cache_extents); > +} > + > +static int > +cacheextents_add (struct nbdkit_extents *extents, int *err) > +{ > + size_t i = 0; > + > + for (i = 0;...
2019 May 20
2
Re: [nbdkit PATCH v2] Introduce cacheextents filter
...t64_t offset, uint32_t flags, >> + struct nbdkit_extents *extents, >> + int *err) >> +{ >> + ACQUIRE_LOCK_FOR_CURRENT_SCOPE (&lock); >> + >> + nbdkit_debug ("cacheextents:" >> + " cache_start=%" PRIu64 >> + " cache_end=%" PRIu64 >> + " cache_extents=%p", >> + cache_start, cache_end, cache_extents); >> + >> + if (cache_extents && >> + offset >= cache_start &&...
2019 May 15
6
[nbdkit PATCH v2] Introduce cacheextents filter
...e. */ +static pthread_mutex_t lock = PTHREAD_MUTEX_INITIALIZER; + +/* The real size of the underlying plugin. */ +static uint64_t size; + +/* Cached extents from the last extents () call and its start and end for the + sake of simplicity. */ +struct nbdkit_extents *cache_extents; +static uint64_t cache_start; +static uint64_t cache_end; + +static void +cacheextents_unload (void) +{ + nbdkit_extents_free (cache_extents); +} + +static int +cacheextents_add (struct nbdkit_extents *extents, int *err) +{ + size_t i = 0; + + for (i = 0; i < nbdkit_extents_count (cache_extents); i++) { + struct nbdki...
2019 May 16
0
Re: [nbdkit PATCH v2] Introduce cacheextents filter
...*handle, uint32_t count, uint64_t offset, uint32_t flags, > + struct nbdkit_extents *extents, > + int *err) > +{ > + ACQUIRE_LOCK_FOR_CURRENT_SCOPE (&lock); > + > + nbdkit_debug ("cacheextents:" > + " cache_start=%" PRIu64 > + " cache_end=%" PRIu64 > + " cache_extents=%p", > + cache_start, cache_end, cache_extents); > + > + if (cache_extents && > + offset >= cache_start && offset < cache_end)...
2019 May 20
0
Re: [nbdkit PATCH v2] Introduce cacheextents filter
On 5/20/19 8:23 AM, Martin Kletzander wrote: >>> +  if (cache_extents && >>> +      offset >= cache_start && offset < cache_end) { >>> +    nbdkit_debug ("cacheextents: returning from cache"); >>> +    return cacheextents_add (extents, err); >>> +  } >>> + >>> +  nbdkit_debug ("cacheextents: cache miss"); >>> +  int r...
2019 Jun 11
0
Re: [nbdkit PATCH v2] Introduce cacheextents filter
...gt; +/* This lock protects the global state. */ > +static pthread_mutex_t lock = PTHREAD_MUTEX_INITIALIZER; > + > +/* Cached extents from the last extents () call and its start and end for the > + sake of simplicity. */ > +struct nbdkit_extents *cache_extents; > +static uint64_t cache_start; > +static uint64_t cache_end; This shares a common cache across multiple connections. If the plugin ever returns connection-dependent differences (such as different sizes according to when the connection was made), we may have to change this to track a cache per connection. But then again, thi...