Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

block: fix bad definition of BIO_RW_SYNC

We can't OR shift values, so get rid of BIO_RW_SYNC and use BIO_RW_SYNCIO
and BIO_RW_UNPLUG explicitly. This brings back the behaviour from before
213d9417fec62ef4c3675621b9364a667954d4dd.

Signed-off-by: Jens Axboe <jens.axboe@oracle.com>

+13 -13
+1 -1
block/blktrace.c
··· 142 142 143 143 what |= ddir_act[rw & WRITE]; 144 144 what |= MASK_TC_BIT(rw, BARRIER); 145 - what |= MASK_TC_BIT(rw, SYNC); 145 + what |= MASK_TC_BIT(rw, SYNCIO); 146 146 what |= MASK_TC_BIT(rw, AHEAD); 147 147 what |= MASK_TC_BIT(rw, META); 148 148 what |= MASK_TC_BIT(rw, DISCARD);
+1 -1
drivers/md/dm-io.c
··· 328 328 struct dpages old_pages = *dp; 329 329 330 330 if (sync) 331 - rw |= (1 << BIO_RW_SYNC); 331 + rw |= (1 << BIO_RW_SYNCIO) | (1 << BIO_RW_UNPLUG); 332 332 333 333 /* 334 334 * For multiple regions we need to be careful to rewind
+1 -1
drivers/md/dm-kcopyd.c
··· 344 344 { 345 345 int r; 346 346 struct dm_io_request io_req = { 347 - .bi_rw = job->rw | (1 << BIO_RW_SYNC), 347 + .bi_rw = job->rw | (1 << BIO_RW_SYNCIO) | (1 << BIO_RW_UNPLUG), 348 348 .mem.type = DM_IO_PAGE_LIST, 349 349 .mem.ptr.pl = job->pages, 350 350 .mem.offset = job->offset,
+2 -2
drivers/md/md.c
··· 474 474 * causes ENOTSUPP, we allocate a spare bio... 475 475 */ 476 476 struct bio *bio = bio_alloc(GFP_NOIO, 1); 477 - int rw = (1<<BIO_RW) | (1<<BIO_RW_SYNC); 477 + int rw = (1<<BIO_RW) | (1<<BIO_RW_SYNCIO) | (1<<BIO_RW_UNPLUG); 478 478 479 479 bio->bi_bdev = rdev->bdev; 480 480 bio->bi_sector = sector; ··· 531 531 struct completion event; 532 532 int ret; 533 533 534 - rw |= (1 << BIO_RW_SYNC); 534 + rw |= (1 << BIO_RW_SYNCIO) | (1 << BIO_RW_UNPLUG); 535 535 536 536 bio->bi_bdev = bdev; 537 537 bio->bi_sector = sector;
-2
include/linux/bio.h
··· 171 171 #define BIO_RW_FAILFAST_TRANSPORT 8 172 172 #define BIO_RW_FAILFAST_DRIVER 9 173 173 174 - #define BIO_RW_SYNC (BIO_RW_SYNCIO | BIO_RW_UNPLUG) 175 - 176 174 #define bio_rw_flagged(bio, flag) ((bio)->bi_rw & (1 << (flag))) 177 175 178 176 /*
+1
include/linux/blktrace_api.h
··· 15 15 BLK_TC_WRITE = 1 << 1, /* writes */ 16 16 BLK_TC_BARRIER = 1 << 2, /* barrier */ 17 17 BLK_TC_SYNC = 1 << 3, /* sync IO */ 18 + BLK_TC_SYNCIO = BLK_TC_SYNC, 18 19 BLK_TC_QUEUE = 1 << 4, /* queueing/merging */ 19 20 BLK_TC_REQUEUE = 1 << 5, /* requeueing */ 20 21 BLK_TC_ISSUE = 1 << 6, /* issue */
+3 -3
include/linux/fs.h
··· 87 87 #define WRITE 1 88 88 #define READA 2 /* read-ahead - don't block if no resources */ 89 89 #define SWRITE 3 /* for ll_rw_block() - wait for buffer lock */ 90 - #define READ_SYNC (READ | (1 << BIO_RW_SYNC)) 90 + #define READ_SYNC (READ | (1 << BIO_RW_SYNCIO) | (1 << BIO_RW_UNPLUG)) 91 91 #define READ_META (READ | (1 << BIO_RW_META)) 92 - #define WRITE_SYNC (WRITE | (1 << BIO_RW_SYNC)) 93 - #define SWRITE_SYNC (SWRITE | (1 << BIO_RW_SYNC)) 92 + #define WRITE_SYNC (WRITE | (1 << BIO_RW_SYNCIO) | (1 << BIO_RW_UNPLUG)) 93 + #define SWRITE_SYNC (SWRITE | (1 << BIO_RW_SYNCIO) | (1 << BIO_RW_UNPLUG)) 94 94 #define WRITE_BARRIER (WRITE | (1 << BIO_RW_BARRIER)) 95 95 #define DISCARD_NOBARRIER (1 << BIO_RW_DISCARD) 96 96 #define DISCARD_BARRIER ((1 << BIO_RW_DISCARD) | (1 << BIO_RW_BARRIER))
+3 -2
kernel/power/swap.c
··· 60 60 static int submit(int rw, pgoff_t page_off, struct page *page, 61 61 struct bio **bio_chain) 62 62 { 63 + const int bio_rw = rw | (1 << BIO_RW_SYNCIO) | (1 << BIO_RW_UNPLUG); 63 64 struct bio *bio; 64 65 65 66 bio = bio_alloc(__GFP_WAIT | __GFP_HIGH, 1); ··· 81 80 bio_get(bio); 82 81 83 82 if (bio_chain == NULL) { 84 - submit_bio(rw | (1 << BIO_RW_SYNC), bio); 83 + submit_bio(bio_rw, bio); 85 84 wait_on_page_locked(page); 86 85 if (rw == READ) 87 86 bio_set_pages_dirty(bio); ··· 91 90 get_page(page); /* These pages are freed later */ 92 91 bio->bi_private = *bio_chain; 93 92 *bio_chain = bio; 94 - submit_bio(rw | (1 << BIO_RW_SYNC), bio); 93 + submit_bio(bio_rw, bio); 95 94 } 96 95 return 0; 97 96 }
+1 -1
mm/page_io.c
··· 111 111 goto out; 112 112 } 113 113 if (wbc->sync_mode == WB_SYNC_ALL) 114 - rw |= (1 << BIO_RW_SYNC); 114 + rw |= (1 << BIO_RW_SYNCIO) | (1 << BIO_RW_UNPLUG); 115 115 count_vm_event(PSWPOUT); 116 116 set_page_writeback(page); 117 117 unlock_page(page);