diff options
author | erdgeist <> | 2007-11-23 18:13:11 +0000 |
---|---|---|
committer | erdgeist <> | 2007-11-23 18:13:11 +0000 |
commit | afcef0537cfadc572315bb70a180ad74de6856e3 (patch) | |
tree | cd2290d3cdf46c67279fc60e5aa9623b5d5b1886 /ot_sync.c | |
parent | 616302c13962e6b9be9b0ca552ded9cd37e85597 (diff) |
Reflect changes in iovec code in sync code
Diffstat (limited to 'ot_sync.c')
-rw-r--r-- | ot_sync.c | 19 |
1 files changed, 5 insertions, 14 deletions
@@ -96,19 +96,10 @@ static void sync_make( int *iovec_entries, struct iovec **iovector ) { | |||
96 | /* If we reached our low watermark in buffer... */ | 96 | /* If we reached our low watermark in buffer... */ |
97 | if( re - r <= (ssize_t)(/* strlen( "20:" ) == */ 3 + sizeof( ot_hash ) + /* strlen_max( "%zd" ) == */ 12 + byte_count ) ) { | 97 | if( re - r <= (ssize_t)(/* strlen( "20:" ) == */ 3 + sizeof( ot_hash ) + /* strlen_max( "%zd" ) == */ 12 + byte_count ) ) { |
98 | 98 | ||
99 | /* crop current output buffer to the amount really used */ | 99 | /* Allocate a fresh output buffer at the end of our buffers list |
100 | iovec_fixlast( iovec_entries, iovector, OT_SYNC_CHUNK_SIZE - ( re - r ) ); | 100 | release bucket and return, if that fails */ |
101 | 101 | if( !( r = iovec_fix_increase_or_free( iovec_entries, iovector, r, OT_SYNC_CHUNK_SIZE ) ) ) | |
102 | /* And allocate a fresh output buffer at the end of our buffers list */ | 102 | return mutex_bucket_unlock( bucket ); |
103 | if( !( r = iovec_increase( iovec_entries, iovector, OT_SYNC_CHUNK_SIZE ) ) ) { | ||
104 | |||
105 | /* If this fails: free buffers */ | ||
106 | iovec_free( iovec_entries, iovector ); | ||
107 | |||
108 | /* Release lock on current bucket and return */ | ||
109 | mutex_bucket_unlock( bucket ); | ||
110 | return; | ||
111 | } | ||
112 | 103 | ||
113 | /* Adjust new end of output buffer */ | 104 | /* Adjust new end of output buffer */ |
114 | re = r + OT_SYNC_CHUNK_SIZE; | 105 | re = r + OT_SYNC_CHUNK_SIZE; |
@@ -128,7 +119,7 @@ static void sync_make( int *iovec_entries, struct iovec **iovector ) { | |||
128 | *r++='e'; *r++='e'; | 119 | *r++='e'; *r++='e'; |
129 | 120 | ||
130 | /* Release unused memory in current output buffer */ | 121 | /* Release unused memory in current output buffer */ |
131 | iovec_fixlast( iovec_entries, iovector, OT_SYNC_CHUNK_SIZE - ( re - r ) ); | 122 | iovec_fixlast( iovec_entries, iovector, r ); |
132 | } | 123 | } |
133 | 124 | ||
134 | /* This is the entry point into this worker thread | 125 | /* This is the entry point into this worker thread |