Message ID | 1465155145-10812-43-git-send-email-mchristi@redhat.com (mailing list archive) |
---|---|
State | Not Applicable |
Headers | show |
Hi, [auto build test WARNING on v4.7-rc1] [cannot apply to dm/for-next md/for-next next-20160603] [if your patch is applied to the wrong git tree, please drop us a note to help improve the system] url: https://github.com/0day-ci/linux/commits/mchristi-redhat-com/v8-separate-operations-from-flags-in-the-bio-request-structs/20160606-040240 config: x86_64-randconfig-i0-201623 (attached as .config) compiler: gcc-6 (Debian 6.1.1-1) 6.1.1 20160430 reproduce: # save the attached .config to linux build tree make ARCH=x86_64 All warnings (new ones prefixed by >>): In file included from include/linux/genhd.h:67:0, from include/linux/blkdev.h:9, from fs/ext4/ext4.h:20, from fs/ext4/ext4_extents.h:22, from fs/ext4/crypto.c:37: fs/ext4/crypto.c: In function 'ext4_encrypted_zeroout': >> include/linux/fs.h:197:19: warning: passing argument 1 of 'submit_bio_wait' makes pointer from integer without a cast [-Wint-conversion] #define RW_MASK REQ_OP_WRITE ^ include/linux/fs.h:201:17: note: in expansion of macro 'RW_MASK' #define WRITE RW_MASK ^~~~~~~ fs/ext4/crypto.c:442:25: note: in expansion of macro 'WRITE' err = submit_bio_wait(WRITE, bio); ^~~~~ In file included from include/linux/blkdev.h:19:0, from fs/ext4/ext4.h:20, from fs/ext4/ext4_extents.h:22, from fs/ext4/crypto.c:37: include/linux/bio.h:471:12: note: expected 'struct bio *' but argument is of type 'int' extern int submit_bio_wait(struct bio *bio); ^~~~~~~~~~~~~~~ fs/ext4/crypto.c:442:9: error: too many arguments to function 'submit_bio_wait' err = submit_bio_wait(WRITE, bio); ^~~~~~~~~~~~~~~ In file included from include/linux/blkdev.h:19:0, from fs/ext4/ext4.h:20, from fs/ext4/ext4_extents.h:22, from fs/ext4/crypto.c:37: include/linux/bio.h:471:12: note: declared here extern int submit_bio_wait(struct bio *bio); ^~~~~~~~~~~~~~~ vim +/submit_bio_wait +197 include/linux/fs.h 181 * READA Used for read-ahead operations. Lower priority, and the 182 * block layer could (in theory) choose to ignore this 183 * request if it runs into resource problems. 184 * WRITE A normal async write. Device will be plugged. 185 * WRITE_SYNC Synchronous write. Identical to WRITE, but passes down 186 * the hint that someone will be waiting on this IO 187 * shortly. The write equivalent of READ_SYNC. 188 * WRITE_ODIRECT Special case write for O_DIRECT only. 189 * WRITE_FLUSH Like WRITE_SYNC but with preceding cache flush. 190 * WRITE_FUA Like WRITE_SYNC but data is guaranteed to be on 191 * non-volatile media on completion. 192 * WRITE_FLUSH_FUA Combination of WRITE_FLUSH and FUA. The IO is preceded 193 * by a cache flush and data is guaranteed to be on 194 * non-volatile media on completion. 195 * 196 */ > 197 #define RW_MASK REQ_OP_WRITE 198 #define RWA_MASK REQ_RAHEAD 199 200 #define READ REQ_OP_READ 201 #define WRITE RW_MASK 202 #define READA RWA_MASK 203 204 #define READ_SYNC REQ_SYNC 205 #define WRITE_SYNC (REQ_SYNC | REQ_NOIDLE) --- 0-DAY kernel test infrastructure Open Source Technology Center https://lists.01.org/pipermail/kbuild-all Intel Corporation
Hi,
[auto build test ERROR on v4.7-rc1]
[cannot apply to dm/for-next md/for-next next-20160603]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
url: https://github.com/0day-ci/linux/commits/mchristi-redhat-com/v8-separate-operations-from-flags-in-the-bio-request-structs/20160606-040240
config: m32r-opsput_defconfig (attached as .config)
compiler: m32r-linux-gcc (GCC) 4.9.0
reproduce:
wget https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
make.cross ARCH=m32r
All errors (new ones prefixed by >>):
>> ERROR: "__ucmpdi2" [drivers/scsi/sd_mod.ko] undefined!
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
Hi,
[auto build test ERROR on v4.7-rc1]
[cannot apply to dm/for-next md/for-next next-20160603]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
url: https://github.com/0day-ci/linux/commits/mchristi-redhat-com/v8-separate-operations-from-flags-in-the-bio-request-structs/20160606-040240
config: blackfin-BF526-EZBRD_defconfig (attached as .config)
compiler: bfin-uclinux-gcc (GCC) 4.6.3
reproduce:
wget https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
make.cross ARCH=blackfin
All errors (new ones prefixed by >>):
drivers/built-in.o: In function `sd_init_command':
>> drivers/scsi/sd.c:1141: undefined reference to `__ucmpdi2'
vim +1141 drivers/scsi/sd.c
^1da177e Linus Torvalds 2005-04-16 1135 }
^1da177e Linus Torvalds 2005-04-16 1136
87949eee Christoph Hellwig 2014-06-28 1137 static int sd_init_command(struct scsi_cmnd *cmd)
87949eee Christoph Hellwig 2014-06-28 1138 {
87949eee Christoph Hellwig 2014-06-28 1139 struct request *rq = cmd->request;
87949eee Christoph Hellwig 2014-06-28 1140
b826ba83 Mike Christie 2016-06-05 @1141 switch (req_op(rq)) {
b826ba83 Mike Christie 2016-06-05 1142 case REQ_OP_DISCARD:
87949eee Christoph Hellwig 2014-06-28 1143 return sd_setup_discard_cmnd(cmd);
b826ba83 Mike Christie 2016-06-05 1144 case REQ_OP_WRITE_SAME:
:::::: The code at line 1141 was first introduced by commit
:::::: b826ba83985b86029288d8cc24fb93ce96947b18 drivers: use req op accessor
:::::: TO: Mike Christie <mchristi@redhat.com>
:::::: CC: 0day robot <fengguang.wu@intel.com>
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
On 06/05/2016 09:32 PM, mchristi@redhat.com wrote: > From: Mike Christie <mchristi@redhat.com> > > This patch drops the compat definition of req_op where it matches > the rq_flag_bits definitions, and drops the related old and compat > code that allowed users to set either the op or flags for the operation. > > We also then store the operation in the bi_rw/cmd_flags field similar > to how we used to store the bio ioprio where it sat in the upper bits > of the field. > > Signed-off-by: Mike Christie <mchristi@redhat.com> > --- > drivers/scsi/sd.c | 2 +- > include/linux/bio.h | 3 --- > include/linux/blk_types.h | 52 +++++++++++++++++---------------------------- > include/linux/blkdev.h | 14 ++++++++---- > include/linux/fs.h | 37 +++++++++++++------------------- > include/trace/events/f2fs.h | 1 - > 6 files changed, 46 insertions(+), 63 deletions(-) > Reviewed-by: Hannes Reinecke <hare@suse.com> Cheers, Hannes
On Sun, Jun 5, 2016 at 1:32 PM, <mchristi@redhat.com> wrote: > From: Mike Christie <mchristi@redhat.com> > > This patch drops the compat definition of req_op where it matches > the rq_flag_bits definitions, and drops the related old and compat > code that allowed users to set either the op or flags for the operation. > > We also then store the operation in the bi_rw/cmd_flags field similar > to how we used to store the bio ioprio where it sat in the upper bits > of the field. > > Signed-off-by: Mike Christie <mchristi@redhat.com> I was doing some xfstests testing yesterday using linux/master, and hit a kernel BUG that bisected to this change. The failing test is generic/008 + ext2, without DAX. This BUG reproduces with this test 100% as of this change, and 0% with the previous commit. Here's the kernel commit that I bisected to: commit 4e1b2d52a80d79296a5d899d73249748dea71a53 Author: Mike Christie <mchristi@redhat.com> Date: Sun Jun 5 14:32:22 2016 -0500 block, fs, drivers: remove REQ_OP compat defs and related code Here are the steps to reproduce the BUG using a pair of 1 GiB BRD ramdisks: SCRATCH_DEV=/dev/ram0 TEST_DEV=/dev/ram1 mkfs.ext2 -F $SCRATCH_DEV mkfs.ext2 -F $TEST_DEV cd ~/xfstests ./check generic/008 Here is the BUG output for that commit, passed through kasan_symbolize.py. The line numbers are for the commit listed above, not for linux/master: run fstests generic/008 at 2016-08-03 09:54:56 page:ffffea0017af04c0 count:3 mapcount:0 mapping:ffff8805eb059200 index:0x0 flags: 0x3fff8000002828(uptodate|lru|private|writeback) page dumped because: VM_BUG_ON_PAGE(!PageLocked(page)) page->mem_cgroup:ffff8806098e0800 ------------[ cut here ]------------ kernel BUG at mm/filemap.c:833! invalid opcode: 0000 [#1] SMP Modules linked in: brd dax_pmem nd_pmem dax nd_btt nd_e820 libnvdimm CPU: 0 PID: 2522 Comm: xfs_io Not tainted 4.7.0-rc2-00042-g4e1b2d52 #18 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.9.1-0-gb3ef39f-prebuilt.qemu-project.org 04/01/2014 task: ffff8805ebae4ec0 ti: ffff8805eba3c000 task.ti: ffff8805eba3c000 RIP: 0010:[<ffffffff811de115>] [<ffffffff811de115>] unlock_page+0xa5/0xb0 RSP: 0018:ffff8805eba3fa60 EFLAGS: 00010282 RAX: 0000000000000021 RBX: 0000000000000000 RCX: 0000000000000006 RDX: 0000000000000000 RSI: 0000000000000001 RDI: ffff8806109ce200 RBP: ffff8805eba3fa60 R08: 0000000000000001 R09: 0000000000000001 R10: ffff8805ebae4ec0 R11: 0000000000000001 R12: ffffea0017af04c0 R13: 0000000000028000 R14: ffffffffa00202c0 R15: ffff88060eff1200 FS: 00007f87a31cf700(0000) GS:ffff880610800000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 00007f87a31e6000 CR3: 000000060da31000 CR4: 00000000001406f0 Stack: ffff8805eba3fa98 ffffffff812bd782 ffff8805eba3fdb0 0000000000001000 ffffea0017af04c0 0000000000000000 0000000000000088 ffff8805eba3fbe0 ffffffff812c3ff1 ffff8805eba3fd00 0000000000028000 0000000c00000000 Call Trace: [<ffffffff812bd782>] bdev_write_page+0xb2/0xe0 fs/block_dev.c:462 [<ffffffff812c3ff1>] __mpage_writepage+0x5c1/0x750 fs/mpage.c:604 [<ffffffff811eedbd>] write_cache_pages+0x20d/0x5f0 mm/page-writeback.c:2261 [<ffffffff812c3955>] mpage_writepages+0x75/0xe0 fs/mpage.c:703 [<ffffffff8137951b>] ext2_writepages+0x3b/0x40 fs/ext2/inode.c:887 [<ffffffff811f27a1>] do_writepages+0x21/0x30 mm/page-writeback.c:2361 [<ffffffff811e1396>] __filemap_fdatawrite_range+0xc6/0x100 mm/filemap.c:300 [<ffffffff811e1514>] filemap_write_and_wait_range+0x44/0x90 mm/filemap.c:490 [<ffffffff812a7707>] __generic_file_fsync+0x27/0x90 fs/libfs.c:937 [<ffffffff812a7789>] generic_file_fsync+0x19/0x40 fs/libfs.c:974 [<ffffffff81377e9e>] ext2_fsync+0x2e/0x70 fs/ext2/file.c:149 [<ffffffff812b549b>] vfs_fsync_range+0x4b/0xb0 fs/sync.c:195 [< inline >] vfs_fsync fs/sync.c:209 [<ffffffff812b555d>] do_fsync+0x3d/0x70 fs/sync.c:219 [< inline >] SYSC_fsync fs/sync.c:227 [<ffffffff812b5810>] SyS_fsync+0x10/0x20 fs/sync.c:225 [<ffffffff81acd33c>] entry_SYSCALL_64_fastpath+0x1f/0xbd arch/x86/entry/entry_64.S:207 Code: 00 00 48 d3 ea 89 d2 48 8d 0c 92 48 8d 14 4a 48 8d 3c d0 31 d2 e8 bc fc f1 ff 5d c3 48 c7 c6 20 1d ec 81 4c 89 c7 e8 bb 8d 03 00 <0f> 0b 66 0f 1f 84 00 00 00 00 00 66 66 66 66 90 55 b9 08 00 00 RIP [<ffffffff811de115>] unlock_page+0xa5/0xb0 mm/filemap.c:833 RSP <ffff8805eba3fa60> ---[ end trace d419bf59bba263fb ]--- I'm happy to provide any additional info you need, or to test fixes. Thanks, - Ross -- To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
On 08/03/2016 11:25 AM, Ross Zwisler wrote: > run fstests generic/008 at 2016-08-03 09:54:56 > page:ffffea0017af04c0 count:3 mapcount:0 mapping:ffff8805eb059200 index:0x0 > flags: 0x3fff8000002828(uptodate|lru|private|writeback) > page dumped because: VM_BUG_ON_PAGE(!PageLocked(page)) > page->mem_cgroup:ffff8806098e0800 > ------------[ cut here ]------------ > kernel BUG at mm/filemap.c:833! > invalid opcode: 0000 [#1] SMP > Modules linked in: brd dax_pmem nd_pmem dax nd_btt nd_e820 libnvdimm > CPU: 0 PID: 2522 Comm: xfs_io Not tainted 4.7.0-rc2-00042-g4e1b2d52 #18 > Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS > rel-1.9.1-0-gb3ef39f-prebuilt.qemu-project.org 04/01/2014 > task: ffff8805ebae4ec0 ti: ffff8805eba3c000 task.ti: ffff8805eba3c000 > RIP: 0010:[<ffffffff811de115>] [<ffffffff811de115>] unlock_page+0xa5/0xb0 > RSP: 0018:ffff8805eba3fa60 EFLAGS: 00010282 > RAX: 0000000000000021 RBX: 0000000000000000 RCX: 0000000000000006 > RDX: 0000000000000000 RSI: 0000000000000001 RDI: ffff8806109ce200 > RBP: ffff8805eba3fa60 R08: 0000000000000001 R09: 0000000000000001 > R10: ffff8805ebae4ec0 R11: 0000000000000001 R12: ffffea0017af04c0 > R13: 0000000000028000 R14: ffffffffa00202c0 R15: ffff88060eff1200 > FS: 00007f87a31cf700(0000) GS:ffff880610800000(0000) knlGS:0000000000000000 > CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 > CR2: 00007f87a31e6000 CR3: 000000060da31000 CR4: 00000000001406f0 > Stack: > ffff8805eba3fa98 ffffffff812bd782 ffff8805eba3fdb0 0000000000001000 > ffffea0017af04c0 0000000000000000 0000000000000088 ffff8805eba3fbe0 > ffffffff812c3ff1 ffff8805eba3fd00 0000000000028000 0000000c00000000 > Call Trace: > [<ffffffff812bd782>] bdev_write_page+0xb2/0xe0 fs/block_dev.c:462 > [<ffffffff812c3ff1>] __mpage_writepage+0x5c1/0x750 fs/mpage.c:604 > [<ffffffff811eedbd>] write_cache_pages+0x20d/0x5f0 mm/page-writeback.c:2261 > [<ffffffff812c3955>] mpage_writepages+0x75/0xe0 fs/mpage.c:703 > [<ffffffff8137951b>] ext2_writepages+0x3b/0x40 fs/ext2/inode.c:887 > [<ffffffff811f27a1>] do_writepages+0x21/0x30 mm/page-writeback.c:2361 > [<ffffffff811e1396>] __filemap_fdatawrite_range+0xc6/0x100 mm/filemap.c:300 > [<ffffffff811e1514>] filemap_write_and_wait_range+0x44/0x90 mm/filemap.c:490 > [<ffffffff812a7707>] __generic_file_fsync+0x27/0x90 fs/libfs.c:937 > [<ffffffff812a7789>] generic_file_fsync+0x19/0x40 fs/libfs.c:974 > [<ffffffff81377e9e>] ext2_fsync+0x2e/0x70 fs/ext2/file.c:149 > [<ffffffff812b549b>] vfs_fsync_range+0x4b/0xb0 fs/sync.c:195 > [< inline >] vfs_fsync fs/sync.c:209 > [<ffffffff812b555d>] do_fsync+0x3d/0x70 fs/sync.c:219 > [< inline >] SYSC_fsync fs/sync.c:227 > [<ffffffff812b5810>] SyS_fsync+0x10/0x20 fs/sync.c:225 > [<ffffffff81acd33c>] entry_SYSCALL_64_fastpath+0x1f/0xbd > arch/x86/entry/entry_64.S:207 > Code: 00 00 48 d3 ea 89 d2 48 8d 0c 92 48 8d 14 4a 48 8d 3c d0 31 d2 > e8 bc fc f1 ff 5d c3 48 c7 c6 20 1d ec 81 4c 89 c7 e8 bb 8d 03 00 <0f> > 0b 66 0f 1f 84 00 00 00 00 00 66 66 66 66 90 55 b9 08 00 00 > RIP [<ffffffff811de115>] unlock_page+0xa5/0xb0 mm/filemap.c:833 > RSP <ffff8805eba3fa60> > ---[ end trace d419bf59bba263fb ]--- Thanks for testing and the detailed bug report. Looks like I missed the rw_page callback. Testing a patch right now. Should be done in a couple of hours. -- To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c index c8dc221..fad86ad 100644 --- a/drivers/scsi/sd.c +++ b/drivers/scsi/sd.c @@ -1012,7 +1012,7 @@ static int sd_setup_read_write_cmnd(struct scsi_cmnd *SCpnt) } else if (rq_data_dir(rq) == READ) { SCpnt->cmnd[0] = READ_6; } else { - scmd_printk(KERN_ERR, SCpnt, "Unknown command %d,%llx\n", + scmd_printk(KERN_ERR, SCpnt, "Unknown command %llu,%llx\n", req_op(rq), (unsigned long long) rq->cmd_flags); goto out; } diff --git a/include/linux/bio.h b/include/linux/bio.h index 35108c2..0bbb2e3 100644 --- a/include/linux/bio.h +++ b/include/linux/bio.h @@ -44,9 +44,6 @@ #define BIO_MAX_SIZE (BIO_MAX_PAGES << PAGE_SHIFT) #define BIO_MAX_SECTORS (BIO_MAX_SIZE >> 9) -#define bio_op(bio) (op_from_rq_bits((bio)->bi_rw)) -#define bio_set_op_attrs(bio, op, flags) ((bio)->bi_rw |= (op | flags)) - #define bio_prio(bio) (bio)->bi_ioprio #define bio_set_prio(bio, prio) ((bio)->bi_ioprio = prio) diff --git a/include/linux/blk_types.h b/include/linux/blk_types.h index 5efb6f1..23c1ab2 100644 --- a/include/linux/blk_types.h +++ b/include/linux/blk_types.h @@ -48,7 +48,9 @@ struct bio { struct block_device *bi_bdev; unsigned int bi_flags; /* status, command, etc */ int bi_error; - unsigned int bi_rw; /* READ/WRITE */ + unsigned int bi_rw; /* bottom bits req flags, + * top bits REQ_OP + */ unsigned short bi_ioprio; struct bvec_iter bi_iter; @@ -106,6 +108,16 @@ struct bio { struct bio_vec bi_inline_vecs[0]; }; +#define BIO_OP_SHIFT (8 * sizeof(unsigned int) - REQ_OP_BITS) +#define bio_op(bio) ((bio)->bi_rw >> BIO_OP_SHIFT) + +#define bio_set_op_attrs(bio, op, op_flags) do { \ + WARN_ON(op >= (1 << REQ_OP_BITS)); \ + (bio)->bi_rw &= ((1 << BIO_OP_SHIFT) - 1); \ + (bio)->bi_rw |= ((unsigned int) (op) << BIO_OP_SHIFT); \ + (bio)->bi_rw |= op_flags; \ +} while (0) + #define BIO_RESET_BYTES offsetof(struct bio, bi_max_vecs) /* @@ -144,7 +156,6 @@ struct bio { */ enum rq_flag_bits { /* common flags */ - __REQ_WRITE, /* not set, read. set, write */ __REQ_FAILFAST_DEV, /* no driver retries of device errors */ __REQ_FAILFAST_TRANSPORT, /* no driver retries of transport errors */ __REQ_FAILFAST_DRIVER, /* no driver retries of driver errors */ @@ -152,9 +163,7 @@ enum rq_flag_bits { __REQ_SYNC, /* request is sync (sync write or read) */ __REQ_META, /* metadata io request */ __REQ_PRIO, /* boost priority in cfq */ - __REQ_DISCARD, /* request to discard sectors */ - __REQ_SECURE, /* secure discard (used with __REQ_DISCARD) */ - __REQ_WRITE_SAME, /* write same block many times */ + __REQ_SECURE, /* secure discard (used with REQ_OP_DISCARD) */ __REQ_NOIDLE, /* don't anticipate more IO after this one */ __REQ_INTEGRITY, /* I/O includes block integrity payload */ @@ -190,28 +199,22 @@ enum rq_flag_bits { __REQ_NR_BITS, /* stops here */ }; -#define REQ_WRITE (1ULL << __REQ_WRITE) #define REQ_FAILFAST_DEV (1ULL << __REQ_FAILFAST_DEV) #define REQ_FAILFAST_TRANSPORT (1ULL << __REQ_FAILFAST_TRANSPORT) #define REQ_FAILFAST_DRIVER (1ULL << __REQ_FAILFAST_DRIVER) #define REQ_SYNC (1ULL << __REQ_SYNC) #define REQ_META (1ULL << __REQ_META) #define REQ_PRIO (1ULL << __REQ_PRIO) -#define REQ_DISCARD (1ULL << __REQ_DISCARD) -#define REQ_WRITE_SAME (1ULL << __REQ_WRITE_SAME) #define REQ_NOIDLE (1ULL << __REQ_NOIDLE) #define REQ_INTEGRITY (1ULL << __REQ_INTEGRITY) #define REQ_FAILFAST_MASK \ (REQ_FAILFAST_DEV | REQ_FAILFAST_TRANSPORT | REQ_FAILFAST_DRIVER) #define REQ_COMMON_MASK \ - (REQ_WRITE | REQ_FAILFAST_MASK | REQ_SYNC | REQ_META | REQ_PRIO | \ - REQ_DISCARD | REQ_WRITE_SAME | REQ_NOIDLE | REQ_FLUSH | REQ_FUA | \ - REQ_SECURE | REQ_INTEGRITY | REQ_NOMERGE) + (REQ_FAILFAST_MASK | REQ_SYNC | REQ_META | REQ_PRIO | REQ_NOIDLE | \ + REQ_FLUSH | REQ_FUA | REQ_SECURE | REQ_INTEGRITY | REQ_NOMERGE) #define REQ_CLONE_MASK REQ_COMMON_MASK -#define BIO_NO_ADVANCE_ITER_MASK (REQ_DISCARD|REQ_WRITE_SAME) - /* This mask is used for both bio and request merge checking */ #define REQ_NOMERGE_FLAGS \ (REQ_NOMERGE | REQ_STARTED | REQ_SOFTBARRIER | REQ_FLUSH | REQ_FUA | REQ_FLUSH_SEQ) @@ -243,27 +246,12 @@ enum rq_flag_bits { enum req_op { REQ_OP_READ, - REQ_OP_WRITE = REQ_WRITE, - REQ_OP_DISCARD = REQ_DISCARD, - REQ_OP_WRITE_SAME = REQ_WRITE_SAME, + REQ_OP_WRITE, + REQ_OP_DISCARD, /* request to discard sectors */ + REQ_OP_WRITE_SAME, /* write same block many times */ }; -/* - * tmp cpmpat. Users used to set the write bit for all non reads, but - * we will be dropping the bitmap use for ops. Support both until - * the end of the patchset. - */ -static inline int op_from_rq_bits(u64 flags) -{ - if (flags & REQ_OP_DISCARD) - return REQ_OP_DISCARD; - else if (flags & REQ_OP_WRITE_SAME) - return REQ_OP_WRITE_SAME; - else if (flags & REQ_OP_WRITE) - return REQ_OP_WRITE; - else - return REQ_OP_READ; -} +#define REQ_OP_BITS 2 typedef unsigned int blk_qc_t; #define BLK_QC_T_NONE -1U diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h index 4937c05..78ae3db 100644 --- a/include/linux/blkdev.h +++ b/include/linux/blkdev.h @@ -200,8 +200,15 @@ struct request { struct request *next_rq; }; -#define req_op(req) (op_from_rq_bits((req)->cmd_flags)) -#define req_set_op(req, op) ((req)->cmd_flags |= op) +#define REQ_OP_SHIFT (8 * sizeof(u64) - REQ_OP_BITS) +#define req_op(req) ((req)->cmd_flags >> REQ_OP_SHIFT) + +#define req_set_op(req, op) do { \ + WARN_ON(op >= (1 << REQ_OP_BITS)); \ + (req)->cmd_flags &= ((1ULL << REQ_OP_SHIFT) - 1); \ + (req)->cmd_flags |= ((u64) (op) << REQ_OP_SHIFT); \ +} while (0) + #define req_set_op_attrs(req, op, flags) do { \ req_set_op(req, op); \ (req)->cmd_flags |= flags; \ @@ -604,8 +611,7 @@ static inline void queue_flag_clear(unsigned int flag, struct request_queue *q) #define list_entry_rq(ptr) list_entry((ptr), struct request, queuelist) -#define rq_data_dir(rq) \ - (op_is_write(op_from_rq_bits(rq->cmd_flags)) ? WRITE : READ) +#define rq_data_dir(rq) (op_is_write(req_op(rq)) ? WRITE : READ) /* * Driver can handle struct request, if it either has an old style diff --git a/include/linux/fs.h b/include/linux/fs.h index af6f3c7..ccd1664 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h @@ -152,9 +152,10 @@ typedef int (dio_iodone_t)(struct kiocb *iocb, loff_t offset, #define CHECK_IOVEC_ONLY -1 /* - * The below are the various read and write types that we support. Some of + * The below are the various read and write flags that we support. Some of * them include behavioral modifiers that send information down to the - * block layer and IO scheduler. Terminology: + * block layer and IO scheduler. They should be used along with a req_op. + * Terminology: * * The block layer uses device plugging to defer IO a little bit, in * the hope that we will see more IO very shortly. This increases @@ -193,19 +194,19 @@ typedef int (dio_iodone_t)(struct kiocb *iocb, loff_t offset, * non-volatile media on completion. * */ -#define RW_MASK REQ_WRITE +#define RW_MASK REQ_OP_WRITE #define RWA_MASK REQ_RAHEAD -#define READ 0 +#define READ REQ_OP_READ #define WRITE RW_MASK #define READA RWA_MASK -#define READ_SYNC (READ | REQ_SYNC) -#define WRITE_SYNC (WRITE | REQ_SYNC | REQ_NOIDLE) -#define WRITE_ODIRECT (WRITE | REQ_SYNC) -#define WRITE_FLUSH (WRITE | REQ_SYNC | REQ_NOIDLE | REQ_FLUSH) -#define WRITE_FUA (WRITE | REQ_SYNC | REQ_NOIDLE | REQ_FUA) -#define WRITE_FLUSH_FUA (WRITE | REQ_SYNC | REQ_NOIDLE | REQ_FLUSH | REQ_FUA) +#define READ_SYNC REQ_SYNC +#define WRITE_SYNC (REQ_SYNC | REQ_NOIDLE) +#define WRITE_ODIRECT REQ_SYNC +#define WRITE_FLUSH (REQ_SYNC | REQ_NOIDLE | REQ_FLUSH) +#define WRITE_FUA (REQ_SYNC | REQ_NOIDLE | REQ_FUA) +#define WRITE_FLUSH_FUA (REQ_SYNC | REQ_NOIDLE | REQ_FLUSH | REQ_FUA) /* * Attribute flags. These should be or-ed together to figure out what @@ -2464,17 +2465,9 @@ extern void make_bad_inode(struct inode *); extern bool is_bad_inode(struct inode *); #ifdef CONFIG_BLOCK -/* - * tmp cpmpat. Users used to set the write bit for all non reads, but - * we will be dropping the bitmap use for ops. Support both until - * the end of the patchset. - */ -static inline bool op_is_write(unsigned long flags) +static inline bool op_is_write(unsigned int op) { - if (flags & (REQ_OP_WRITE | REQ_OP_WRITE_SAME | REQ_OP_DISCARD)) - return true; - else - return false; + return op == REQ_OP_READ ? false : true; } /* @@ -2482,7 +2475,7 @@ static inline bool op_is_write(unsigned long flags) */ static inline int bio_rw(struct bio *bio) { - if (op_is_write(op_from_rq_bits(bio->bi_rw))) + if (op_is_write(bio_op(bio))) return WRITE; return bio->bi_rw & RWA_MASK; @@ -2493,7 +2486,7 @@ static inline int bio_rw(struct bio *bio) */ static inline int bio_data_dir(struct bio *bio) { - return op_is_write(op_from_rq_bits(bio->bi_rw)) ? WRITE : READ; + return op_is_write(bio_op(bio)) ? WRITE : READ; } extern void check_disk_size_change(struct gendisk *disk, diff --git a/include/trace/events/f2fs.h b/include/trace/events/f2fs.h index 733b896..30efa44 100644 --- a/include/trace/events/f2fs.h +++ b/include/trace/events/f2fs.h @@ -31,7 +31,6 @@ TRACE_DEFINE_ENUM(BG_GC); TRACE_DEFINE_ENUM(LFS); TRACE_DEFINE_ENUM(SSR); TRACE_DEFINE_ENUM(__REQ_RAHEAD); -TRACE_DEFINE_ENUM(__REQ_WRITE); TRACE_DEFINE_ENUM(__REQ_SYNC); TRACE_DEFINE_ENUM(__REQ_NOIDLE); TRACE_DEFINE_ENUM(__REQ_FLUSH);