Changeset 271 for ksyslog/trunk/ksyslog.h
- Timestamp:
- 05/16/14 00:29:33 (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
ksyslog/trunk/ksyslog.h
r250 r271 73 73 74 74 struct ksyslog_stats { 75 u64 write_bytes; 76 u64 write_packets; 77 u64 drop_bytes; 78 u64 drop_packets; 79 u64 discard_bytes; 80 u64 discard_packets; 81 struct u64_stats_sync sync; 75 atomic64_t bytes; 76 atomic64_t packets; 82 77 }; 83 78 84 79 struct ksyslog_queue { 85 80 struct list_head head; 81 struct work_struct work; 86 82 spinlock_t lock; 87 83 atomic64_t size; 88 struct ksyslog_stats __percpu *stats; 84 struct ksyslog_stats write_stats; 85 struct ksyslog_stats drop_stats; 86 struct ksyslog_stats discard_stats; 89 87 }; 90 88 91 89 static inline void 92 ksyslog_stats_ add_write(struct ksyslog_queue *queue, unsigned int len)90 ksyslog_stats_zero(struct ksyslog_stats *stats) 93 91 { 94 struct ksyslog_stats *stats; 95 96 stats = per_cpu_ptr(queue->stats, smp_processor_id()); 97 u64_stats_update_begin(&stats->sync); 98 stats->write_bytes += len; 99 stats->write_packets++; 100 u64_stats_update_end(&stats->sync); 92 atomic64_set(&stats->bytes, 0); 93 atomic64_set(&stats->packets, 0); 101 94 } 102 95 103 96 static inline void 104 ksyslog_stats_add _drop(struct ksyslog_queue *queue, unsigned int len)97 ksyslog_stats_add(struct ksyslog_stats *stats, unsigned int len) 105 98 { 106 struct ksyslog_stats *stats; 107 108 stats = per_cpu_ptr(queue->stats, smp_processor_id()); 109 u64_stats_update_begin(&stats->sync); 110 stats->drop_bytes += len; 111 stats->drop_packets++; 112 u64_stats_update_end(&stats->sync); 113 } 114 115 static inline void 116 ksyslog_stats_add_discard(struct ksyslog_queue *queue, unsigned int len) 117 { 118 struct ksyslog_stats *stats; 119 120 stats = per_cpu_ptr(queue->stats, smp_processor_id()); 121 u64_stats_update_begin(&stats->sync); 122 stats->discard_bytes += len; 123 stats->discard_packets++; 124 u64_stats_update_end(&stats->sync); 99 atomic64_add(len, &stats->bytes); 100 atomic64_inc(&stats->packets); 125 101 } 126 102
Note: See TracChangeset
for help on using the changeset viewer.