Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 146019
b: refs/heads/master
c: 9908c30
h: refs/heads/master
i:
  146017: 458b761
  146015: 13ede9e
v: v3
  • Loading branch information
Li Zefan authored and Ingo Molnar committed Apr 16, 2009
1 parent 13add11 commit 7f604ea
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 15 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: d0deef5b14af7d5bbd0003a0a2a1a32326e20a6d
refs/heads/master: 9908c30997b8a73c95f836170b9998dae9aa3f4a
39 changes: 25 additions & 14 deletions trunk/kernel/trace/blktrace.c
Original file line number Diff line number Diff line change
Expand Up @@ -403,6 +403,23 @@ static struct rchan_callbacks blk_relay_callbacks = {
.remove_buf_file = blk_remove_buf_file_callback,
};

static void blk_trace_setup_lba(struct blk_trace *bt,
struct block_device *bdev)
{
struct hd_struct *part = NULL;

if (bdev)
part = bdev->bd_part;

if (part) {
bt->start_lba = part->start_sect;
bt->end_lba = part->start_sect + part->nr_sects;
} else {
bt->start_lba = 0;
bt->end_lba = -1ULL;
}
}

/*
* Setup everything required to start tracing
*/
Expand All @@ -413,7 +430,6 @@ int do_blk_trace_setup(struct request_queue *q, char *name, dev_t dev,
struct blk_trace *old_bt, *bt = NULL;
struct dentry *dir = NULL;
int ret, i;
struct hd_struct *part = NULL;

if (!buts->buf_size || !buts->buf_nr)
return -EINVAL;
Expand Down Expand Up @@ -482,14 +498,7 @@ int do_blk_trace_setup(struct request_queue *q, char *name, dev_t dev,
if (!bt->act_mask)
bt->act_mask = (u16) -1;

if (bdev)
part = bdev->bd_part;

if (part) {
bt->start_lba = part->start_sect;
bt->end_lba = part->start_sect + part->nr_sects;
} else
bt->end_lba = -1ULL;
blk_trace_setup_lba(bt, bdev);

/* overwrite with user settings */
if (buts->start_lba)
Expand Down Expand Up @@ -1370,7 +1379,8 @@ static int blk_trace_remove_queue(struct request_queue *q)
/*
* Setup everything required to start tracing
*/
static int blk_trace_setup_queue(struct request_queue *q, dev_t dev)
static int blk_trace_setup_queue(struct request_queue *q,
struct block_device *bdev)
{
struct blk_trace *old_bt, *bt = NULL;
int ret = -ENOMEM;
Expand All @@ -1383,9 +1393,10 @@ static int blk_trace_setup_queue(struct request_queue *q, dev_t dev)
if (!bt->msg_data)
goto free_bt;

bt->dev = dev;
bt->dev = bdev->bd_dev;
bt->act_mask = (u16)-1;
bt->end_lba = -1ULL;

blk_trace_setup_lba(bt, bdev);

old_bt = xchg(&q->blk_trace, bt);
if (old_bt != NULL) {
Expand Down Expand Up @@ -1602,15 +1613,15 @@ static ssize_t sysfs_blk_trace_attr_store(struct device *dev,

if (attr == &dev_attr_enable) {
if (value)
ret = blk_trace_setup_queue(q, bdev->bd_dev);
ret = blk_trace_setup_queue(q, bdev);
else
ret = blk_trace_remove_queue(q);
goto out_unlock_bdev;
}

ret = 0;
if (q->blk_trace == NULL)
ret = blk_trace_setup_queue(q, bdev->bd_dev);
ret = blk_trace_setup_queue(q, bdev);

if (ret == 0) {
if (attr == &dev_attr_act_mask)
Expand Down

0 comments on commit 7f604ea

Please sign in to comment.