Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1278991
| From | Fabian Frederick <fabf@skynet.be> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH 03/21] drbd: use seq_put instead of seq_print where possible |
| Date | 2015-11-27 22:30 +0100 |
| Message-ID | <qzyKD-89k-35@gated-at.bofh.it> (permalink) |
| References | <qzyKC-89k-3@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
seq_putc/seq_puts give the following improvements:
text data bss dec hex filename
4661 0 8 4669 123d drivers/block/drbd/drbd_proc.o
4603 0 8 4611 1203 drivers/block/drbd/drbd_proc-after.o
Signed-off-by: Fabian Frederick <fabf@skynet.be>
---
drivers/block/drbd/drbd_proc.c | 28 ++++++++++++++--------------
1 file changed, 14 insertions(+), 14 deletions(-)
diff --git a/drivers/block/drbd/drbd_proc.c b/drivers/block/drbd/drbd_proc.c
index 6537b25..233a710 100644
--- a/drivers/block/drbd/drbd_proc.c
+++ b/drivers/block/drbd/drbd_proc.c
@@ -122,18 +122,18 @@ static void drbd_syncer_progress(struct drbd_device *device, struct seq_file *se
x = res/50;
y = 20-x;
- seq_printf(seq, "\t[");
+ seq_puts(seq, "\t[");
for (i = 1; i < x; i++)
- seq_printf(seq, "=");
- seq_printf(seq, ">");
+ seq_putc(seq, '=');
+ seq_putc(seq, '>');
for (i = 0; i < y; i++)
seq_printf(seq, ".");
- seq_printf(seq, "] ");
+ seq_puts(seq, "] ");
if (state.conn == C_VERIFY_S || state.conn == C_VERIFY_T)
- seq_printf(seq, "verified:");
+ seq_puts(seq, "verified:");
else
- seq_printf(seq, "sync'ed:");
+ seq_puts(seq, "sync'ed:");
seq_printf(seq, "%3u.%u%% ", res / 10, res % 10);
/* if more than a few GB, display in MB */
@@ -146,7 +146,7 @@ static void drbd_syncer_progress(struct drbd_device *device, struct seq_file *se
(unsigned long) Bit2KB(rs_left),
(unsigned long) Bit2KB(rs_total));
- seq_printf(seq, "\n\t");
+ seq_puts(seq, "\n\t");
/* see drivers/md/md.c
* We do not want to overflow, so the order of operands and
@@ -175,9 +175,9 @@ static void drbd_syncer_progress(struct drbd_device *device, struct seq_file *se
rt / 3600, (rt % 3600) / 60, rt % 60);
dbdt = Bit2KB(db/dt);
- seq_printf(seq, " speed: ");
+ seq_puts(seq, " speed: ");
seq_printf_with_thousands_grouping(seq, dbdt);
- seq_printf(seq, " (");
+ seq_puts(seq, " (");
/* ------------------------- ~3s average ------------------------ */
if (proc_details >= 1) {
/* this is what drbd_rs_should_slow_down() uses */
@@ -188,7 +188,7 @@ static void drbd_syncer_progress(struct drbd_device *device, struct seq_file *se
db = device->rs_mark_left[i] - rs_left;
dbdt = Bit2KB(db/dt);
seq_printf_with_thousands_grouping(seq, dbdt);
- seq_printf(seq, " -- ");
+ seq_puts(seq, " -- ");
}
/* --------------------- long term average ---------------------- */
@@ -200,11 +200,11 @@ static void drbd_syncer_progress(struct drbd_device *device, struct seq_file *se
db = rs_total - rs_left;
dbdt = Bit2KB(db/dt);
seq_printf_with_thousands_grouping(seq, dbdt);
- seq_printf(seq, ")");
+ seq_putc(seq, ')');
if (state.conn == C_SYNC_TARGET ||
state.conn == C_VERIFY_S) {
- seq_printf(seq, " want: ");
+ seq_puts(seq, " want: ");
seq_printf_with_thousands_grouping(seq, device->c_sync_rate);
}
seq_printf(seq, " K/sec%s\n", stalled ? " (stalled)" : "");
@@ -231,7 +231,7 @@ static void drbd_syncer_progress(struct drbd_device *device, struct seq_file *se
(unsigned long long)bm_bits * BM_SECT_PER_BIT);
if (stop_sector != 0 && stop_sector != ULLONG_MAX)
seq_printf(seq, " stop sector: %llu", stop_sector);
- seq_printf(seq, "\n");
+ seq_putc(seq, '\n');
}
}
@@ -276,7 +276,7 @@ static int drbd_seq_show(struct seq_file *seq, void *v)
rcu_read_lock();
idr_for_each_entry(&drbd_devices, device, i) {
if (prev_i != i - 1)
- seq_printf(seq, "\n");
+ seq_putc(seq, '\n');
prev_i = i;
state = device->state;
--
2.1.4
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH 00/21] drbd: clean-up patchset Fabian Frederick <fabf@skynet.be> - 2015-11-27 22:30 +0100
[PATCH 02/21] drbd: simplify drbd_md_set_sector_offsets() Fabian Frederick <fabf@skynet.be> - 2015-11-27 22:30 +0100
[PATCH 01/21] drbd: debugfs: constify drbd_version_fops Fabian Frederick <fabf@skynet.be> - 2015-11-27 22:30 +0100
[PATCH 06/21] drbd: use const char * const for drbd strings Fabian Frederick <fabf@skynet.be> - 2015-11-27 22:30 +0100
[PATCH 11/21] drbd: use | for bitmask combination Fabian Frederick <fabf@skynet.be> - 2015-11-27 22:30 +0100
[PATCH 10/21] drbd: fix typo Fabian Frederick <fabf@skynet.be> - 2015-11-27 22:30 +0100
[PATCH 17/21] drbd: use bool for growing Fabian Frederick <fabf@skynet.be> - 2015-11-27 22:40 +0100
[PATCH 13/21] drbd: fix drbd_bm_init() comments Fabian Frederick <fabf@skynet.be> - 2015-11-27 22:40 +0100
[PATCH 18/21] drbd: remove redundant declarations Fabian Frederick <fabf@skynet.be> - 2015-11-27 22:40 +0100
[PATCH 14/21] drbd: clean-up receive_SyncParam() Fabian Frederick <fabf@skynet.be> - 2015-11-27 22:40 +0100
[PATCH 15/21] drbd: introduce peer state union Fabian Frederick <fabf@skynet.be> - 2015-11-27 22:40 +0100
[PATCH 12/21] drbd: use true/false for bool Fabian Frederick <fabf@skynet.be> - 2015-11-27 22:40 +0100
[PATCH 19/21] drbd: remove bm_vk_free() Fabian Frederick <fabf@skynet.be> - 2015-11-27 22:40 +0100
[PATCH 16/21] drbd: fix maybe_pull_ahead() locking comments Fabian Frederick <fabf@skynet.be> - 2015-11-27 22:40 +0100
[PATCH 09/21] drbd: use bool for peer is_ states Fabian Frederick <fabf@skynet.be> - 2015-11-27 22:30 +0100
[PATCH 03/21] drbd: use seq_put instead of seq_print where possible Fabian Frederick <fabf@skynet.be> - 2015-11-27 22:30 +0100
[PATCH 05/21] drbd: rework is_valid_state() Fabian Frederick <fabf@skynet.be> - 2015-11-27 22:30 +0100
[PATCH 07/21] drbd: kerneldoc warning fix in w_e_end_data_req() Fabian Frederick <fabf@skynet.be> - 2015-11-27 22:30 +0100
[PATCH 21/21] drbd: replace if/BUG by BUG_ON Fabian Frederick <fabf@skynet.be> - 2015-11-27 22:40 +0100
[PATCH 20/21] drbd: remove unused definitions Fabian Frederick <fabf@skynet.be> - 2015-11-27 22:40 +0100
csiph-web