Commit 04d328de authored by Mike Christie's avatar Mike Christie Committed by Jens Axboe

f2fs: use bio op accessors

Separate the op from the rq_flag_bits and have f2fs
set/get the bio using bio_set_op_attrs/bio_op.
Signed-off-by: default avatarMike Christie <mchristi@redhat.com>
Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
Reviewed-by: default avatarHannes Reinecke <hare@suse.com>
Signed-off-by: default avatarJens Axboe <axboe@fb.com>
parent 81a75f67
...@@ -63,14 +63,15 @@ static struct page *__get_meta_page(struct f2fs_sb_info *sbi, pgoff_t index, ...@@ -63,14 +63,15 @@ static struct page *__get_meta_page(struct f2fs_sb_info *sbi, pgoff_t index,
struct f2fs_io_info fio = { struct f2fs_io_info fio = {
.sbi = sbi, .sbi = sbi,
.type = META, .type = META,
.rw = READ_SYNC | REQ_META | REQ_PRIO, .op = REQ_OP_READ,
.op_flags = READ_SYNC | REQ_META | REQ_PRIO,
.old_blkaddr = index, .old_blkaddr = index,
.new_blkaddr = index, .new_blkaddr = index,
.encrypted_page = NULL, .encrypted_page = NULL,
}; };
if (unlikely(!is_meta)) if (unlikely(!is_meta))
fio.rw &= ~REQ_META; fio.op_flags &= ~REQ_META;
repeat: repeat:
page = f2fs_grab_cache_page(mapping, index, false); page = f2fs_grab_cache_page(mapping, index, false);
if (!page) { if (!page) {
...@@ -157,13 +158,14 @@ int ra_meta_pages(struct f2fs_sb_info *sbi, block_t start, int nrpages, ...@@ -157,13 +158,14 @@ int ra_meta_pages(struct f2fs_sb_info *sbi, block_t start, int nrpages,
struct f2fs_io_info fio = { struct f2fs_io_info fio = {
.sbi = sbi, .sbi = sbi,
.type = META, .type = META,
.rw = sync ? (READ_SYNC | REQ_META | REQ_PRIO) : READA, .op = REQ_OP_READ,
.op_flags = sync ? (READ_SYNC | REQ_META | REQ_PRIO) : READA,
.encrypted_page = NULL, .encrypted_page = NULL,
}; };
struct blk_plug plug; struct blk_plug plug;
if (unlikely(type == META_POR)) if (unlikely(type == META_POR))
fio.rw &= ~REQ_META; fio.op_flags &= ~REQ_META;
blk_start_plug(&plug); blk_start_plug(&plug);
for (; nrpages-- > 0; blkno++) { for (; nrpages-- > 0; blkno++) {
......
...@@ -97,12 +97,10 @@ static struct bio *__bio_alloc(struct f2fs_sb_info *sbi, block_t blk_addr, ...@@ -97,12 +97,10 @@ static struct bio *__bio_alloc(struct f2fs_sb_info *sbi, block_t blk_addr,
return bio; return bio;
} }
static inline void __submit_bio(struct f2fs_sb_info *sbi, int rw, static inline void __submit_bio(struct f2fs_sb_info *sbi, struct bio *bio)
struct bio *bio)
{ {
if (!is_read_io(rw)) if (!is_read_io(bio_op(bio)))
atomic_inc(&sbi->nr_wb_bios); atomic_inc(&sbi->nr_wb_bios);
bio->bi_rw = rw;
submit_bio(bio); submit_bio(bio);
} }
...@@ -113,12 +111,14 @@ static void __submit_merged_bio(struct f2fs_bio_info *io) ...@@ -113,12 +111,14 @@ static void __submit_merged_bio(struct f2fs_bio_info *io)
if (!io->bio) if (!io->bio)
return; return;
if (is_read_io(fio->rw)) if (is_read_io(fio->op))
trace_f2fs_submit_read_bio(io->sbi->sb, fio, io->bio); trace_f2fs_submit_read_bio(io->sbi->sb, fio, io->bio);
else else
trace_f2fs_submit_write_bio(io->sbi->sb, fio, io->bio); trace_f2fs_submit_write_bio(io->sbi->sb, fio, io->bio);
__submit_bio(io->sbi, fio->rw, io->bio); bio_set_op_attrs(io->bio, fio->op, fio->op_flags);
__submit_bio(io->sbi, io->bio);
io->bio = NULL; io->bio = NULL;
} }
...@@ -184,10 +184,12 @@ static void __f2fs_submit_merged_bio(struct f2fs_sb_info *sbi, ...@@ -184,10 +184,12 @@ static void __f2fs_submit_merged_bio(struct f2fs_sb_info *sbi,
/* change META to META_FLUSH in the checkpoint procedure */ /* change META to META_FLUSH in the checkpoint procedure */
if (type >= META_FLUSH) { if (type >= META_FLUSH) {
io->fio.type = META_FLUSH; io->fio.type = META_FLUSH;
io->fio.op = REQ_OP_WRITE;
if (test_opt(sbi, NOBARRIER)) if (test_opt(sbi, NOBARRIER))
io->fio.rw = WRITE_FLUSH | REQ_META | REQ_PRIO; io->fio.op_flags = WRITE_FLUSH | REQ_META | REQ_PRIO;
else else
io->fio.rw = WRITE_FLUSH_FUA | REQ_META | REQ_PRIO; io->fio.op_flags = WRITE_FLUSH_FUA | REQ_META |
REQ_PRIO;
} }
__submit_merged_bio(io); __submit_merged_bio(io);
out: out:
...@@ -229,14 +231,16 @@ int f2fs_submit_page_bio(struct f2fs_io_info *fio) ...@@ -229,14 +231,16 @@ int f2fs_submit_page_bio(struct f2fs_io_info *fio)
f2fs_trace_ios(fio, 0); f2fs_trace_ios(fio, 0);
/* Allocate a new bio */ /* Allocate a new bio */
bio = __bio_alloc(fio->sbi, fio->new_blkaddr, 1, is_read_io(fio->rw)); bio = __bio_alloc(fio->sbi, fio->new_blkaddr, 1, is_read_io(fio->op));
if (bio_add_page(bio, page, PAGE_SIZE, 0) < PAGE_SIZE) { if (bio_add_page(bio, page, PAGE_SIZE, 0) < PAGE_SIZE) {
bio_put(bio); bio_put(bio);
return -EFAULT; return -EFAULT;
} }
bio->bi_rw = fio->op_flags;
bio_set_op_attrs(bio, fio->op, fio->op_flags);
__submit_bio(fio->sbi, fio->rw, bio); __submit_bio(fio->sbi, bio);
return 0; return 0;
} }
...@@ -245,7 +249,7 @@ void f2fs_submit_page_mbio(struct f2fs_io_info *fio) ...@@ -245,7 +249,7 @@ void f2fs_submit_page_mbio(struct f2fs_io_info *fio)
struct f2fs_sb_info *sbi = fio->sbi; struct f2fs_sb_info *sbi = fio->sbi;
enum page_type btype = PAGE_TYPE_OF_BIO(fio->type); enum page_type btype = PAGE_TYPE_OF_BIO(fio->type);
struct f2fs_bio_info *io; struct f2fs_bio_info *io;
bool is_read = is_read_io(fio->rw); bool is_read = is_read_io(fio->op);
struct page *bio_page; struct page *bio_page;
io = is_read ? &sbi->read_io : &sbi->write_io[btype]; io = is_read ? &sbi->read_io : &sbi->write_io[btype];
...@@ -257,7 +261,7 @@ void f2fs_submit_page_mbio(struct f2fs_io_info *fio) ...@@ -257,7 +261,7 @@ void f2fs_submit_page_mbio(struct f2fs_io_info *fio)
down_write(&io->io_rwsem); down_write(&io->io_rwsem);
if (io->bio && (io->last_block_in_bio != fio->new_blkaddr - 1 || if (io->bio && (io->last_block_in_bio != fio->new_blkaddr - 1 ||
io->fio.rw != fio->rw)) (io->fio.op != fio->op || io->fio.op_flags != fio->op_flags)))
__submit_merged_bio(io); __submit_merged_bio(io);
alloc_new: alloc_new:
if (io->bio == NULL) { if (io->bio == NULL) {
...@@ -391,7 +395,7 @@ int f2fs_get_block(struct dnode_of_data *dn, pgoff_t index) ...@@ -391,7 +395,7 @@ int f2fs_get_block(struct dnode_of_data *dn, pgoff_t index)
} }
struct page *get_read_data_page(struct inode *inode, pgoff_t index, struct page *get_read_data_page(struct inode *inode, pgoff_t index,
int rw, bool for_write) int op_flags, bool for_write)
{ {
struct address_space *mapping = inode->i_mapping; struct address_space *mapping = inode->i_mapping;
struct dnode_of_data dn; struct dnode_of_data dn;
...@@ -401,7 +405,8 @@ struct page *get_read_data_page(struct inode *inode, pgoff_t index, ...@@ -401,7 +405,8 @@ struct page *get_read_data_page(struct inode *inode, pgoff_t index,
struct f2fs_io_info fio = { struct f2fs_io_info fio = {
.sbi = F2FS_I_SB(inode), .sbi = F2FS_I_SB(inode),
.type = DATA, .type = DATA,
.rw = rw, .op = REQ_OP_READ,
.op_flags = op_flags,
.encrypted_page = NULL, .encrypted_page = NULL,
}; };
...@@ -1052,7 +1057,7 @@ static int f2fs_mpage_readpages(struct address_space *mapping, ...@@ -1052,7 +1057,7 @@ static int f2fs_mpage_readpages(struct address_space *mapping,
*/ */
if (bio && (last_block_in_bio != block_nr - 1)) { if (bio && (last_block_in_bio != block_nr - 1)) {
submit_and_realloc: submit_and_realloc:
__submit_bio(F2FS_I_SB(inode), READ, bio); __submit_bio(F2FS_I_SB(inode), bio);
bio = NULL; bio = NULL;
} }
if (bio == NULL) { if (bio == NULL) {
...@@ -1081,7 +1086,7 @@ static int f2fs_mpage_readpages(struct address_space *mapping, ...@@ -1081,7 +1086,7 @@ static int f2fs_mpage_readpages(struct address_space *mapping,
bio->bi_iter.bi_sector = SECTOR_FROM_BLOCK(block_nr); bio->bi_iter.bi_sector = SECTOR_FROM_BLOCK(block_nr);
bio->bi_end_io = f2fs_read_end_io; bio->bi_end_io = f2fs_read_end_io;
bio->bi_private = ctx; bio->bi_private = ctx;
bio->bi_rw = READ; bio_set_op_attrs(bio, REQ_OP_READ, 0);
} }
if (bio_add_page(bio, page, blocksize, 0) < blocksize) if (bio_add_page(bio, page, blocksize, 0) < blocksize)
...@@ -1096,7 +1101,7 @@ static int f2fs_mpage_readpages(struct address_space *mapping, ...@@ -1096,7 +1101,7 @@ static int f2fs_mpage_readpages(struct address_space *mapping,
goto next_page; goto next_page;
confused: confused:
if (bio) { if (bio) {
__submit_bio(F2FS_I_SB(inode), READ, bio); __submit_bio(F2FS_I_SB(inode), bio);
bio = NULL; bio = NULL;
} }
unlock_page(page); unlock_page(page);
...@@ -1106,7 +1111,7 @@ static int f2fs_mpage_readpages(struct address_space *mapping, ...@@ -1106,7 +1111,7 @@ static int f2fs_mpage_readpages(struct address_space *mapping,
} }
BUG_ON(pages && !list_empty(pages)); BUG_ON(pages && !list_empty(pages));
if (bio) if (bio)
__submit_bio(F2FS_I_SB(inode), READ, bio); __submit_bio(F2FS_I_SB(inode), bio);
return 0; return 0;
} }
...@@ -1223,7 +1228,8 @@ static int f2fs_write_data_page(struct page *page, ...@@ -1223,7 +1228,8 @@ static int f2fs_write_data_page(struct page *page,
struct f2fs_io_info fio = { struct f2fs_io_info fio = {
.sbi = sbi, .sbi = sbi,
.type = DATA, .type = DATA,
.rw = (wbc->sync_mode == WB_SYNC_ALL) ? WRITE_SYNC : WRITE, .op = REQ_OP_WRITE,
.op_flags = (wbc->sync_mode == WB_SYNC_ALL) ? WRITE_SYNC : 0,
.page = page, .page = page,
.encrypted_page = NULL, .encrypted_page = NULL,
}; };
...@@ -1664,7 +1670,8 @@ static int f2fs_write_begin(struct file *file, struct address_space *mapping, ...@@ -1664,7 +1670,8 @@ static int f2fs_write_begin(struct file *file, struct address_space *mapping,
struct f2fs_io_info fio = { struct f2fs_io_info fio = {
.sbi = sbi, .sbi = sbi,
.type = DATA, .type = DATA,
.rw = READ_SYNC, .op = REQ_OP_READ,
.op_flags = READ_SYNC,
.old_blkaddr = blkaddr, .old_blkaddr = blkaddr,
.new_blkaddr = blkaddr, .new_blkaddr = blkaddr,
.page = page, .page = page,
......
...@@ -686,14 +686,15 @@ enum page_type { ...@@ -686,14 +686,15 @@ enum page_type {
struct f2fs_io_info { struct f2fs_io_info {
struct f2fs_sb_info *sbi; /* f2fs_sb_info pointer */ struct f2fs_sb_info *sbi; /* f2fs_sb_info pointer */
enum page_type type; /* contains DATA/NODE/META/META_FLUSH */ enum page_type type; /* contains DATA/NODE/META/META_FLUSH */
int rw; /* contains R/RS/W/WS with REQ_META/REQ_PRIO */ int op; /* contains REQ_OP_ */
int op_flags; /* rq_flag_bits */
block_t new_blkaddr; /* new block address to be written */ block_t new_blkaddr; /* new block address to be written */
block_t old_blkaddr; /* old block address before Cow */ block_t old_blkaddr; /* old block address before Cow */
struct page *page; /* page to be written */ struct page *page; /* page to be written */
struct page *encrypted_page; /* encrypted page */ struct page *encrypted_page; /* encrypted page */
}; };
#define is_read_io(rw) (((rw) & 1) == READ) #define is_read_io(rw) (rw == READ)
struct f2fs_bio_info { struct f2fs_bio_info {
struct f2fs_sb_info *sbi; /* f2fs superblock */ struct f2fs_sb_info *sbi; /* f2fs superblock */
struct bio *bio; /* bios to merge */ struct bio *bio; /* bios to merge */
......
...@@ -538,7 +538,8 @@ static void move_encrypted_block(struct inode *inode, block_t bidx) ...@@ -538,7 +538,8 @@ static void move_encrypted_block(struct inode *inode, block_t bidx)
struct f2fs_io_info fio = { struct f2fs_io_info fio = {
.sbi = F2FS_I_SB(inode), .sbi = F2FS_I_SB(inode),
.type = DATA, .type = DATA,
.rw = READ_SYNC, .op = REQ_OP_READ,
.op_flags = READ_SYNC,
.encrypted_page = NULL, .encrypted_page = NULL,
}; };
struct dnode_of_data dn; struct dnode_of_data dn;
...@@ -612,7 +613,8 @@ static void move_encrypted_block(struct inode *inode, block_t bidx) ...@@ -612,7 +613,8 @@ static void move_encrypted_block(struct inode *inode, block_t bidx)
/* allocate block address */ /* allocate block address */
f2fs_wait_on_page_writeback(dn.node_page, NODE, true); f2fs_wait_on_page_writeback(dn.node_page, NODE, true);
fio.rw = WRITE_SYNC; fio.op = REQ_OP_WRITE;
fio.op_flags = WRITE_SYNC;
fio.new_blkaddr = newaddr; fio.new_blkaddr = newaddr;
f2fs_submit_page_mbio(&fio); f2fs_submit_page_mbio(&fio);
...@@ -649,7 +651,8 @@ static void move_data_page(struct inode *inode, block_t bidx, int gc_type) ...@@ -649,7 +651,8 @@ static void move_data_page(struct inode *inode, block_t bidx, int gc_type)
struct f2fs_io_info fio = { struct f2fs_io_info fio = {
.sbi = F2FS_I_SB(inode), .sbi = F2FS_I_SB(inode),
.type = DATA, .type = DATA,
.rw = WRITE_SYNC, .op = REQ_OP_WRITE,
.op_flags = WRITE_SYNC,
.page = page, .page = page,
.encrypted_page = NULL, .encrypted_page = NULL,
}; };
......
...@@ -108,7 +108,8 @@ int f2fs_convert_inline_page(struct dnode_of_data *dn, struct page *page) ...@@ -108,7 +108,8 @@ int f2fs_convert_inline_page(struct dnode_of_data *dn, struct page *page)
struct f2fs_io_info fio = { struct f2fs_io_info fio = {
.sbi = F2FS_I_SB(dn->inode), .sbi = F2FS_I_SB(dn->inode),
.type = DATA, .type = DATA,
.rw = WRITE_SYNC | REQ_PRIO, .op = REQ_OP_WRITE,
.op_flags = WRITE_SYNC | REQ_PRIO,
.page = page, .page = page,
.encrypted_page = NULL, .encrypted_page = NULL,
}; };
......
...@@ -1070,14 +1070,15 @@ struct page *new_node_page(struct dnode_of_data *dn, ...@@ -1070,14 +1070,15 @@ struct page *new_node_page(struct dnode_of_data *dn,
* 0: f2fs_put_page(page, 0) * 0: f2fs_put_page(page, 0)
* LOCKED_PAGE or error: f2fs_put_page(page, 1) * LOCKED_PAGE or error: f2fs_put_page(page, 1)
*/ */
static int read_node_page(struct page *page, int rw) static int read_node_page(struct page *page, int op_flags)
{ {
struct f2fs_sb_info *sbi = F2FS_P_SB(page); struct f2fs_sb_info *sbi = F2FS_P_SB(page);
struct node_info ni; struct node_info ni;
struct f2fs_io_info fio = { struct f2fs_io_info fio = {
.sbi = sbi, .sbi = sbi,
.type = NODE, .type = NODE,
.rw = rw, .op = REQ_OP_READ,
.op_flags = op_flags,
.page = page, .page = page,
.encrypted_page = NULL, .encrypted_page = NULL,
}; };
...@@ -1568,7 +1569,8 @@ static int f2fs_write_node_page(struct page *page, ...@@ -1568,7 +1569,8 @@ static int f2fs_write_node_page(struct page *page,
struct f2fs_io_info fio = { struct f2fs_io_info fio = {
.sbi = sbi, .sbi = sbi,
.type = NODE, .type = NODE,
.rw = (wbc->sync_mode == WB_SYNC_ALL) ? WRITE_SYNC : WRITE, .op = REQ_OP_WRITE,
.op_flags = (wbc->sync_mode == WB_SYNC_ALL) ? WRITE_SYNC : 0,
.page = page, .page = page,
.encrypted_page = NULL, .encrypted_page = NULL,
}; };
......
...@@ -257,7 +257,8 @@ static int __commit_inmem_pages(struct inode *inode, ...@@ -257,7 +257,8 @@ static int __commit_inmem_pages(struct inode *inode,
struct f2fs_io_info fio = { struct f2fs_io_info fio = {
.sbi = sbi, .sbi = sbi,
.type = DATA, .type = DATA,
.rw = WRITE_SYNC | REQ_PRIO, .op = REQ_OP_WRITE,
.op_flags = WRITE_SYNC | REQ_PRIO,
.encrypted_page = NULL, .encrypted_page = NULL,
}; };
bool submit_bio = false; bool submit_bio = false;
...@@ -406,7 +407,7 @@ static int issue_flush_thread(void *data) ...@@ -406,7 +407,7 @@ static int issue_flush_thread(void *data)
fcc->dispatch_list = llist_reverse_order(fcc->dispatch_list); fcc->dispatch_list = llist_reverse_order(fcc->dispatch_list);
bio->bi_bdev = sbi->sb->s_bdev; bio->bi_bdev = sbi->sb->s_bdev;
bio->bi_rw = WRITE_FLUSH; bio_set_op_attrs(bio, REQ_OP_WRITE, WRITE_FLUSH);
ret = submit_bio_wait(bio); ret = submit_bio_wait(bio);
llist_for_each_entry_safe(cmd, next, llist_for_each_entry_safe(cmd, next,
...@@ -439,7 +440,7 @@ int f2fs_issue_flush(struct f2fs_sb_info *sbi) ...@@ -439,7 +440,7 @@ int f2fs_issue_flush(struct f2fs_sb_info *sbi)
int ret; int ret;
bio->bi_bdev = sbi->sb->s_bdev; bio->bi_bdev = sbi->sb->s_bdev;
bio->bi_rw = WRITE_FLUSH; bio_set_op_attrs(bio, REQ_OP_WRITE, WRITE_FLUSH);
ret = submit_bio_wait(bio); ret = submit_bio_wait(bio);
bio_put(bio); bio_put(bio);
return ret; return ret;
...@@ -1403,7 +1404,8 @@ void write_meta_page(struct f2fs_sb_info *sbi, struct page *page) ...@@ -1403,7 +1404,8 @@ void write_meta_page(struct f2fs_sb_info *sbi, struct page *page)
struct f2fs_io_info fio = { struct f2fs_io_info fio = {
.sbi = sbi, .sbi = sbi,
.type = META, .type = META,
.rw = WRITE_SYNC | REQ_META | REQ_PRIO, .op = REQ_OP_WRITE,
.op_flags = WRITE_SYNC | REQ_META | REQ_PRIO,
.old_blkaddr = page->index, .old_blkaddr = page->index,
.new_blkaddr = page->index, .new_blkaddr = page->index,
.page = page, .page = page,
...@@ -1411,7 +1413,7 @@ void write_meta_page(struct f2fs_sb_info *sbi, struct page *page) ...@@ -1411,7 +1413,7 @@ void write_meta_page(struct f2fs_sb_info *sbi, struct page *page)
}; };
if (unlikely(page->index >= MAIN_BLKADDR(sbi))) if (unlikely(page->index >= MAIN_BLKADDR(sbi)))
fio.rw &= ~REQ_META; fio.op_flags &= ~REQ_META;
set_page_writeback(page); set_page_writeback(page);
f2fs_submit_page_mbio(&fio); f2fs_submit_page_mbio(&fio);
......
...@@ -25,11 +25,11 @@ static inline void __print_last_io(void) ...@@ -25,11 +25,11 @@ static inline void __print_last_io(void)
if (!last_io.len) if (!last_io.len)
return; return;
trace_printk("%3x:%3x %4x %-16s %2x %5x %12x %4x\n", trace_printk("%3x:%3x %4x %-16s %2x %5x %5x %12x %4x\n",
last_io.major, last_io.minor, last_io.major, last_io.minor,
last_io.pid, "----------------", last_io.pid, "----------------",
last_io.type, last_io.type,
last_io.fio.rw, last_io.fio.op, last_io.fio.op_flags,
last_io.fio.new_blkaddr, last_io.fio.new_blkaddr,
last_io.len); last_io.len);
memset(&last_io, 0, sizeof(last_io)); memset(&last_io, 0, sizeof(last_io));
...@@ -101,7 +101,8 @@ void f2fs_trace_ios(struct f2fs_io_info *fio, int flush) ...@@ -101,7 +101,8 @@ void f2fs_trace_ios(struct f2fs_io_info *fio, int flush)
if (last_io.major == major && last_io.minor == minor && if (last_io.major == major && last_io.minor == minor &&
last_io.pid == pid && last_io.pid == pid &&
last_io.type == __file_type(inode, pid) && last_io.type == __file_type(inode, pid) &&
last_io.fio.rw == fio->rw && last_io.fio.op == fio->op &&
last_io.fio.op_flags == fio->op_flags &&
last_io.fio.new_blkaddr + last_io.len == last_io.fio.new_blkaddr + last_io.len ==
fio->new_blkaddr) { fio->new_blkaddr) {
last_io.len++; last_io.len++;
......
...@@ -56,17 +56,21 @@ TRACE_DEFINE_ENUM(CP_DISCARD); ...@@ -56,17 +56,21 @@ TRACE_DEFINE_ENUM(CP_DISCARD);
{ IPU, "IN-PLACE" }, \ { IPU, "IN-PLACE" }, \
{ OPU, "OUT-OF-PLACE" }) { OPU, "OUT-OF-PLACE" })
#define F2FS_BIO_MASK(t) (t & (READA | WRITE_FLUSH_FUA)) #define F2FS_BIO_FLAG_MASK(t) (t & (READA | WRITE_FLUSH_FUA))
#define F2FS_BIO_EXTRA_MASK(t) (t & (REQ_META | REQ_PRIO)) #define F2FS_BIO_EXTRA_MASK(t) (t & (REQ_META | REQ_PRIO))
#define show_bio_type(type) show_bio_base(type), show_bio_extra(type) #define show_bio_type(op, op_flags) show_bio_op(op), \
show_bio_op_flags(op_flags), show_bio_extra(op_flags)
#define show_bio_base(type) \ #define show_bio_op(op) \
__print_symbolic(F2FS_BIO_MASK(type), \ __print_symbolic(op, \
{ READ, "READ" }, \ { READ, "READ" }, \
{ WRITE, "WRITE" })
#define show_bio_op_flags(flags) \
__print_symbolic(F2FS_BIO_FLAG_MASK(flags), \
{ READA, "READAHEAD" }, \ { READA, "READAHEAD" }, \
{ READ_SYNC, "READ_SYNC" }, \ { READ_SYNC, "READ_SYNC" }, \
{ WRITE, "WRITE" }, \
{ WRITE_SYNC, "WRITE_SYNC" }, \ { WRITE_SYNC, "WRITE_SYNC" }, \
{ WRITE_FLUSH, "WRITE_FLUSH" }, \ { WRITE_FLUSH, "WRITE_FLUSH" }, \
{ WRITE_FUA, "WRITE_FUA" }, \ { WRITE_FUA, "WRITE_FUA" }, \
...@@ -734,7 +738,8 @@ DECLARE_EVENT_CLASS(f2fs__submit_page_bio, ...@@ -734,7 +738,8 @@ DECLARE_EVENT_CLASS(f2fs__submit_page_bio,
__field(pgoff_t, index) __field(pgoff_t, index)
__field(block_t, old_blkaddr) __field(block_t, old_blkaddr)
__field(block_t, new_blkaddr) __field(block_t, new_blkaddr)
__field(int, rw) __field(int, op)
__field(int, op_flags)
__field(int, type) __field(int, type)
), ),
...@@ -744,17 +749,18 @@ DECLARE_EVENT_CLASS(f2fs__submit_page_bio, ...@@ -744,17 +749,18 @@ DECLARE_EVENT_CLASS(f2fs__submit_page_bio,
__entry->index = page->index; __entry->index = page->index;
__entry->old_blkaddr = fio->old_blkaddr; __entry->old_blkaddr = fio->old_blkaddr;
__entry->new_blkaddr = fio->new_blkaddr; __entry->new_blkaddr = fio->new_blkaddr;
__entry->rw = fio->rw; __entry->op = fio->op;
__entry->op_flags = fio->op_flags;
__entry->type = fio->type; __entry->type = fio->type;
), ),
TP_printk("dev = (%d,%d), ino = %lu, page_index = 0x%lx, " TP_printk("dev = (%d,%d), ino = %lu, page_index = 0x%lx, "
"oldaddr = 0x%llx, newaddr = 0x%llx rw = %s%s, type = %s", "oldaddr = 0x%llx, newaddr = 0x%llx rw = %s%si%s, type = %s",
show_dev_ino(__entry), show_dev_ino(__entry),
(unsigned long)__entry->index, (unsigned long)__entry->index,
(unsigned long long)__entry->old_blkaddr, (unsigned long long)__entry->old_blkaddr,
(unsigned long long)__entry->new_blkaddr, (unsigned long long)__entry->new_blkaddr,
show_bio_type(__entry->rw), show_bio_type(__entry->op, __entry->op_flags),
show_block_type(__entry->type)) show_block_type(__entry->type))
); );
...@@ -785,7 +791,8 @@ DECLARE_EVENT_CLASS(f2fs__submit_bio, ...@@ -785,7 +791,8 @@ DECLARE_EVENT_CLASS(f2fs__submit_bio,
TP_STRUCT__entry( TP_STRUCT__entry(
__field(dev_t, dev) __field(dev_t, dev)
__field(int, rw) __field(int, op)
__field(int, op_flags)
__field(int, type) __field(int, type)
__field(sector_t, sector) __field(sector_t, sector)
__field(unsigned int, size) __field(unsigned int, size)
...@@ -793,15 +800,16 @@ DECLARE_EVENT_CLASS(f2fs__submit_bio, ...@@ -793,15 +800,16 @@ DECLARE_EVENT_CLASS(f2fs__submit_bio,
TP_fast_assign( TP_fast_assign(
__entry->dev = sb->s_dev; __entry->dev = sb->s_dev;
__entry->rw = fio->rw; __entry->op = fio->op;
__entry->op_flags = fio->op_flags;
__entry->type = fio->type; __entry->type = fio->type;
__entry->sector = bio->bi_iter.bi_sector; __entry->sector = bio->bi_iter.bi_sector;
__entry->size = bio->bi_iter.bi_size; __entry->size = bio->bi_iter.bi_size;
), ),
TP_printk("dev = (%d,%d), %s%s, %s, sector = %lld, size = %u", TP_printk("dev = (%d,%d), %s%s%s, %s, sector = %lld, size = %u",
show_dev(__entry), show_dev(__entry),
show_bio_type(__entry->rw), show_bio_type(__entry->op, __entry->op_flags),
show_block_type(__entry->type), show_block_type(__entry->type),
(unsigned long long)__entry->sector, (unsigned long long)__entry->sector,
__entry->size) __entry->size)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment