Merge branch 'drm-patches' of git://git.kernel.org/pub/scm/linux/kernel/git/airlied...
[powerpc.git] / block / blktrace.c
index b8c0702..8ff3344 100644 (file)
@@ -80,7 +80,7 @@ static u32 bio_act[5] __read_mostly = { 0, BLK_TC_ACT(BLK_TC_BARRIER), BLK_TC_AC
 #define trace_sync_bit(rw)     \
        (((rw) & (1 << BIO_RW_SYNC)) >> (BIO_RW_SYNC - 1))
 #define trace_ahead_bit(rw)    \
-       (((rw) & (1 << BIO_RW_AHEAD)) << (BIO_RW_AHEAD - 0))
+       (((rw) & (1 << BIO_RW_AHEAD)) << (2 - BIO_RW_AHEAD))
 
 /*
  * The worker for the various blk_add_trace*() types. Fills out a
@@ -217,7 +217,7 @@ static int blk_trace_remove(request_queue_t *q)
 
 static int blk_dropped_open(struct inode *inode, struct file *filp)
 {
-       filp->private_data = inode->u.generic_ip;
+       filp->private_data = inode->i_private;
 
        return 0;
 }
@@ -450,8 +450,10 @@ int blk_trace_ioctl(struct block_device *bdev, unsigned cmd, char __user *arg)
  **/
 void blk_trace_shutdown(request_queue_t *q)
 {
-       blk_trace_startstop(q, 0);
-       blk_trace_remove(q);
+       if (q->blk_trace) {
+               blk_trace_startstop(q, 0);
+               blk_trace_remove(q);
+       }
 }
 
 /*