Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

dm vdo: clean up scnprintf usage

Ignore scnprintf return status since it is not necessary. Change
write_* functions type from int to void since we no longer return
any result. Also, clean up any code that checks or uses any scnprintf
return results.
Check uds_allocate return code which was previous ignored, return
and log error when uds_allocate failed.

Reported-by: Dan Carpenter <dan.carpenter@linaro.org>
Signed-off-by: Chung Chung <cchung@redhat.com>
Signed-off-by: Matthew Sakai <msakai@redhat.com>
Signed-off-by: Mike Snitzer <snitzer@kernel.org>

authored by

Chung Chung and committed by
Mike Snitzer
81c751ad 20be466c

+262 -602
+262 -602
drivers/md/dm-vdo/message-stats.c
··· 11 11 #include "thread-device.h" 12 12 #include "vdo.h" 13 13 14 - static int write_u64(char *prefix, u64 value, char *suffix, char **buf, 15 - unsigned int *maxlen) 16 - { 17 - int count = scnprintf(*buf, *maxlen, "%s%llu%s", prefix == NULL ? "" : prefix, 18 - value, suffix == NULL ? "" : suffix); 19 - *buf += count; 20 - *maxlen -= count; 21 - if (count >= *maxlen) 22 - return VDO_UNEXPECTED_EOF; 23 - return VDO_SUCCESS; 24 - } 25 - 26 - static int write_u32(char *prefix, u32 value, char *suffix, char **buf, 27 - unsigned int *maxlen) 28 - { 29 - int count = scnprintf(*buf, *maxlen, "%s%u%s", prefix == NULL ? "" : prefix, 30 - value, suffix == NULL ? "" : suffix); 31 - *buf += count; 32 - *maxlen -= count; 33 - if (count >= *maxlen) 34 - return VDO_UNEXPECTED_EOF; 35 - return VDO_SUCCESS; 36 - } 37 - 38 - static int write_block_count_t(char *prefix, block_count_t value, char *suffix, 39 - char **buf, unsigned int *maxlen) 40 - { 41 - int count = scnprintf(*buf, *maxlen, "%s%llu%s", prefix == NULL ? "" : prefix, 42 - value, suffix == NULL ? "" : suffix); 43 - *buf += count; 44 - *maxlen -= count; 45 - if (count >= *maxlen) 46 - return VDO_UNEXPECTED_EOF; 47 - return VDO_SUCCESS; 48 - } 49 - 50 - static int write_string(char *prefix, char *value, char *suffix, char **buf, 51 - unsigned int *maxlen) 52 - { 53 - int count = scnprintf(*buf, *maxlen, "%s%s%s", prefix == NULL ? "" : prefix, 54 - value, suffix == NULL ? "" : suffix); 55 - *buf += count; 56 - *maxlen -= count; 57 - if (count >= *maxlen) 58 - return VDO_UNEXPECTED_EOF; 59 - return VDO_SUCCESS; 60 - } 61 - 62 - static int write_bool(char *prefix, bool value, char *suffix, char **buf, 14 + static void write_u64(char *prefix, u64 value, char *suffix, char **buf, 63 15 unsigned int *maxlen) 64 16 { 65 - int count = scnprintf(*buf, *maxlen, "%s%d%s", prefix == NULL ? "" : prefix, 66 - value, suffix == NULL ? "" : suffix); 17 + int count; 18 + 19 + count = scnprintf(*buf, *maxlen, "%s%llu%s", prefix == NULL ? "" : prefix, 20 + value, suffix == NULL ? "" : suffix); 67 21 *buf += count; 68 22 *maxlen -= count; 69 - if (count >= *maxlen) 70 - return VDO_UNEXPECTED_EOF; 71 - return VDO_SUCCESS; 72 23 } 73 24 74 - static int write_u8(char *prefix, u8 value, char *suffix, char **buf, 75 - unsigned int *maxlen) 25 + static void write_u32(char *prefix, u32 value, char *suffix, char **buf, 26 + unsigned int *maxlen) 76 27 { 77 - int count = scnprintf(*buf, *maxlen, "%s%u%s", prefix == NULL ? "" : prefix, 78 - value, suffix == NULL ? "" : suffix); 28 + int count; 29 + 30 + count = scnprintf(*buf, *maxlen, "%s%u%s", prefix == NULL ? "" : prefix, 31 + value, suffix == NULL ? "" : suffix); 79 32 *buf += count; 80 33 *maxlen -= count; 81 - if (count >= *maxlen) 82 - return VDO_UNEXPECTED_EOF; 83 - return VDO_SUCCESS; 84 34 } 85 35 86 - static int write_block_allocator_statistics(char *prefix, 87 - struct block_allocator_statistics *stats, 88 - char *suffix, char **buf, 89 - unsigned int *maxlen) 36 + static void write_block_count_t(char *prefix, block_count_t value, char *suffix, 37 + char **buf, unsigned int *maxlen) 90 38 { 91 - int result; 39 + int count; 92 40 93 - result = write_string(prefix, "{ ", NULL, buf, maxlen); 94 - if (result != VDO_SUCCESS) 95 - return result; 96 - /* The total number of slabs from which blocks may be allocated */ 97 - result = write_u64("slabCount : ", stats->slab_count, ", ", buf, maxlen); 98 - if (result != VDO_SUCCESS) 99 - return result; 100 - /* The total number of slabs from which blocks have ever been allocated */ 101 - result = write_u64("slabsOpened : ", stats->slabs_opened, ", ", buf, maxlen); 102 - if (result != VDO_SUCCESS) 103 - return result; 104 - /* The number of times since loading that a slab has been re-opened */ 105 - result = write_u64("slabsReopened : ", stats->slabs_reopened, ", ", buf, maxlen); 106 - if (result != VDO_SUCCESS) 107 - return result; 108 - result = write_string(NULL, "}", suffix, buf, maxlen); 109 - if (result != VDO_SUCCESS) 110 - return result; 111 - return VDO_SUCCESS; 41 + count = scnprintf(*buf, *maxlen, "%s%llu%s", prefix == NULL ? "" : prefix, 42 + value, suffix == NULL ? "" : suffix); 43 + *buf += count; 44 + *maxlen -= count; 112 45 } 113 46 114 - static int write_commit_statistics(char *prefix, struct commit_statistics *stats, 115 - char *suffix, char **buf, unsigned int *maxlen) 47 + static void write_string(char *prefix, char *value, char *suffix, char **buf, 48 + unsigned int *maxlen) 116 49 { 117 - int result; 50 + int count; 118 51 119 - result = write_string(prefix, "{ ", NULL, buf, maxlen); 120 - if (result != VDO_SUCCESS) 121 - return result; 122 - /* The total number of items on which processing has started */ 123 - result = write_u64("started : ", stats->started, ", ", buf, maxlen); 124 - if (result != VDO_SUCCESS) 125 - return result; 126 - /* The total number of items for which a write operation has been issued */ 127 - result = write_u64("written : ", stats->written, ", ", buf, maxlen); 128 - if (result != VDO_SUCCESS) 129 - return result; 130 - /* The total number of items for which a write operation has completed */ 131 - result = write_u64("committed : ", stats->committed, ", ", buf, maxlen); 132 - if (result != VDO_SUCCESS) 133 - return result; 134 - result = write_string(NULL, "}", suffix, buf, maxlen); 135 - if (result != VDO_SUCCESS) 136 - return result; 137 - return VDO_SUCCESS; 52 + count = scnprintf(*buf, *maxlen, "%s%s%s", prefix == NULL ? "" : prefix, 53 + value, suffix == NULL ? "" : suffix); 54 + *buf += count; 55 + *maxlen -= count; 138 56 } 139 57 140 - static int write_recovery_journal_statistics(char *prefix, 141 - struct recovery_journal_statistics *stats, 58 + static void write_bool(char *prefix, bool value, char *suffix, char **buf, 59 + unsigned int *maxlen) 60 + { 61 + int count; 62 + 63 + count = scnprintf(*buf, *maxlen, "%s%d%s", prefix == NULL ? "" : prefix, 64 + value, suffix == NULL ? "" : suffix); 65 + *buf += count; 66 + *maxlen -= count; 67 + } 68 + 69 + static void write_u8(char *prefix, u8 value, char *suffix, char **buf, 70 + unsigned int *maxlen) 71 + { 72 + int count; 73 + 74 + count = scnprintf(*buf, *maxlen, "%s%u%s", prefix == NULL ? "" : prefix, 75 + value, suffix == NULL ? "" : suffix); 76 + *buf += count; 77 + *maxlen -= count; 78 + } 79 + 80 + static void write_block_allocator_statistics(char *prefix, 81 + struct block_allocator_statistics *stats, 142 82 char *suffix, char **buf, 143 83 unsigned int *maxlen) 144 84 { 145 - int result; 85 + write_string(prefix, "{ ", NULL, buf, maxlen); 86 + /* The total number of slabs from which blocks may be allocated */ 87 + write_u64("slabCount : ", stats->slab_count, ", ", buf, maxlen); 88 + /* The total number of slabs from which blocks have ever been allocated */ 89 + write_u64("slabsOpened : ", stats->slabs_opened, ", ", buf, maxlen); 90 + /* The number of times since loading that a slab has been re-opened */ 91 + write_u64("slabsReopened : ", stats->slabs_reopened, ", ", buf, maxlen); 92 + write_string(NULL, "}", suffix, buf, maxlen); 93 + } 146 94 147 - result = write_string(prefix, "{ ", NULL, buf, maxlen); 148 - if (result != VDO_SUCCESS) 149 - return result; 95 + static void write_commit_statistics(char *prefix, struct commit_statistics *stats, 96 + char *suffix, char **buf, unsigned int *maxlen) 97 + { 98 + write_string(prefix, "{ ", NULL, buf, maxlen); 99 + /* The total number of items on which processing has started */ 100 + write_u64("started : ", stats->started, ", ", buf, maxlen); 101 + /* The total number of items for which a write operation has been issued */ 102 + write_u64("written : ", stats->written, ", ", buf, maxlen); 103 + /* The total number of items for which a write operation has completed */ 104 + write_u64("committed : ", stats->committed, ", ", buf, maxlen); 105 + write_string(NULL, "}", suffix, buf, maxlen); 106 + } 107 + 108 + static void write_recovery_journal_statistics(char *prefix, 109 + struct recovery_journal_statistics *stats, 110 + char *suffix, char **buf, 111 + unsigned int *maxlen) 112 + { 113 + write_string(prefix, "{ ", NULL, buf, maxlen); 150 114 /* Number of times the on-disk journal was full */ 151 - result = write_u64("diskFull : ", stats->disk_full, ", ", buf, maxlen); 152 - if (result != VDO_SUCCESS) 153 - return result; 115 + write_u64("diskFull : ", stats->disk_full, ", ", buf, maxlen); 154 116 /* Number of times the recovery journal requested slab journal commits. */ 155 - result = write_u64("slabJournalCommitsRequested : ", 156 - stats->slab_journal_commits_requested, ", ", buf, maxlen); 157 - if (result != VDO_SUCCESS) 158 - return result; 117 + write_u64("slabJournalCommitsRequested : ", 118 + stats->slab_journal_commits_requested, ", ", buf, maxlen); 159 119 /* Write/Commit totals for individual journal entries */ 160 - result = write_commit_statistics("entries : ", &stats->entries, ", ", buf, 161 - maxlen); 162 - if (result != VDO_SUCCESS) 163 - return result; 120 + write_commit_statistics("entries : ", &stats->entries, ", ", buf, maxlen); 164 121 /* Write/Commit totals for journal blocks */ 165 - result = write_commit_statistics("blocks : ", &stats->blocks, ", ", buf, maxlen); 166 - if (result != VDO_SUCCESS) 167 - return result; 168 - result = write_string(NULL, "}", suffix, buf, maxlen); 169 - if (result != VDO_SUCCESS) 170 - return result; 171 - return VDO_SUCCESS; 122 + write_commit_statistics("blocks : ", &stats->blocks, ", ", buf, maxlen); 123 + write_string(NULL, "}", suffix, buf, maxlen); 172 124 } 173 125 174 - static int write_packer_statistics(char *prefix, struct packer_statistics *stats, 175 - char *suffix, char **buf, unsigned int *maxlen) 126 + static void write_packer_statistics(char *prefix, struct packer_statistics *stats, 127 + char *suffix, char **buf, unsigned int *maxlen) 176 128 { 177 - int result; 178 - 179 - result = write_string(prefix, "{ ", NULL, buf, maxlen); 180 - if (result != VDO_SUCCESS) 181 - return result; 129 + write_string(prefix, "{ ", NULL, buf, maxlen); 182 130 /* Number of compressed data items written since startup */ 183 - result = write_u64("compressedFragmentsWritten : ", 184 - stats->compressed_fragments_written, ", ", buf, maxlen); 185 - if (result != VDO_SUCCESS) 186 - return result; 131 + write_u64("compressedFragmentsWritten : ", 132 + stats->compressed_fragments_written, ", ", buf, maxlen); 187 133 /* Number of blocks containing compressed items written since startup */ 188 - result = write_u64("compressedBlocksWritten : ", 189 - stats->compressed_blocks_written, ", ", buf, maxlen); 190 - if (result != VDO_SUCCESS) 191 - return result; 134 + write_u64("compressedBlocksWritten : ", 135 + stats->compressed_blocks_written, ", ", buf, maxlen); 192 136 /* Number of VIOs that are pending in the packer */ 193 - result = write_u64("compressedFragmentsInPacker : ", 194 - stats->compressed_fragments_in_packer, ", ", buf, maxlen); 195 - if (result != VDO_SUCCESS) 196 - return result; 197 - result = write_string(NULL, "}", suffix, buf, maxlen); 198 - if (result != VDO_SUCCESS) 199 - return result; 200 - return VDO_SUCCESS; 137 + write_u64("compressedFragmentsInPacker : ", 138 + stats->compressed_fragments_in_packer, ", ", buf, maxlen); 139 + write_string(NULL, "}", suffix, buf, maxlen); 201 140 } 202 141 203 - static int write_slab_journal_statistics(char *prefix, 204 - struct slab_journal_statistics *stats, 205 - char *suffix, char **buf, unsigned int *maxlen) 142 + static void write_slab_journal_statistics(char *prefix, 143 + struct slab_journal_statistics *stats, 144 + char *suffix, char **buf, unsigned int *maxlen) 206 145 { 207 - int result; 208 - 209 - result = write_string(prefix, "{ ", NULL, buf, maxlen); 210 - if (result != VDO_SUCCESS) 211 - return result; 146 + write_string(prefix, "{ ", NULL, buf, maxlen); 212 147 /* Number of times the on-disk journal was full */ 213 - result = write_u64("diskFullCount : ", stats->disk_full_count, ", ", buf, 214 - maxlen); 215 - if (result != VDO_SUCCESS) 216 - return result; 148 + write_u64("diskFullCount : ", stats->disk_full_count, ", ", buf, maxlen); 217 149 /* Number of times an entry was added over the flush threshold */ 218 - result = write_u64("flushCount : ", stats->flush_count, ", ", buf, maxlen); 219 - if (result != VDO_SUCCESS) 220 - return result; 150 + write_u64("flushCount : ", stats->flush_count, ", ", buf, maxlen); 221 151 /* Number of times an entry was added over the block threshold */ 222 - result = write_u64("blockedCount : ", stats->blocked_count, ", ", buf, maxlen); 223 - if (result != VDO_SUCCESS) 224 - return result; 152 + write_u64("blockedCount : ", stats->blocked_count, ", ", buf, maxlen); 225 153 /* Number of times a tail block was written */ 226 - result = write_u64("blocksWritten : ", stats->blocks_written, ", ", buf, maxlen); 227 - if (result != VDO_SUCCESS) 228 - return result; 154 + write_u64("blocksWritten : ", stats->blocks_written, ", ", buf, maxlen); 229 155 /* Number of times we had to wait for the tail to write */ 230 - result = write_u64("tailBusyCount : ", stats->tail_busy_count, ", ", buf, 231 - maxlen); 232 - if (result != VDO_SUCCESS) 233 - return result; 234 - result = write_string(NULL, "}", suffix, buf, maxlen); 235 - if (result != VDO_SUCCESS) 236 - return result; 237 - return VDO_SUCCESS; 156 + write_u64("tailBusyCount : ", stats->tail_busy_count, ", ", buf, maxlen); 157 + write_string(NULL, "}", suffix, buf, maxlen); 238 158 } 239 159 240 - static int write_slab_summary_statistics(char *prefix, 241 - struct slab_summary_statistics *stats, 242 - char *suffix, char **buf, unsigned int *maxlen) 160 + static void write_slab_summary_statistics(char *prefix, 161 + struct slab_summary_statistics *stats, 162 + char *suffix, char **buf, unsigned int *maxlen) 243 163 { 244 - int result; 245 - 246 - result = write_string(prefix, "{ ", NULL, buf, maxlen); 247 - if (result != VDO_SUCCESS) 248 - return result; 164 + write_string(prefix, "{ ", NULL, buf, maxlen); 249 165 /* Number of blocks written */ 250 - result = write_u64("blocksWritten : ", stats->blocks_written, ", ", buf, maxlen); 251 - if (result != VDO_SUCCESS) 252 - return result; 253 - result = write_string(NULL, "}", suffix, buf, maxlen); 254 - if (result != VDO_SUCCESS) 255 - return result; 256 - return VDO_SUCCESS; 166 + write_u64("blocksWritten : ", stats->blocks_written, ", ", buf, maxlen); 167 + write_string(NULL, "}", suffix, buf, maxlen); 257 168 } 258 169 259 - static int write_ref_counts_statistics(char *prefix, struct ref_counts_statistics *stats, 170 + static void write_ref_counts_statistics(char *prefix, struct ref_counts_statistics *stats, 171 + char *suffix, char **buf, unsigned int *maxlen) 172 + { 173 + write_string(prefix, "{ ", NULL, buf, maxlen); 174 + /* Number of reference blocks written */ 175 + write_u64("blocksWritten : ", stats->blocks_written, ", ", buf, maxlen); 176 + write_string(NULL, "}", suffix, buf, maxlen); 177 + } 178 + 179 + static void write_block_map_statistics(char *prefix, struct block_map_statistics *stats, 260 180 char *suffix, char **buf, unsigned int *maxlen) 261 181 { 262 - int result; 263 - 264 - result = write_string(prefix, "{ ", NULL, buf, maxlen); 265 - if (result != VDO_SUCCESS) 266 - return result; 267 - /* Number of reference blocks written */ 268 - result = write_u64("blocksWritten : ", stats->blocks_written, ", ", buf, maxlen); 269 - if (result != VDO_SUCCESS) 270 - return result; 271 - result = write_string(NULL, "}", suffix, buf, maxlen); 272 - if (result != VDO_SUCCESS) 273 - return result; 274 - return VDO_SUCCESS; 275 - } 276 - 277 - static int write_block_map_statistics(char *prefix, struct block_map_statistics *stats, 278 - char *suffix, char **buf, unsigned int *maxlen) 279 - { 280 - int result; 281 - 282 - result = write_string(prefix, "{ ", NULL, buf, maxlen); 283 - if (result != VDO_SUCCESS) 284 - return result; 182 + write_string(prefix, "{ ", NULL, buf, maxlen); 285 183 /* number of dirty (resident) pages */ 286 - result = write_u32("dirtyPages : ", stats->dirty_pages, ", ", buf, maxlen); 287 - if (result != VDO_SUCCESS) 288 - return result; 184 + write_u32("dirtyPages : ", stats->dirty_pages, ", ", buf, maxlen); 289 185 /* number of clean (resident) pages */ 290 - result = write_u32("cleanPages : ", stats->clean_pages, ", ", buf, maxlen); 291 - if (result != VDO_SUCCESS) 292 - return result; 186 + write_u32("cleanPages : ", stats->clean_pages, ", ", buf, maxlen); 293 187 /* number of free pages */ 294 - result = write_u32("freePages : ", stats->free_pages, ", ", buf, maxlen); 295 - if (result != VDO_SUCCESS) 296 - return result; 188 + write_u32("freePages : ", stats->free_pages, ", ", buf, maxlen); 297 189 /* number of pages in failed state */ 298 - result = write_u32("failedPages : ", stats->failed_pages, ", ", buf, maxlen); 299 - if (result != VDO_SUCCESS) 300 - return result; 190 + write_u32("failedPages : ", stats->failed_pages, ", ", buf, maxlen); 301 191 /* number of pages incoming */ 302 - result = write_u32("incomingPages : ", stats->incoming_pages, ", ", buf, maxlen); 303 - if (result != VDO_SUCCESS) 304 - return result; 192 + write_u32("incomingPages : ", stats->incoming_pages, ", ", buf, maxlen); 305 193 /* number of pages outgoing */ 306 - result = write_u32("outgoingPages : ", stats->outgoing_pages, ", ", buf, maxlen); 307 - if (result != VDO_SUCCESS) 308 - return result; 194 + write_u32("outgoingPages : ", stats->outgoing_pages, ", ", buf, maxlen); 309 195 /* how many times free page not avail */ 310 - result = write_u32("cachePressure : ", stats->cache_pressure, ", ", buf, maxlen); 311 - if (result != VDO_SUCCESS) 312 - return result; 196 + write_u32("cachePressure : ", stats->cache_pressure, ", ", buf, maxlen); 313 197 /* number of get_vdo_page() calls for read */ 314 - result = write_u64("readCount : ", stats->read_count, ", ", buf, maxlen); 315 - if (result != VDO_SUCCESS) 316 - return result; 198 + write_u64("readCount : ", stats->read_count, ", ", buf, maxlen); 317 199 /* number of get_vdo_page() calls for write */ 318 - result = write_u64("writeCount : ", stats->write_count, ", ", buf, maxlen); 319 - if (result != VDO_SUCCESS) 320 - return result; 200 + write_u64("writeCount : ", stats->write_count, ", ", buf, maxlen); 321 201 /* number of times pages failed to read */ 322 - result = write_u64("failedReads : ", stats->failed_reads, ", ", buf, maxlen); 323 - if (result != VDO_SUCCESS) 324 - return result; 202 + write_u64("failedReads : ", stats->failed_reads, ", ", buf, maxlen); 325 203 /* number of times pages failed to write */ 326 - result = write_u64("failedWrites : ", stats->failed_writes, ", ", buf, maxlen); 327 - if (result != VDO_SUCCESS) 328 - return result; 204 + write_u64("failedWrites : ", stats->failed_writes, ", ", buf, maxlen); 329 205 /* number of gets that are reclaimed */ 330 - result = write_u64("reclaimed : ", stats->reclaimed, ", ", buf, maxlen); 331 - if (result != VDO_SUCCESS) 332 - return result; 206 + write_u64("reclaimed : ", stats->reclaimed, ", ", buf, maxlen); 333 207 /* number of gets for outgoing pages */ 334 - result = write_u64("readOutgoing : ", stats->read_outgoing, ", ", buf, maxlen); 335 - if (result != VDO_SUCCESS) 336 - return result; 208 + write_u64("readOutgoing : ", stats->read_outgoing, ", ", buf, maxlen); 337 209 /* number of gets that were already there */ 338 - result = write_u64("foundInCache : ", stats->found_in_cache, ", ", buf, maxlen); 339 - if (result != VDO_SUCCESS) 340 - return result; 210 + write_u64("foundInCache : ", stats->found_in_cache, ", ", buf, maxlen); 341 211 /* number of gets requiring discard */ 342 - result = write_u64("discardRequired : ", stats->discard_required, ", ", buf, 343 - maxlen); 344 - if (result != VDO_SUCCESS) 345 - return result; 212 + write_u64("discardRequired : ", stats->discard_required, ", ", buf, maxlen); 346 213 /* number of gets enqueued for their page */ 347 - result = write_u64("waitForPage : ", stats->wait_for_page, ", ", buf, maxlen); 348 - if (result != VDO_SUCCESS) 349 - return result; 214 + write_u64("waitForPage : ", stats->wait_for_page, ", ", buf, maxlen); 350 215 /* number of gets that have to fetch */ 351 - result = write_u64("fetchRequired : ", stats->fetch_required, ", ", buf, maxlen); 352 - if (result != VDO_SUCCESS) 353 - return result; 216 + write_u64("fetchRequired : ", stats->fetch_required, ", ", buf, maxlen); 354 217 /* number of page fetches */ 355 - result = write_u64("pagesLoaded : ", stats->pages_loaded, ", ", buf, maxlen); 356 - if (result != VDO_SUCCESS) 357 - return result; 218 + write_u64("pagesLoaded : ", stats->pages_loaded, ", ", buf, maxlen); 358 219 /* number of page saves */ 359 - result = write_u64("pagesSaved : ", stats->pages_saved, ", ", buf, maxlen); 360 - if (result != VDO_SUCCESS) 361 - return result; 220 + write_u64("pagesSaved : ", stats->pages_saved, ", ", buf, maxlen); 362 221 /* the number of flushes issued */ 363 - result = write_u64("flushCount : ", stats->flush_count, ", ", buf, maxlen); 364 - if (result != VDO_SUCCESS) 365 - return result; 366 - result = write_string(NULL, "}", suffix, buf, maxlen); 367 - if (result != VDO_SUCCESS) 368 - return result; 369 - return VDO_SUCCESS; 222 + write_u64("flushCount : ", stats->flush_count, ", ", buf, maxlen); 223 + write_string(NULL, "}", suffix, buf, maxlen); 370 224 } 371 225 372 - static int write_hash_lock_statistics(char *prefix, struct hash_lock_statistics *stats, 373 - char *suffix, char **buf, unsigned int *maxlen) 226 + static void write_hash_lock_statistics(char *prefix, struct hash_lock_statistics *stats, 227 + char *suffix, char **buf, unsigned int *maxlen) 374 228 { 375 - int result; 376 - 377 - result = write_string(prefix, "{ ", NULL, buf, maxlen); 378 - if (result != VDO_SUCCESS) 379 - return result; 229 + write_string(prefix, "{ ", NULL, buf, maxlen); 380 230 /* Number of times the UDS advice proved correct */ 381 - result = write_u64("dedupeAdviceValid : ", stats->dedupe_advice_valid, ", ", buf, 382 - maxlen); 383 - if (result != VDO_SUCCESS) 384 - return result; 231 + write_u64("dedupeAdviceValid : ", stats->dedupe_advice_valid, ", ", buf, maxlen); 385 232 /* Number of times the UDS advice proved incorrect */ 386 - result = write_u64("dedupeAdviceStale : ", stats->dedupe_advice_stale, ", ", buf, 387 - maxlen); 388 - if (result != VDO_SUCCESS) 389 - return result; 233 + write_u64("dedupeAdviceStale : ", stats->dedupe_advice_stale, ", ", buf, maxlen); 390 234 /* Number of writes with the same data as another in-flight write */ 391 - result = write_u64("concurrentDataMatches : ", stats->concurrent_data_matches, 392 - ", ", buf, maxlen); 393 - if (result != VDO_SUCCESS) 394 - return result; 235 + write_u64("concurrentDataMatches : ", stats->concurrent_data_matches, 236 + ", ", buf, maxlen); 395 237 /* Number of writes whose hash collided with an in-flight write */ 396 - result = write_u64("concurrentHashCollisions : ", 397 - stats->concurrent_hash_collisions, ", ", buf, maxlen); 398 - if (result != VDO_SUCCESS) 399 - return result; 238 + write_u64("concurrentHashCollisions : ", 239 + stats->concurrent_hash_collisions, ", ", buf, maxlen); 400 240 /* Current number of dedupe queries that are in flight */ 401 - result = write_u32("currDedupeQueries : ", stats->curr_dedupe_queries, ", ", buf, 402 - maxlen); 403 - if (result != VDO_SUCCESS) 404 - return result; 405 - result = write_string(NULL, "}", suffix, buf, maxlen); 406 - if (result != VDO_SUCCESS) 407 - return result; 408 - return VDO_SUCCESS; 241 + write_u32("currDedupeQueries : ", stats->curr_dedupe_queries, ", ", buf, maxlen); 242 + write_string(NULL, "}", suffix, buf, maxlen); 409 243 } 410 244 411 - static int write_error_statistics(char *prefix, struct error_statistics *stats, 412 - char *suffix, char **buf, unsigned int *maxlen) 245 + static void write_error_statistics(char *prefix, struct error_statistics *stats, 246 + char *suffix, char **buf, unsigned int *maxlen) 413 247 { 414 - int result; 415 - 416 - result = write_string(prefix, "{ ", NULL, buf, maxlen); 417 - if (result != VDO_SUCCESS) 418 - return result; 248 + write_string(prefix, "{ ", NULL, buf, maxlen); 419 249 /* number of times VDO got an invalid dedupe advice PBN from UDS */ 420 - result = write_u64("invalidAdvicePBNCount : ", stats->invalid_advice_pbn_count, 421 - ", ", buf, maxlen); 422 - if (result != VDO_SUCCESS) 423 - return result; 250 + write_u64("invalidAdvicePBNCount : ", stats->invalid_advice_pbn_count, 251 + ", ", buf, maxlen); 424 252 /* number of times a VIO completed with a VDO_NO_SPACE error */ 425 - result = write_u64("noSpaceErrorCount : ", stats->no_space_error_count, ", ", 426 - buf, maxlen); 427 - if (result != VDO_SUCCESS) 428 - return result; 253 + write_u64("noSpaceErrorCount : ", stats->no_space_error_count, ", ", 254 + buf, maxlen); 429 255 /* number of times a VIO completed with a VDO_READ_ONLY error */ 430 - result = write_u64("readOnlyErrorCount : ", stats->read_only_error_count, ", ", 431 - buf, maxlen); 432 - if (result != VDO_SUCCESS) 433 - return result; 434 - result = write_string(NULL, "}", suffix, buf, maxlen); 435 - if (result != VDO_SUCCESS) 436 - return result; 437 - return VDO_SUCCESS; 256 + write_u64("readOnlyErrorCount : ", stats->read_only_error_count, ", ", 257 + buf, maxlen); 258 + write_string(NULL, "}", suffix, buf, maxlen); 438 259 } 439 260 440 - static int write_bio_stats(char *prefix, struct bio_stats *stats, char *suffix, 441 - char **buf, unsigned int *maxlen) 261 + static void write_bio_stats(char *prefix, struct bio_stats *stats, char *suffix, 262 + char **buf, unsigned int *maxlen) 442 263 { 443 - int result; 444 - 445 - result = write_string(prefix, "{ ", NULL, buf, maxlen); 446 - if (result != VDO_SUCCESS) 447 - return result; 264 + write_string(prefix, "{ ", NULL, buf, maxlen); 448 265 /* Number of REQ_OP_READ bios */ 449 - result = write_u64("read : ", stats->read, ", ", buf, maxlen); 450 - if (result != VDO_SUCCESS) 451 - return result; 266 + write_u64("read : ", stats->read, ", ", buf, maxlen); 452 267 /* Number of REQ_OP_WRITE bios with data */ 453 - result = write_u64("write : ", stats->write, ", ", buf, maxlen); 454 - if (result != VDO_SUCCESS) 455 - return result; 268 + write_u64("write : ", stats->write, ", ", buf, maxlen); 456 269 /* Number of bios tagged with REQ_PREFLUSH and containing no data */ 457 - result = write_u64("emptyFlush : ", stats->empty_flush, ", ", buf, maxlen); 458 - if (result != VDO_SUCCESS) 459 - return result; 270 + write_u64("emptyFlush : ", stats->empty_flush, ", ", buf, maxlen); 460 271 /* Number of REQ_OP_DISCARD bios */ 461 - result = write_u64("discard : ", stats->discard, ", ", buf, maxlen); 462 - if (result != VDO_SUCCESS) 463 - return result; 272 + write_u64("discard : ", stats->discard, ", ", buf, maxlen); 464 273 /* Number of bios tagged with REQ_PREFLUSH */ 465 - result = write_u64("flush : ", stats->flush, ", ", buf, maxlen); 466 - if (result != VDO_SUCCESS) 467 - return result; 274 + write_u64("flush : ", stats->flush, ", ", buf, maxlen); 468 275 /* Number of bios tagged with REQ_FUA */ 469 - result = write_u64("fua : ", stats->fua, ", ", buf, maxlen); 470 - if (result != VDO_SUCCESS) 471 - return result; 472 - result = write_string(NULL, "}", suffix, buf, maxlen); 473 - if (result != VDO_SUCCESS) 474 - return result; 475 - return VDO_SUCCESS; 276 + write_u64("fua : ", stats->fua, ", ", buf, maxlen); 277 + write_string(NULL, "}", suffix, buf, maxlen); 476 278 } 477 279 478 - static int write_memory_usage(char *prefix, struct memory_usage *stats, char *suffix, 479 - char **buf, unsigned int *maxlen) 280 + static void write_memory_usage(char *prefix, struct memory_usage *stats, char *suffix, 281 + char **buf, unsigned int *maxlen) 480 282 { 481 - int result; 482 - 483 - result = write_string(prefix, "{ ", NULL, buf, maxlen); 484 - if (result != VDO_SUCCESS) 485 - return result; 283 + write_string(prefix, "{ ", NULL, buf, maxlen); 486 284 /* Tracked bytes currently allocated. */ 487 - result = write_u64("bytesUsed : ", stats->bytes_used, ", ", buf, maxlen); 488 - if (result != VDO_SUCCESS) 489 - return result; 285 + write_u64("bytesUsed : ", stats->bytes_used, ", ", buf, maxlen); 490 286 /* Maximum tracked bytes allocated. */ 491 - result = write_u64("peakBytesUsed : ", stats->peak_bytes_used, ", ", buf, 492 - maxlen); 493 - if (result != VDO_SUCCESS) 494 - return result; 495 - result = write_string(NULL, "}", suffix, buf, maxlen); 496 - if (result != VDO_SUCCESS) 497 - return result; 498 - return VDO_SUCCESS; 287 + write_u64("peakBytesUsed : ", stats->peak_bytes_used, ", ", buf, maxlen); 288 + write_string(NULL, "}", suffix, buf, maxlen); 499 289 } 500 290 501 - static int write_index_statistics(char *prefix, struct index_statistics *stats, 502 - char *suffix, char **buf, unsigned int *maxlen) 291 + static void write_index_statistics(char *prefix, struct index_statistics *stats, 292 + char *suffix, char **buf, unsigned int *maxlen) 503 293 { 504 - int result; 505 - 506 - result = write_string(prefix, "{ ", NULL, buf, maxlen); 507 - if (result != VDO_SUCCESS) 508 - return result; 294 + write_string(prefix, "{ ", NULL, buf, maxlen); 509 295 /* Number of records stored in the index */ 510 - result = write_u64("entriesIndexed : ", stats->entries_indexed, ", ", buf, 511 - maxlen); 512 - if (result != VDO_SUCCESS) 513 - return result; 296 + write_u64("entriesIndexed : ", stats->entries_indexed, ", ", buf, maxlen); 514 297 /* Number of post calls that found an existing entry */ 515 - result = write_u64("postsFound : ", stats->posts_found, ", ", buf, maxlen); 516 - if (result != VDO_SUCCESS) 517 - return result; 298 + write_u64("postsFound : ", stats->posts_found, ", ", buf, maxlen); 518 299 /* Number of post calls that added a new entry */ 519 - result = write_u64("postsNotFound : ", stats->posts_not_found, ", ", buf, 520 - maxlen); 521 - if (result != VDO_SUCCESS) 522 - return result; 300 + write_u64("postsNotFound : ", stats->posts_not_found, ", ", buf, maxlen); 523 301 /* Number of query calls that found an existing entry */ 524 - result = write_u64("queriesFound : ", stats->queries_found, ", ", buf, maxlen); 525 - if (result != VDO_SUCCESS) 526 - return result; 302 + write_u64("queriesFound : ", stats->queries_found, ", ", buf, maxlen); 527 303 /* Number of query calls that added a new entry */ 528 - result = write_u64("queriesNotFound : ", stats->queries_not_found, ", ", buf, 529 - maxlen); 530 - if (result != VDO_SUCCESS) 531 - return result; 304 + write_u64("queriesNotFound : ", stats->queries_not_found, ", ", buf, maxlen); 532 305 /* Number of update calls that found an existing entry */ 533 - result = write_u64("updatesFound : ", stats->updates_found, ", ", buf, maxlen); 534 - if (result != VDO_SUCCESS) 535 - return result; 306 + write_u64("updatesFound : ", stats->updates_found, ", ", buf, maxlen); 536 307 /* Number of update calls that added a new entry */ 537 - result = write_u64("updatesNotFound : ", stats->updates_not_found, ", ", buf, 538 - maxlen); 539 - if (result != VDO_SUCCESS) 540 - return result; 308 + write_u64("updatesNotFound : ", stats->updates_not_found, ", ", buf, maxlen); 541 309 /* Number of entries discarded */ 542 - result = write_u64("entriesDiscarded : ", stats->entries_discarded, ", ", buf, 543 - maxlen); 544 - if (result != VDO_SUCCESS) 545 - return result; 546 - result = write_string(NULL, "}", suffix, buf, maxlen); 547 - if (result != VDO_SUCCESS) 548 - return result; 549 - return VDO_SUCCESS; 310 + write_u64("entriesDiscarded : ", stats->entries_discarded, ", ", buf, maxlen); 311 + write_string(NULL, "}", suffix, buf, maxlen); 550 312 } 551 313 552 - static int write_vdo_statistics(char *prefix, struct vdo_statistics *stats, char *suffix, 553 - char **buf, unsigned int *maxlen) 314 + static void write_vdo_statistics(char *prefix, struct vdo_statistics *stats, char *suffix, 315 + char **buf, unsigned int *maxlen) 554 316 { 555 - int result; 556 - 557 - result = write_string(prefix, "{ ", NULL, buf, maxlen); 558 - if (result != VDO_SUCCESS) 559 - return result; 560 - result = write_u32("version : ", stats->version, ", ", buf, maxlen); 561 - if (result != VDO_SUCCESS) 562 - return result; 317 + write_string(prefix, "{ ", NULL, buf, maxlen); 318 + write_u32("version : ", stats->version, ", ", buf, maxlen); 563 319 /* Number of blocks used for data */ 564 - result = write_u64("dataBlocksUsed : ", stats->data_blocks_used, ", ", buf, 565 - maxlen); 566 - if (result != VDO_SUCCESS) 567 - return result; 320 + write_u64("dataBlocksUsed : ", stats->data_blocks_used, ", ", buf, maxlen); 568 321 /* Number of blocks used for VDO metadata */ 569 - result = write_u64("overheadBlocksUsed : ", stats->overhead_blocks_used, ", ", 570 - buf, maxlen); 571 - if (result != VDO_SUCCESS) 572 - return result; 322 + write_u64("overheadBlocksUsed : ", stats->overhead_blocks_used, ", ", 323 + buf, maxlen); 573 324 /* Number of logical blocks that are currently mapped to physical blocks */ 574 - result = write_u64("logicalBlocksUsed : ", stats->logical_blocks_used, ", ", buf, 575 - maxlen); 576 - if (result != VDO_SUCCESS) 577 - return result; 325 + write_u64("logicalBlocksUsed : ", stats->logical_blocks_used, ", ", buf, maxlen); 578 326 /* number of physical blocks */ 579 - result = write_block_count_t("physicalBlocks : ", stats->physical_blocks, ", ", 580 - buf, maxlen); 581 - if (result != VDO_SUCCESS) 582 - return result; 327 + write_block_count_t("physicalBlocks : ", stats->physical_blocks, ", ", 328 + buf, maxlen); 583 329 /* number of logical blocks */ 584 - result = write_block_count_t("logicalBlocks : ", stats->logical_blocks, ", ", 585 - buf, maxlen); 586 - if (result != VDO_SUCCESS) 587 - return result; 330 + write_block_count_t("logicalBlocks : ", stats->logical_blocks, ", ", 331 + buf, maxlen); 588 332 /* Size of the block map page cache, in bytes */ 589 - result = write_u64("blockMapCacheSize : ", stats->block_map_cache_size, ", ", 590 - buf, maxlen); 591 - if (result != VDO_SUCCESS) 592 - return result; 333 + write_u64("blockMapCacheSize : ", stats->block_map_cache_size, ", ", 334 + buf, maxlen); 593 335 /* The physical block size */ 594 - result = write_u64("blockSize : ", stats->block_size, ", ", buf, maxlen); 595 - if (result != VDO_SUCCESS) 596 - return result; 336 + write_u64("blockSize : ", stats->block_size, ", ", buf, maxlen); 597 337 /* Number of times the VDO has successfully recovered */ 598 - result = write_u64("completeRecoveries : ", stats->complete_recoveries, ", ", 599 - buf, maxlen); 600 - if (result != VDO_SUCCESS) 601 - return result; 338 + write_u64("completeRecoveries : ", stats->complete_recoveries, ", ", 339 + buf, maxlen); 602 340 /* Number of times the VDO has recovered from read-only mode */ 603 - result = write_u64("readOnlyRecoveries : ", stats->read_only_recoveries, ", ", 604 - buf, maxlen); 605 - if (result != VDO_SUCCESS) 606 - return result; 341 + write_u64("readOnlyRecoveries : ", stats->read_only_recoveries, ", ", 342 + buf, maxlen); 607 343 /* String describing the operating mode of the VDO */ 608 - result = write_string("mode : ", stats->mode, ", ", buf, maxlen); 609 - if (result != VDO_SUCCESS) 610 - return result; 344 + write_string("mode : ", stats->mode, ", ", buf, maxlen); 611 345 /* Whether the VDO is in recovery mode */ 612 - result = write_bool("inRecoveryMode : ", stats->in_recovery_mode, ", ", buf, 613 - maxlen); 614 - if (result != VDO_SUCCESS) 615 - return result; 346 + write_bool("inRecoveryMode : ", stats->in_recovery_mode, ", ", buf, maxlen); 616 347 /* What percentage of recovery mode work has been completed */ 617 - result = write_u8("recoveryPercentage : ", stats->recovery_percentage, ", ", buf, 618 - maxlen); 619 - if (result != VDO_SUCCESS) 620 - return result; 348 + write_u8("recoveryPercentage : ", stats->recovery_percentage, ", ", buf, maxlen); 621 349 /* The statistics for the compressed block packer */ 622 - result = write_packer_statistics("packer : ", &stats->packer, ", ", buf, maxlen); 623 - if (result != VDO_SUCCESS) 624 - return result; 350 + write_packer_statistics("packer : ", &stats->packer, ", ", buf, maxlen); 625 351 /* Counters for events in the block allocator */ 626 - result = write_block_allocator_statistics("allocator : ", &stats->allocator, 627 - ", ", buf, maxlen); 628 - if (result != VDO_SUCCESS) 629 - return result; 352 + write_block_allocator_statistics("allocator : ", &stats->allocator, 353 + ", ", buf, maxlen); 630 354 /* Counters for events in the recovery journal */ 631 - result = write_recovery_journal_statistics("journal : ", &stats->journal, ", ", 632 - buf, maxlen); 633 - if (result != VDO_SUCCESS) 634 - return result; 355 + write_recovery_journal_statistics("journal : ", &stats->journal, ", ", 356 + buf, maxlen); 635 357 /* The statistics for the slab journals */ 636 - result = write_slab_journal_statistics("slabJournal : ", &stats->slab_journal, 637 - ", ", buf, maxlen); 638 - if (result != VDO_SUCCESS) 639 - return result; 358 + write_slab_journal_statistics("slabJournal : ", &stats->slab_journal, 359 + ", ", buf, maxlen); 640 360 /* The statistics for the slab summary */ 641 - result = write_slab_summary_statistics("slabSummary : ", &stats->slab_summary, 642 - ", ", buf, maxlen); 643 - if (result != VDO_SUCCESS) 644 - return result; 361 + write_slab_summary_statistics("slabSummary : ", &stats->slab_summary, 362 + ", ", buf, maxlen); 645 363 /* The statistics for the reference counts */ 646 - result = write_ref_counts_statistics("refCounts : ", &stats->ref_counts, ", ", 647 - buf, maxlen); 648 - if (result != VDO_SUCCESS) 649 - return result; 364 + write_ref_counts_statistics("refCounts : ", &stats->ref_counts, ", ", 365 + buf, maxlen); 650 366 /* The statistics for the block map */ 651 - result = write_block_map_statistics("blockMap : ", &stats->block_map, ", ", buf, 652 - maxlen); 653 - if (result != VDO_SUCCESS) 654 - return result; 367 + write_block_map_statistics("blockMap : ", &stats->block_map, ", ", buf, maxlen); 655 368 /* The dedupe statistics from hash locks */ 656 - result = write_hash_lock_statistics("hashLock : ", &stats->hash_lock, ", ", buf, 657 - maxlen); 658 - if (result != VDO_SUCCESS) 659 - return result; 369 + write_hash_lock_statistics("hashLock : ", &stats->hash_lock, ", ", buf, maxlen); 660 370 /* Counts of error conditions */ 661 - result = write_error_statistics("errors : ", &stats->errors, ", ", buf, maxlen); 662 - if (result != VDO_SUCCESS) 663 - return result; 371 + write_error_statistics("errors : ", &stats->errors, ", ", buf, maxlen); 664 372 /* The VDO instance */ 665 - result = write_u32("instance : ", stats->instance, ", ", buf, maxlen); 666 - if (result != VDO_SUCCESS) 667 - return result; 373 + write_u32("instance : ", stats->instance, ", ", buf, maxlen); 668 374 /* Current number of active VIOs */ 669 - result = write_u32("currentVIOsInProgress : ", stats->current_vios_in_progress, 670 - ", ", buf, maxlen); 671 - if (result != VDO_SUCCESS) 672 - return result; 375 + write_u32("currentVIOsInProgress : ", stats->current_vios_in_progress, 376 + ", ", buf, maxlen); 673 377 /* Maximum number of active VIOs */ 674 - result = write_u32("maxVIOs : ", stats->max_vios, ", ", buf, maxlen); 675 - if (result != VDO_SUCCESS) 676 - return result; 378 + write_u32("maxVIOs : ", stats->max_vios, ", ", buf, maxlen); 677 379 /* Number of times the UDS index was too slow in responding */ 678 - result = write_u64("dedupeAdviceTimeouts : ", stats->dedupe_advice_timeouts, 679 - ", ", buf, maxlen); 680 - if (result != VDO_SUCCESS) 681 - return result; 380 + write_u64("dedupeAdviceTimeouts : ", stats->dedupe_advice_timeouts, 381 + ", ", buf, maxlen); 682 382 /* Number of flush requests submitted to the storage device */ 683 - result = write_u64("flushOut : ", stats->flush_out, ", ", buf, maxlen); 684 - if (result != VDO_SUCCESS) 685 - return result; 383 + write_u64("flushOut : ", stats->flush_out, ", ", buf, maxlen); 686 384 /* Logical block size */ 687 - result = write_u64("logicalBlockSize : ", stats->logical_block_size, ", ", buf, 688 - maxlen); 689 - if (result != VDO_SUCCESS) 690 - return result; 385 + write_u64("logicalBlockSize : ", stats->logical_block_size, ", ", buf, maxlen); 691 386 /* Bios submitted into VDO from above */ 692 - result = write_bio_stats("biosIn : ", &stats->bios_in, ", ", buf, maxlen); 693 - if (result != VDO_SUCCESS) 694 - return result; 695 - result = write_bio_stats("biosInPartial : ", &stats->bios_in_partial, ", ", buf, 696 - maxlen); 697 - if (result != VDO_SUCCESS) 698 - return result; 387 + write_bio_stats("biosIn : ", &stats->bios_in, ", ", buf, maxlen); 388 + write_bio_stats("biosInPartial : ", &stats->bios_in_partial, ", ", buf, maxlen); 699 389 /* Bios submitted onward for user data */ 700 - result = write_bio_stats("biosOut : ", &stats->bios_out, ", ", buf, maxlen); 701 - if (result != VDO_SUCCESS) 702 - return result; 390 + write_bio_stats("biosOut : ", &stats->bios_out, ", ", buf, maxlen); 703 391 /* Bios submitted onward for metadata */ 704 - result = write_bio_stats("biosMeta : ", &stats->bios_meta, ", ", buf, maxlen); 705 - if (result != VDO_SUCCESS) 706 - return result; 707 - result = write_bio_stats("biosJournal : ", &stats->bios_journal, ", ", buf, 708 - maxlen); 709 - if (result != VDO_SUCCESS) 710 - return result; 711 - result = write_bio_stats("biosPageCache : ", &stats->bios_page_cache, ", ", buf, 712 - maxlen); 713 - if (result != VDO_SUCCESS) 714 - return result; 715 - result = write_bio_stats("biosOutCompleted : ", &stats->bios_out_completed, ", ", 716 - buf, maxlen); 717 - if (result != VDO_SUCCESS) 718 - return result; 719 - result = write_bio_stats("biosMetaCompleted : ", &stats->bios_meta_completed, 720 - ", ", buf, maxlen); 721 - if (result != VDO_SUCCESS) 722 - return result; 723 - result = write_bio_stats("biosJournalCompleted : ", 724 - &stats->bios_journal_completed, ", ", buf, maxlen); 725 - if (result != VDO_SUCCESS) 726 - return result; 727 - result = write_bio_stats("biosPageCacheCompleted : ", 728 - &stats->bios_page_cache_completed, ", ", buf, maxlen); 729 - if (result != VDO_SUCCESS) 730 - return result; 731 - result = write_bio_stats("biosAcknowledged : ", &stats->bios_acknowledged, ", ", 732 - buf, maxlen); 733 - if (result != VDO_SUCCESS) 734 - return result; 735 - result = write_bio_stats("biosAcknowledgedPartial : ", 736 - &stats->bios_acknowledged_partial, ", ", buf, maxlen); 737 - if (result != VDO_SUCCESS) 738 - return result; 392 + write_bio_stats("biosMeta : ", &stats->bios_meta, ", ", buf, maxlen); 393 + write_bio_stats("biosJournal : ", &stats->bios_journal, ", ", buf, maxlen); 394 + write_bio_stats("biosPageCache : ", &stats->bios_page_cache, ", ", buf, maxlen); 395 + write_bio_stats("biosOutCompleted : ", &stats->bios_out_completed, ", ", 396 + buf, maxlen); 397 + write_bio_stats("biosMetaCompleted : ", &stats->bios_meta_completed, 398 + ", ", buf, maxlen); 399 + write_bio_stats("biosJournalCompleted : ", 400 + &stats->bios_journal_completed, ", ", buf, maxlen); 401 + write_bio_stats("biosPageCacheCompleted : ", 402 + &stats->bios_page_cache_completed, ", ", buf, maxlen); 403 + write_bio_stats("biosAcknowledged : ", &stats->bios_acknowledged, ", ", 404 + buf, maxlen); 405 + write_bio_stats("biosAcknowledgedPartial : ", 406 + &stats->bios_acknowledged_partial, ", ", buf, maxlen); 739 407 /* Current number of bios in progress */ 740 - result = write_bio_stats("biosInProgress : ", &stats->bios_in_progress, ", ", 741 - buf, maxlen); 742 - if (result != VDO_SUCCESS) 743 - return result; 408 + write_bio_stats("biosInProgress : ", &stats->bios_in_progress, ", ", 409 + buf, maxlen); 744 410 /* Memory usage stats. */ 745 - result = write_memory_usage("memoryUsage : ", &stats->memory_usage, ", ", buf, 746 - maxlen); 747 - if (result != VDO_SUCCESS) 748 - return result; 411 + write_memory_usage("memoryUsage : ", &stats->memory_usage, ", ", buf, maxlen); 749 412 /* The statistics for the UDS index */ 750 - result = write_index_statistics("index : ", &stats->index, ", ", buf, maxlen); 751 - if (result != VDO_SUCCESS) 752 - return result; 753 - result = write_string(NULL, "}", suffix, buf, maxlen); 754 - if (result != VDO_SUCCESS) 755 - return result; 756 - return VDO_SUCCESS; 413 + write_index_statistics("index : ", &stats->index, ", ", buf, maxlen); 414 + write_string(NULL, "}", suffix, buf, maxlen); 757 415 } 758 416 759 417 int vdo_write_stats(struct vdo *vdo, char *buf, unsigned int maxlen) ··· 420 762 int result; 421 763 422 764 result = uds_allocate(1, struct vdo_statistics, __func__, &stats); 423 - if (result != VDO_SUCCESS) 765 + if (result != UDS_SUCCESS) { 766 + uds_log_error("Cannot allocate memory to write VDO statistics"); 424 767 return result; 768 + } 425 769 426 770 vdo_fetch_statistics(vdo, stats); 427 - result = write_vdo_statistics(NULL, stats, NULL, &buf, &maxlen); 771 + write_vdo_statistics(NULL, stats, NULL, &buf, &maxlen); 428 772 uds_free(stats); 429 - return result; 773 + return VDO_SUCCESS; 430 774 }