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

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

Merge "block/fs: make tracking dirty task debug only"

parents 7f80593f 93519a67
Loading
Loading
Loading
Loading
+23 −10
Original line number Diff line number Diff line
@@ -1917,6 +1917,27 @@ void generic_make_request(struct bio *bio)
}
EXPORT_SYMBOL(generic_make_request);

#ifdef CONFIG_BLK_DEV_IO_TRACE
static inline struct task_struct *get_dirty_task(struct bio *bio)
{
	/*
	 * Not all the pages in the bio are dirtied by the
	 * same task but most likely it will be, since the
	 * sectors accessed on the device must be adjacent.
	 */
	if (bio->bi_io_vec && bio->bi_io_vec->bv_page &&
		bio->bi_io_vec->bv_page->tsk_dirty)
			return bio->bi_io_vec->bv_page->tsk_dirty;
	else
		return current;
}
#else
static inline struct task_struct *get_dirty_task(struct bio *bio)
{
	return current;
}
#endif

/**
 * submit_bio - submit a bio to the block device layer for I/O
 * @rw: whether to %READ or %WRITE, or maybe to %READA (read ahead)
@@ -1929,7 +1950,6 @@ EXPORT_SYMBOL(generic_make_request);
 */
void submit_bio(int rw, struct bio *bio)
{
	struct task_struct *tsk = current;
	bio->bi_rw |= rw;

	/*
@@ -1953,16 +1973,9 @@ void submit_bio(int rw, struct bio *bio)

		if (unlikely(block_dump)) {
			char b[BDEVNAME_SIZE];
			struct task_struct *tsk;

			/*
			 * Not all the pages in the bio are dirtied by the
			 * same task but most likely it will be, since the
			 * sectors accessed on the device must be adjacent.
			 */
			if (bio->bi_io_vec && bio->bi_io_vec->bv_page &&
			    bio->bi_io_vec->bv_page->tsk_dirty)
				tsk = bio->bi_io_vec->bv_page->tsk_dirty;

			tsk = get_dirty_task(bio);
			printk(KERN_DEBUG "%s(%d): %s block %Lu on %s (%u sectors)\n",
				tsk->comm, task_pid_nr(tsk),
				(rw & WRITE) ? "WRITE" : "READ",
+13 −2
Original line number Diff line number Diff line
@@ -617,6 +617,18 @@ void mark_buffer_dirty_inode(struct buffer_head *bh, struct inode *inode)
}
EXPORT_SYMBOL(mark_buffer_dirty_inode);

#ifdef CONFIG_BLK_DEV_IO_TRACE
static inline void save_dirty_task(struct page *page)
{
	/* Save the task that is dirtying this page */
	page->tsk_dirty = current;
}
#else
static inline void save_dirty_task(struct page *page)
{
}
#endif

/*
 * Mark the page dirty, and set it dirty in the radix tree, and mark the inode
 * dirty.
@@ -635,8 +647,7 @@ static void __set_page_dirty(struct page *page,
		account_page_dirtied(page, mapping);
		radix_tree_tag_set(&mapping->page_tree,
				page_index(page), PAGECACHE_TAG_DIRTY);
		/* Save the task that is dirtying this page */
		page->tsk_dirty = current;
		save_dirty_task(page);
	}
	spin_unlock_irqrestore(&mapping->tree_lock, flags);
	__mark_inode_dirty(mapping->host, I_DIRTY_PAGES);
+2 −0
Original line number Diff line number Diff line
@@ -185,7 +185,9 @@ struct page {
#ifdef CONFIG_WANT_PAGE_DEBUG_FLAGS
	unsigned long debug_flags;	/* Use atomic bitops on this */
#endif
#ifdef CONFIG_BLK_DEV_IO_TRACE
	struct task_struct *tsk_dirty;	/* task that sets this page dirty */
#endif

#ifdef CONFIG_KMEMCHECK
	/*