mirror of
https://github.com/torvalds/linux
synced 2024-10-18 17:29:25 +00:00
8d394bc4ad
DM handles a flush with data by first issuing an empty flush and then once it completes the REQ_PREFLUSH flag is removed and the payload is issued. The problem fixed by this commit is that both the empty flush bio and the data payload will account the full extent of the data payload. Fix this by factoring out dm_io_acct() and having it wrap all IO accounting to set the size of bio with REQ_PREFLUSH to 0, account the IO, and then restore the original size. Cc: stable@vger.kernel.org Signed-off-by: Mike Snitzer <snitzer@redhat.com>
44 lines
982 B
C
44 lines
982 B
C
/* SPDX-License-Identifier: GPL-2.0 */
|
|
#ifndef DM_STATS_H
|
|
#define DM_STATS_H
|
|
|
|
#include <linux/types.h>
|
|
#include <linux/mutex.h>
|
|
#include <linux/list.h>
|
|
|
|
int dm_statistics_init(void);
|
|
void dm_statistics_exit(void);
|
|
|
|
struct dm_stats {
|
|
struct mutex mutex;
|
|
struct list_head list; /* list of struct dm_stat */
|
|
struct dm_stats_last_position __percpu *last;
|
|
sector_t last_sector;
|
|
unsigned last_rw;
|
|
};
|
|
|
|
struct dm_stats_aux {
|
|
bool merged;
|
|
unsigned long long duration_ns;
|
|
};
|
|
|
|
void dm_stats_init(struct dm_stats *st);
|
|
void dm_stats_cleanup(struct dm_stats *st);
|
|
|
|
struct mapped_device;
|
|
|
|
int dm_stats_message(struct mapped_device *md, unsigned argc, char **argv,
|
|
char *result, unsigned maxlen);
|
|
|
|
void dm_stats_account_io(struct dm_stats *stats, unsigned long bi_rw,
|
|
sector_t bi_sector, unsigned bi_sectors, bool end,
|
|
unsigned long start_time,
|
|
struct dm_stats_aux *aux);
|
|
|
|
static inline bool dm_stats_used(struct dm_stats *st)
|
|
{
|
|
return !list_empty(&st->list);
|
|
}
|
|
|
|
#endif
|