diff options
| author | Venkat Gopalakrishnan <venkatg@codeaurora.org> | 2014-05-01 19:15:23 -0700 |
|---|---|---|
| committer | David Keitel <dkeitel@codeaurora.org> | 2016-03-22 11:02:00 -0700 |
| commit | 014929f975fab25e65776cd2b162e667644ba044 (patch) | |
| tree | f85df04da5e15fb1a9dfe763df5b94d393e7fd06 /block | |
| parent | a27d5a2f83bba21a78f45abe63ada896e7b4fc31 (diff) | |
block/fs: keep track of the task that dirtied the page
Background writes happen in the context of a background thread.
It is very useful to identify the actual task that generated the
request instead of background task that submited the request.
Hence keep track of the task when a page gets dirtied and dump
this task info while tracing. 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.
Change-Id: I6afba85a2063dd3350a0141ba87cf8440ce9f777
Signed-off-by: Venkat Gopalakrishnan <venkatg@codeaurora.org>
[venkatg@codeaurora.org: Fixed trivial merge conflicts]
Signed-off-by: Venkat Gopalakrishnan <venkatg@codeaurora.org>
Diffstat (limited to 'block')
| -rw-r--r-- | block/blk-core.c | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/block/blk-core.c b/block/blk-core.c index 0e65201d9633..b5f890e8caab 100644 --- a/block/blk-core.c +++ b/block/blk-core.c @@ -2093,6 +2093,7 @@ EXPORT_SYMBOL(generic_make_request); */ blk_qc_t submit_bio(int rw, struct bio *bio) { + struct task_struct *tsk = current; bio->bi_rw |= rw; /* @@ -2116,8 +2117,18 @@ blk_qc_t submit_bio(int rw, struct bio *bio) if (unlikely(block_dump)) { char b[BDEVNAME_SIZE]; + + /* + * 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; + printk(KERN_DEBUG "%s(%d): %s block %Lu on %s (%u sectors)\n", - current->comm, task_pid_nr(current), + tsk->comm, task_pid_nr(tsk), (rw & WRITE) ? "WRITE" : "READ", (unsigned long long)bio->bi_iter.bi_sector, bdevname(bio->bi_bdev, b), |
