]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
f2fs: use BIO_MAX_PAGES for bio allocation
authorJaegeuk Kim <jaegeuk@kernel.org>
Tue, 18 Oct 2016 18:07:45 +0000 (11:07 -0700)
committerJaegeuk Kim <jaegeuk@kernel.org>
Wed, 23 Nov 2016 20:11:07 +0000 (12:11 -0800)
We don't need to allocate bio partially in order to maximize sequential writes.

Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
fs/f2fs/checkpoint.c
fs/f2fs/data.c
fs/f2fs/node.c
fs/f2fs/segment.c
fs/f2fs/segment.h

index 654f5d7f92889a71633ea0caeca6dbf399a7b21c..157b7fdc2c676720a0b71c99dbe3e88d4717f5c7 100644 (file)
@@ -228,7 +228,7 @@ void ra_meta_pages_cond(struct f2fs_sb_info *sbi, pgoff_t index)
        f2fs_put_page(page, 0);
 
        if (readahead)
-               ra_meta_pages(sbi, index, MAX_BIO_BLOCKS(sbi), META_POR, true);
+               ra_meta_pages(sbi, index, BIO_MAX_PAGES, META_POR, true);
 }
 
 static int f2fs_write_meta_page(struct page *page,
index b544e0b2e7e5174a1bfadd4f74ffad76a9217427..68edb47f5f71dbccfc26a3ef7365e622c3524a90 100644 (file)
@@ -277,10 +277,8 @@ void f2fs_submit_page_mbio(struct f2fs_io_info *fio)
                __submit_merged_bio(io);
 alloc_new:
        if (io->bio == NULL) {
-               int bio_blocks = MAX_BIO_BLOCKS(sbi);
-
                io->bio = __bio_alloc(sbi, fio->new_blkaddr,
-                                               bio_blocks, is_read);
+                                               BIO_MAX_PAGES, is_read);
                io->fio = *fio;
        }
 
index 74125b13d1aff4a16c3d87002a2fb10f5a44fd9e..38cc07d49ff3491a78ab7e99147dc50e09f43cf4 100644 (file)
@@ -2098,7 +2098,6 @@ int restore_node_summary(struct f2fs_sb_info *sbi,
        struct f2fs_node *rn;
        struct f2fs_summary *sum_entry;
        block_t addr;
-       int bio_blocks = MAX_BIO_BLOCKS(sbi);
        int i, idx, last_offset, nrpages;
 
        /* scan the node segment */
@@ -2107,7 +2106,7 @@ int restore_node_summary(struct f2fs_sb_info *sbi,
        sum_entry = &sum->entries[0];
 
        for (i = 0; i < last_offset; i += nrpages, addr += nrpages) {
-               nrpages = min(last_offset - i, bio_blocks);
+               nrpages = min(last_offset - i, BIO_MAX_PAGES);
 
                /* readahead node pages */
                ra_meta_pages(sbi, addr, nrpages, META_POR, true);
index de597ccdd107fe62b0d815b60e4a7b0191533d91..dcd85d33b91d6153e1b90ddb7a045d02cf7474b0 100644 (file)
@@ -2317,10 +2317,10 @@ static void build_sit_entries(struct f2fs_sb_info *sbi)
        int sit_blk_cnt = SIT_BLK_CNT(sbi);
        unsigned int i, start, end;
        unsigned int readed, start_blk = 0;
-       int nrpages = MAX_BIO_BLOCKS(sbi) * 8;
 
        do {
-               readed = ra_meta_pages(sbi, start_blk, nrpages, META_SIT, true);
+               readed = ra_meta_pages(sbi, start_blk, BIO_MAX_PAGES,
+                                                       META_SIT, true);
 
                start = start_blk * sit_i->sents_per_block;
                end = (start_blk + readed) * sit_i->sents_per_block;
index 76274398842692f4238671de311c8d919e1f3ab0..89ab4301ef02ae242ec96b0c4874030c9444d0ef 100644 (file)
        (((sector_t)blk_addr) << F2FS_LOG_SECTORS_PER_BLOCK)
 #define SECTOR_TO_BLOCK(sectors)                                       \
        (sectors >> F2FS_LOG_SECTORS_PER_BLOCK)
-#define MAX_BIO_BLOCKS(sbi)                                            \
-       ((int)min((int)max_hw_blocks(sbi), BIO_MAX_PAGES))
 
 /*
  * indicate a block allocation direction: RIGHT and LEFT.
@@ -696,13 +694,6 @@ static inline bool sec_usage_check(struct f2fs_sb_info *sbi, unsigned int secno)
        return false;
 }
 
-static inline unsigned int max_hw_blocks(struct f2fs_sb_info *sbi)
-{
-       struct block_device *bdev = sbi->sb->s_bdev;
-       struct request_queue *q = bdev_get_queue(bdev);
-       return SECTOR_TO_BLOCK(queue_max_sectors(q));
-}
-
 /*
  * It is very important to gather dirty pages and write at once, so that we can
  * submit a big bio without interfering other data writes.
@@ -720,7 +711,7 @@ static inline int nr_pages_to_skip(struct f2fs_sb_info *sbi, int type)
        else if (type == NODE)
                return 8 * sbi->blocks_per_seg;
        else if (type == META)
-               return 8 * MAX_BIO_BLOCKS(sbi);
+               return 8 * BIO_MAX_PAGES;
        else
                return 0;
 }
@@ -737,11 +728,9 @@ static inline long nr_pages_to_write(struct f2fs_sb_info *sbi, int type,
                return 0;
 
        nr_to_write = wbc->nr_to_write;
-
+       desired = BIO_MAX_PAGES;
        if (type == NODE)
-               desired = 2 * max_hw_blocks(sbi);
-       else
-               desired = MAX_BIO_BLOCKS(sbi);
+               desired <<= 1;
 
        wbc->nr_to_write = desired;
        return desired - nr_to_write;