Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 170a6b23 authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "mm: page_io: Rate limit swap read/write errors"

parents 4dbd0c95 6249f92f
Loading
Loading
Loading
Loading
+8 −2
Original line number Diff line number Diff line
@@ -22,8 +22,12 @@
#include <linux/frontswap.h>
#include <linux/aio.h>
#include <linux/blkdev.h>
#include <linux/ratelimit.h>
#include <asm/pgtable.h>

#define ERROR_LOG_RATE_MS 1000
static unsigned long error_time;

static struct bio *get_swap_bio(gfp_t gfp_flags,
				struct page *page, bio_end_io_t end_io)
{
@@ -59,7 +63,8 @@ void end_swap_bio_write(struct bio *bio, int err)
		 * Also clear PG_reclaim to avoid rotate_reclaimable_page()
		 */
		set_page_dirty(page);
		printk(KERN_ALERT "Write-error on swap-device (%u:%u:%Lu)\n",
		if (printk_timed_ratelimit(&error_time, ERROR_LOG_RATE_MS))
			pr_info("Write-error on swap-device (%u:%u:%llu)\n",
				imajor(bio->bi_bdev->bd_inode),
				iminor(bio->bi_bdev->bd_inode),
				(unsigned long long)bio->bi_iter.bi_sector);
@@ -77,7 +82,8 @@ void end_swap_bio_read(struct bio *bio, int err)
	if (!uptodate) {
		SetPageError(page);
		ClearPageUptodate(page);
		printk(KERN_ALERT "Read-error on swap-device (%u:%u:%Lu)\n",
		if (printk_timed_ratelimit(&error_time, ERROR_LOG_RATE_MS))
			pr_info("Read-error on swap-device (%u:%u:%llu)\n",
				imajor(bio->bi_bdev->bd_inode),
				iminor(bio->bi_bdev->bd_inode),
				(unsigned long long)bio->bi_iter.bi_sector);