Example #1
0
void f2fs_submit_page_mbio(struct f2fs_io_info *fio)
{
    struct f2fs_sb_info *sbi = fio->sbi;
    enum page_type btype = PAGE_TYPE_OF_BIO(fio->type);
    struct f2fs_bio_info *io;
    bool is_read = is_read_io(fio->rw);
    struct page *bio_page;

    io = is_read ? &sbi->read_io : &sbi->write_io[btype];

    verify_block_addr(sbi, fio->blk_addr);

    down_write(&io->io_rwsem);

    if (!is_read)
        inc_page_count(sbi, F2FS_WRITEBACK);

    if (io->bio && (io->last_block_in_bio != fio->blk_addr - 1 ||
                    io->fio.rw != fio->rw))
        __submit_merged_bio(io);
alloc_new:
    if (io->bio == NULL) {
        int bio_blocks = MAX_BIO_BLOCKS(sbi);

        io->bio = __bio_alloc(sbi, fio->blk_addr, bio_blocks, is_read);
        io->fio = *fio;
    }

    bio_page = fio->encrypted_page ? fio->encrypted_page : fio->page;

    if (bio_add_page(io->bio, bio_page, PAGE_CACHE_SIZE, 0) <
            PAGE_CACHE_SIZE) {
        __submit_merged_bio(io);
        goto alloc_new;
    }

    io->last_block_in_bio = fio->blk_addr;
    f2fs_trace_ios(fio, 0);

    up_write(&io->io_rwsem);
    trace_f2fs_submit_page_mbio(fio->page, fio);
}
Example #2
0
	/// Increase the count of a list of pages.
	inline void inc_pages_count(const std::list<Page> &pages) {
	    std::list<Page>::const_iterator it;
	    for (it = pages.begin(); it != pages.end(); ++it) {
		inc_page_count(*it);
	    }
	};