18c2ecf20Sopenharmony_ci// SPDX-License-Identifier: GPL-2.0-or-later
28c2ecf20Sopenharmony_ci/*
38c2ecf20Sopenharmony_ci   drbd_proc.c
48c2ecf20Sopenharmony_ci
58c2ecf20Sopenharmony_ci   This file is part of DRBD by Philipp Reisner and Lars Ellenberg.
68c2ecf20Sopenharmony_ci
78c2ecf20Sopenharmony_ci   Copyright (C) 2001-2008, LINBIT Information Technologies GmbH.
88c2ecf20Sopenharmony_ci   Copyright (C) 1999-2008, Philipp Reisner <philipp.reisner@linbit.com>.
98c2ecf20Sopenharmony_ci   Copyright (C) 2002-2008, Lars Ellenberg <lars.ellenberg@linbit.com>.
108c2ecf20Sopenharmony_ci
118c2ecf20Sopenharmony_ci
128c2ecf20Sopenharmony_ci */
138c2ecf20Sopenharmony_ci
148c2ecf20Sopenharmony_ci#include <linux/module.h>
158c2ecf20Sopenharmony_ci
168c2ecf20Sopenharmony_ci#include <linux/uaccess.h>
178c2ecf20Sopenharmony_ci#include <linux/fs.h>
188c2ecf20Sopenharmony_ci#include <linux/file.h>
198c2ecf20Sopenharmony_ci#include <linux/proc_fs.h>
208c2ecf20Sopenharmony_ci#include <linux/seq_file.h>
218c2ecf20Sopenharmony_ci#include <linux/drbd.h>
228c2ecf20Sopenharmony_ci#include "drbd_int.h"
238c2ecf20Sopenharmony_ci
248c2ecf20Sopenharmony_cistruct proc_dir_entry *drbd_proc;
258c2ecf20Sopenharmony_ci
268c2ecf20Sopenharmony_cistatic void seq_printf_with_thousands_grouping(struct seq_file *seq, long v)
278c2ecf20Sopenharmony_ci{
288c2ecf20Sopenharmony_ci	/* v is in kB/sec. We don't expect TiByte/sec yet. */
298c2ecf20Sopenharmony_ci	if (unlikely(v >= 1000000)) {
308c2ecf20Sopenharmony_ci		/* cool: > GiByte/s */
318c2ecf20Sopenharmony_ci		seq_printf(seq, "%ld,", v / 1000000);
328c2ecf20Sopenharmony_ci		v %= 1000000;
338c2ecf20Sopenharmony_ci		seq_printf(seq, "%03ld,%03ld", v/1000, v % 1000);
348c2ecf20Sopenharmony_ci	} else if (likely(v >= 1000))
358c2ecf20Sopenharmony_ci		seq_printf(seq, "%ld,%03ld", v/1000, v % 1000);
368c2ecf20Sopenharmony_ci	else
378c2ecf20Sopenharmony_ci		seq_printf(seq, "%ld", v);
388c2ecf20Sopenharmony_ci}
398c2ecf20Sopenharmony_ci
408c2ecf20Sopenharmony_cistatic void drbd_get_syncer_progress(struct drbd_device *device,
418c2ecf20Sopenharmony_ci		union drbd_dev_state state, unsigned long *rs_total,
428c2ecf20Sopenharmony_ci		unsigned long *bits_left, unsigned int *per_mil_done)
438c2ecf20Sopenharmony_ci{
448c2ecf20Sopenharmony_ci	/* this is to break it at compile time when we change that, in case we
458c2ecf20Sopenharmony_ci	 * want to support more than (1<<32) bits on a 32bit arch. */
468c2ecf20Sopenharmony_ci	typecheck(unsigned long, device->rs_total);
478c2ecf20Sopenharmony_ci	*rs_total = device->rs_total;
488c2ecf20Sopenharmony_ci
498c2ecf20Sopenharmony_ci	/* note: both rs_total and rs_left are in bits, i.e. in
508c2ecf20Sopenharmony_ci	 * units of BM_BLOCK_SIZE.
518c2ecf20Sopenharmony_ci	 * for the percentage, we don't care. */
528c2ecf20Sopenharmony_ci
538c2ecf20Sopenharmony_ci	if (state.conn == C_VERIFY_S || state.conn == C_VERIFY_T)
548c2ecf20Sopenharmony_ci		*bits_left = device->ov_left;
558c2ecf20Sopenharmony_ci	else
568c2ecf20Sopenharmony_ci		*bits_left = drbd_bm_total_weight(device) - device->rs_failed;
578c2ecf20Sopenharmony_ci	/* >> 10 to prevent overflow,
588c2ecf20Sopenharmony_ci	 * +1 to prevent division by zero */
598c2ecf20Sopenharmony_ci	if (*bits_left > *rs_total) {
608c2ecf20Sopenharmony_ci		/* D'oh. Maybe a logic bug somewhere.  More likely just a race
618c2ecf20Sopenharmony_ci		 * between state change and reset of rs_total.
628c2ecf20Sopenharmony_ci		 */
638c2ecf20Sopenharmony_ci		*bits_left = *rs_total;
648c2ecf20Sopenharmony_ci		*per_mil_done = *rs_total ? 0 : 1000;
658c2ecf20Sopenharmony_ci	} else {
668c2ecf20Sopenharmony_ci		/* Make sure the division happens in long context.
678c2ecf20Sopenharmony_ci		 * We allow up to one petabyte storage right now,
688c2ecf20Sopenharmony_ci		 * at a granularity of 4k per bit that is 2**38 bits.
698c2ecf20Sopenharmony_ci		 * After shift right and multiplication by 1000,
708c2ecf20Sopenharmony_ci		 * this should still fit easily into a 32bit long,
718c2ecf20Sopenharmony_ci		 * so we don't need a 64bit division on 32bit arch.
728c2ecf20Sopenharmony_ci		 * Note: currently we don't support such large bitmaps on 32bit
738c2ecf20Sopenharmony_ci		 * arch anyways, but no harm done to be prepared for it here.
748c2ecf20Sopenharmony_ci		 */
758c2ecf20Sopenharmony_ci		unsigned int shift = *rs_total > UINT_MAX ? 16 : 10;
768c2ecf20Sopenharmony_ci		unsigned long left = *bits_left >> shift;
778c2ecf20Sopenharmony_ci		unsigned long total = 1UL + (*rs_total >> shift);
788c2ecf20Sopenharmony_ci		unsigned long tmp = 1000UL - left * 1000UL/total;
798c2ecf20Sopenharmony_ci		*per_mil_done = tmp;
808c2ecf20Sopenharmony_ci	}
818c2ecf20Sopenharmony_ci}
828c2ecf20Sopenharmony_ci
838c2ecf20Sopenharmony_ci
848c2ecf20Sopenharmony_ci/*lge
858c2ecf20Sopenharmony_ci * progress bars shamelessly adapted from driver/md/md.c
868c2ecf20Sopenharmony_ci * output looks like
878c2ecf20Sopenharmony_ci *	[=====>..............] 33.5% (23456/123456)
888c2ecf20Sopenharmony_ci *	finish: 2:20:20 speed: 6,345 (6,456) K/sec
898c2ecf20Sopenharmony_ci */
908c2ecf20Sopenharmony_cistatic void drbd_syncer_progress(struct drbd_device *device, struct seq_file *seq,
918c2ecf20Sopenharmony_ci		union drbd_dev_state state)
928c2ecf20Sopenharmony_ci{
938c2ecf20Sopenharmony_ci	unsigned long db, dt, dbdt, rt, rs_total, rs_left;
948c2ecf20Sopenharmony_ci	unsigned int res;
958c2ecf20Sopenharmony_ci	int i, x, y;
968c2ecf20Sopenharmony_ci	int stalled = 0;
978c2ecf20Sopenharmony_ci
988c2ecf20Sopenharmony_ci	drbd_get_syncer_progress(device, state, &rs_total, &rs_left, &res);
998c2ecf20Sopenharmony_ci
1008c2ecf20Sopenharmony_ci	x = res/50;
1018c2ecf20Sopenharmony_ci	y = 20-x;
1028c2ecf20Sopenharmony_ci	seq_puts(seq, "\t[");
1038c2ecf20Sopenharmony_ci	for (i = 1; i < x; i++)
1048c2ecf20Sopenharmony_ci		seq_putc(seq, '=');
1058c2ecf20Sopenharmony_ci	seq_putc(seq, '>');
1068c2ecf20Sopenharmony_ci	for (i = 0; i < y; i++)
1078c2ecf20Sopenharmony_ci		seq_putc(seq, '.');
1088c2ecf20Sopenharmony_ci	seq_puts(seq, "] ");
1098c2ecf20Sopenharmony_ci
1108c2ecf20Sopenharmony_ci	if (state.conn == C_VERIFY_S || state.conn == C_VERIFY_T)
1118c2ecf20Sopenharmony_ci		seq_puts(seq, "verified:");
1128c2ecf20Sopenharmony_ci	else
1138c2ecf20Sopenharmony_ci		seq_puts(seq, "sync'ed:");
1148c2ecf20Sopenharmony_ci	seq_printf(seq, "%3u.%u%% ", res / 10, res % 10);
1158c2ecf20Sopenharmony_ci
1168c2ecf20Sopenharmony_ci	/* if more than a few GB, display in MB */
1178c2ecf20Sopenharmony_ci	if (rs_total > (4UL << (30 - BM_BLOCK_SHIFT)))
1188c2ecf20Sopenharmony_ci		seq_printf(seq, "(%lu/%lu)M",
1198c2ecf20Sopenharmony_ci			    (unsigned long) Bit2KB(rs_left >> 10),
1208c2ecf20Sopenharmony_ci			    (unsigned long) Bit2KB(rs_total >> 10));
1218c2ecf20Sopenharmony_ci	else
1228c2ecf20Sopenharmony_ci		seq_printf(seq, "(%lu/%lu)K",
1238c2ecf20Sopenharmony_ci			    (unsigned long) Bit2KB(rs_left),
1248c2ecf20Sopenharmony_ci			    (unsigned long) Bit2KB(rs_total));
1258c2ecf20Sopenharmony_ci
1268c2ecf20Sopenharmony_ci	seq_puts(seq, "\n\t");
1278c2ecf20Sopenharmony_ci
1288c2ecf20Sopenharmony_ci	/* see drivers/md/md.c
1298c2ecf20Sopenharmony_ci	 * We do not want to overflow, so the order of operands and
1308c2ecf20Sopenharmony_ci	 * the * 100 / 100 trick are important. We do a +1 to be
1318c2ecf20Sopenharmony_ci	 * safe against division by zero. We only estimate anyway.
1328c2ecf20Sopenharmony_ci	 *
1338c2ecf20Sopenharmony_ci	 * dt: time from mark until now
1348c2ecf20Sopenharmony_ci	 * db: blocks written from mark until now
1358c2ecf20Sopenharmony_ci	 * rt: remaining time
1368c2ecf20Sopenharmony_ci	 */
1378c2ecf20Sopenharmony_ci	/* Rolling marks. last_mark+1 may just now be modified.  last_mark+2 is
1388c2ecf20Sopenharmony_ci	 * at least (DRBD_SYNC_MARKS-2)*DRBD_SYNC_MARK_STEP old, and has at
1398c2ecf20Sopenharmony_ci	 * least DRBD_SYNC_MARK_STEP time before it will be modified. */
1408c2ecf20Sopenharmony_ci	/* ------------------------ ~18s average ------------------------ */
1418c2ecf20Sopenharmony_ci	i = (device->rs_last_mark + 2) % DRBD_SYNC_MARKS;
1428c2ecf20Sopenharmony_ci	dt = (jiffies - device->rs_mark_time[i]) / HZ;
1438c2ecf20Sopenharmony_ci	if (dt > 180)
1448c2ecf20Sopenharmony_ci		stalled = 1;
1458c2ecf20Sopenharmony_ci
1468c2ecf20Sopenharmony_ci	if (!dt)
1478c2ecf20Sopenharmony_ci		dt++;
1488c2ecf20Sopenharmony_ci	db = device->rs_mark_left[i] - rs_left;
1498c2ecf20Sopenharmony_ci	rt = (dt * (rs_left / (db/100+1)))/100; /* seconds */
1508c2ecf20Sopenharmony_ci
1518c2ecf20Sopenharmony_ci	seq_printf(seq, "finish: %lu:%02lu:%02lu",
1528c2ecf20Sopenharmony_ci		rt / 3600, (rt % 3600) / 60, rt % 60);
1538c2ecf20Sopenharmony_ci
1548c2ecf20Sopenharmony_ci	dbdt = Bit2KB(db/dt);
1558c2ecf20Sopenharmony_ci	seq_puts(seq, " speed: ");
1568c2ecf20Sopenharmony_ci	seq_printf_with_thousands_grouping(seq, dbdt);
1578c2ecf20Sopenharmony_ci	seq_puts(seq, " (");
1588c2ecf20Sopenharmony_ci	/* ------------------------- ~3s average ------------------------ */
1598c2ecf20Sopenharmony_ci	if (drbd_proc_details >= 1) {
1608c2ecf20Sopenharmony_ci		/* this is what drbd_rs_should_slow_down() uses */
1618c2ecf20Sopenharmony_ci		i = (device->rs_last_mark + DRBD_SYNC_MARKS-1) % DRBD_SYNC_MARKS;
1628c2ecf20Sopenharmony_ci		dt = (jiffies - device->rs_mark_time[i]) / HZ;
1638c2ecf20Sopenharmony_ci		if (!dt)
1648c2ecf20Sopenharmony_ci			dt++;
1658c2ecf20Sopenharmony_ci		db = device->rs_mark_left[i] - rs_left;
1668c2ecf20Sopenharmony_ci		dbdt = Bit2KB(db/dt);
1678c2ecf20Sopenharmony_ci		seq_printf_with_thousands_grouping(seq, dbdt);
1688c2ecf20Sopenharmony_ci		seq_puts(seq, " -- ");
1698c2ecf20Sopenharmony_ci	}
1708c2ecf20Sopenharmony_ci
1718c2ecf20Sopenharmony_ci	/* --------------------- long term average ---------------------- */
1728c2ecf20Sopenharmony_ci	/* mean speed since syncer started
1738c2ecf20Sopenharmony_ci	 * we do account for PausedSync periods */
1748c2ecf20Sopenharmony_ci	dt = (jiffies - device->rs_start - device->rs_paused) / HZ;
1758c2ecf20Sopenharmony_ci	if (dt == 0)
1768c2ecf20Sopenharmony_ci		dt = 1;
1778c2ecf20Sopenharmony_ci	db = rs_total - rs_left;
1788c2ecf20Sopenharmony_ci	dbdt = Bit2KB(db/dt);
1798c2ecf20Sopenharmony_ci	seq_printf_with_thousands_grouping(seq, dbdt);
1808c2ecf20Sopenharmony_ci	seq_putc(seq, ')');
1818c2ecf20Sopenharmony_ci
1828c2ecf20Sopenharmony_ci	if (state.conn == C_SYNC_TARGET ||
1838c2ecf20Sopenharmony_ci	    state.conn == C_VERIFY_S) {
1848c2ecf20Sopenharmony_ci		seq_puts(seq, " want: ");
1858c2ecf20Sopenharmony_ci		seq_printf_with_thousands_grouping(seq, device->c_sync_rate);
1868c2ecf20Sopenharmony_ci	}
1878c2ecf20Sopenharmony_ci	seq_printf(seq, " K/sec%s\n", stalled ? " (stalled)" : "");
1888c2ecf20Sopenharmony_ci
1898c2ecf20Sopenharmony_ci	if (drbd_proc_details >= 1) {
1908c2ecf20Sopenharmony_ci		/* 64 bit:
1918c2ecf20Sopenharmony_ci		 * we convert to sectors in the display below. */
1928c2ecf20Sopenharmony_ci		unsigned long bm_bits = drbd_bm_bits(device);
1938c2ecf20Sopenharmony_ci		unsigned long bit_pos;
1948c2ecf20Sopenharmony_ci		unsigned long long stop_sector = 0;
1958c2ecf20Sopenharmony_ci		if (state.conn == C_VERIFY_S ||
1968c2ecf20Sopenharmony_ci		    state.conn == C_VERIFY_T) {
1978c2ecf20Sopenharmony_ci			bit_pos = bm_bits - device->ov_left;
1988c2ecf20Sopenharmony_ci			if (verify_can_do_stop_sector(device))
1998c2ecf20Sopenharmony_ci				stop_sector = device->ov_stop_sector;
2008c2ecf20Sopenharmony_ci		} else
2018c2ecf20Sopenharmony_ci			bit_pos = device->bm_resync_fo;
2028c2ecf20Sopenharmony_ci		/* Total sectors may be slightly off for oddly
2038c2ecf20Sopenharmony_ci		 * sized devices. So what. */
2048c2ecf20Sopenharmony_ci		seq_printf(seq,
2058c2ecf20Sopenharmony_ci			"\t%3d%% sector pos: %llu/%llu",
2068c2ecf20Sopenharmony_ci			(int)(bit_pos / (bm_bits/100+1)),
2078c2ecf20Sopenharmony_ci			(unsigned long long)bit_pos * BM_SECT_PER_BIT,
2088c2ecf20Sopenharmony_ci			(unsigned long long)bm_bits * BM_SECT_PER_BIT);
2098c2ecf20Sopenharmony_ci		if (stop_sector != 0 && stop_sector != ULLONG_MAX)
2108c2ecf20Sopenharmony_ci			seq_printf(seq, " stop sector: %llu", stop_sector);
2118c2ecf20Sopenharmony_ci		seq_putc(seq, '\n');
2128c2ecf20Sopenharmony_ci	}
2138c2ecf20Sopenharmony_ci}
2148c2ecf20Sopenharmony_ci
2158c2ecf20Sopenharmony_ciint drbd_seq_show(struct seq_file *seq, void *v)
2168c2ecf20Sopenharmony_ci{
2178c2ecf20Sopenharmony_ci	int i, prev_i = -1;
2188c2ecf20Sopenharmony_ci	const char *sn;
2198c2ecf20Sopenharmony_ci	struct drbd_device *device;
2208c2ecf20Sopenharmony_ci	struct net_conf *nc;
2218c2ecf20Sopenharmony_ci	union drbd_dev_state state;
2228c2ecf20Sopenharmony_ci	char wp;
2238c2ecf20Sopenharmony_ci
2248c2ecf20Sopenharmony_ci	static char write_ordering_chars[] = {
2258c2ecf20Sopenharmony_ci		[WO_NONE] = 'n',
2268c2ecf20Sopenharmony_ci		[WO_DRAIN_IO] = 'd',
2278c2ecf20Sopenharmony_ci		[WO_BDEV_FLUSH] = 'f',
2288c2ecf20Sopenharmony_ci	};
2298c2ecf20Sopenharmony_ci
2308c2ecf20Sopenharmony_ci	seq_printf(seq, "version: " REL_VERSION " (api:%d/proto:%d-%d)\n%s\n",
2318c2ecf20Sopenharmony_ci		   API_VERSION, PRO_VERSION_MIN, PRO_VERSION_MAX, drbd_buildtag());
2328c2ecf20Sopenharmony_ci
2338c2ecf20Sopenharmony_ci	/*
2348c2ecf20Sopenharmony_ci	  cs .. connection state
2358c2ecf20Sopenharmony_ci	  ro .. node role (local/remote)
2368c2ecf20Sopenharmony_ci	  ds .. disk state (local/remote)
2378c2ecf20Sopenharmony_ci	     protocol
2388c2ecf20Sopenharmony_ci	     various flags
2398c2ecf20Sopenharmony_ci	  ns .. network send
2408c2ecf20Sopenharmony_ci	  nr .. network receive
2418c2ecf20Sopenharmony_ci	  dw .. disk write
2428c2ecf20Sopenharmony_ci	  dr .. disk read
2438c2ecf20Sopenharmony_ci	  al .. activity log write count
2448c2ecf20Sopenharmony_ci	  bm .. bitmap update write count
2458c2ecf20Sopenharmony_ci	  pe .. pending (waiting for ack or data reply)
2468c2ecf20Sopenharmony_ci	  ua .. unack'd (still need to send ack or data reply)
2478c2ecf20Sopenharmony_ci	  ap .. application requests accepted, but not yet completed
2488c2ecf20Sopenharmony_ci	  ep .. number of epochs currently "on the fly", P_BARRIER_ACK pending
2498c2ecf20Sopenharmony_ci	  wo .. write ordering mode currently in use
2508c2ecf20Sopenharmony_ci	 oos .. known out-of-sync kB
2518c2ecf20Sopenharmony_ci	*/
2528c2ecf20Sopenharmony_ci
2538c2ecf20Sopenharmony_ci	rcu_read_lock();
2548c2ecf20Sopenharmony_ci	idr_for_each_entry(&drbd_devices, device, i) {
2558c2ecf20Sopenharmony_ci		if (prev_i != i - 1)
2568c2ecf20Sopenharmony_ci			seq_putc(seq, '\n');
2578c2ecf20Sopenharmony_ci		prev_i = i;
2588c2ecf20Sopenharmony_ci
2598c2ecf20Sopenharmony_ci		state = device->state;
2608c2ecf20Sopenharmony_ci		sn = drbd_conn_str(state.conn);
2618c2ecf20Sopenharmony_ci
2628c2ecf20Sopenharmony_ci		if (state.conn == C_STANDALONE &&
2638c2ecf20Sopenharmony_ci		    state.disk == D_DISKLESS &&
2648c2ecf20Sopenharmony_ci		    state.role == R_SECONDARY) {
2658c2ecf20Sopenharmony_ci			seq_printf(seq, "%2d: cs:Unconfigured\n", i);
2668c2ecf20Sopenharmony_ci		} else {
2678c2ecf20Sopenharmony_ci			/* reset device->congestion_reason */
2688c2ecf20Sopenharmony_ci
2698c2ecf20Sopenharmony_ci			nc = rcu_dereference(first_peer_device(device)->connection->net_conf);
2708c2ecf20Sopenharmony_ci			wp = nc ? nc->wire_protocol - DRBD_PROT_A + 'A' : ' ';
2718c2ecf20Sopenharmony_ci			seq_printf(seq,
2728c2ecf20Sopenharmony_ci			   "%2d: cs:%s ro:%s/%s ds:%s/%s %c %c%c%c%c%c%c\n"
2738c2ecf20Sopenharmony_ci			   "    ns:%u nr:%u dw:%u dr:%u al:%u bm:%u "
2748c2ecf20Sopenharmony_ci			   "lo:%d pe:%d ua:%d ap:%d ep:%d wo:%c",
2758c2ecf20Sopenharmony_ci			   i, sn,
2768c2ecf20Sopenharmony_ci			   drbd_role_str(state.role),
2778c2ecf20Sopenharmony_ci			   drbd_role_str(state.peer),
2788c2ecf20Sopenharmony_ci			   drbd_disk_str(state.disk),
2798c2ecf20Sopenharmony_ci			   drbd_disk_str(state.pdsk),
2808c2ecf20Sopenharmony_ci			   wp,
2818c2ecf20Sopenharmony_ci			   drbd_suspended(device) ? 's' : 'r',
2828c2ecf20Sopenharmony_ci			   state.aftr_isp ? 'a' : '-',
2838c2ecf20Sopenharmony_ci			   state.peer_isp ? 'p' : '-',
2848c2ecf20Sopenharmony_ci			   state.user_isp ? 'u' : '-',
2858c2ecf20Sopenharmony_ci			   device->congestion_reason ?: '-',
2868c2ecf20Sopenharmony_ci			   test_bit(AL_SUSPENDED, &device->flags) ? 's' : '-',
2878c2ecf20Sopenharmony_ci			   device->send_cnt/2,
2888c2ecf20Sopenharmony_ci			   device->recv_cnt/2,
2898c2ecf20Sopenharmony_ci			   device->writ_cnt/2,
2908c2ecf20Sopenharmony_ci			   device->read_cnt/2,
2918c2ecf20Sopenharmony_ci			   device->al_writ_cnt,
2928c2ecf20Sopenharmony_ci			   device->bm_writ_cnt,
2938c2ecf20Sopenharmony_ci			   atomic_read(&device->local_cnt),
2948c2ecf20Sopenharmony_ci			   atomic_read(&device->ap_pending_cnt) +
2958c2ecf20Sopenharmony_ci			   atomic_read(&device->rs_pending_cnt),
2968c2ecf20Sopenharmony_ci			   atomic_read(&device->unacked_cnt),
2978c2ecf20Sopenharmony_ci			   atomic_read(&device->ap_bio_cnt),
2988c2ecf20Sopenharmony_ci			   first_peer_device(device)->connection->epochs,
2998c2ecf20Sopenharmony_ci			   write_ordering_chars[device->resource->write_ordering]
3008c2ecf20Sopenharmony_ci			);
3018c2ecf20Sopenharmony_ci			seq_printf(seq, " oos:%llu\n",
3028c2ecf20Sopenharmony_ci				   Bit2KB((unsigned long long)
3038c2ecf20Sopenharmony_ci					   drbd_bm_total_weight(device)));
3048c2ecf20Sopenharmony_ci		}
3058c2ecf20Sopenharmony_ci		if (state.conn == C_SYNC_SOURCE ||
3068c2ecf20Sopenharmony_ci		    state.conn == C_SYNC_TARGET ||
3078c2ecf20Sopenharmony_ci		    state.conn == C_VERIFY_S ||
3088c2ecf20Sopenharmony_ci		    state.conn == C_VERIFY_T)
3098c2ecf20Sopenharmony_ci			drbd_syncer_progress(device, seq, state);
3108c2ecf20Sopenharmony_ci
3118c2ecf20Sopenharmony_ci		if (drbd_proc_details >= 1 && get_ldev_if_state(device, D_FAILED)) {
3128c2ecf20Sopenharmony_ci			lc_seq_printf_stats(seq, device->resync);
3138c2ecf20Sopenharmony_ci			lc_seq_printf_stats(seq, device->act_log);
3148c2ecf20Sopenharmony_ci			put_ldev(device);
3158c2ecf20Sopenharmony_ci		}
3168c2ecf20Sopenharmony_ci
3178c2ecf20Sopenharmony_ci		if (drbd_proc_details >= 2)
3188c2ecf20Sopenharmony_ci			seq_printf(seq, "\tblocked on activity log: %d\n", atomic_read(&device->ap_actlog_cnt));
3198c2ecf20Sopenharmony_ci	}
3208c2ecf20Sopenharmony_ci	rcu_read_unlock();
3218c2ecf20Sopenharmony_ci
3228c2ecf20Sopenharmony_ci	return 0;
3238c2ecf20Sopenharmony_ci}
324