Linux-EROFS Archive on lore.kernel.org
 help / color / Atom feed
From: Gao Xiang <hsiangkao@redhat.com>
To: linux-erofs@lists.ozlabs.org, Chao Yu <yuchao0@huawei.com>
Cc: LKML <linux-kernel@vger.kernel.org>
Subject: [PATCH 4/4] erofs: add REQ_RAHEAD flag to readahead requests
Date: Fri, 18 Sep 2020 21:54:36 +0800
Message-ID: <20200918135436.17689-4-hsiangkao@redhat.com> (raw)
In-Reply-To: <20200918135436.17689-1-hsiangkao@redhat.com>

Let's add REQ_RAHEAD flag so it'd be easier to identify
readahead I/O requests in blktrace.

Signed-off-by: Gao Xiang <hsiangkao@redhat.com>
---
 fs/erofs/data.c  | 2 +-
 fs/erofs/zdata.c | 4 ++++
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/fs/erofs/data.c b/fs/erofs/data.c
index 459ecb42cbd3..347be146884c 100644
--- a/fs/erofs/data.c
+++ b/fs/erofs/data.c
@@ -224,7 +224,7 @@ static inline struct bio *erofs_read_raw_page(struct bio *bio,
 		bio_set_dev(bio, sb->s_bdev);
 		bio->bi_iter.bi_sector = (sector_t)blknr <<
 			LOG_SECTORS_PER_BLOCK;
-		bio->bi_opf = REQ_OP_READ;
+		bio->bi_opf = REQ_OP_READ | (ra ? REQ_RAHEAD : 0);
 	}
 
 	err = bio_add_page(bio, page, PAGE_SIZE, 0);
diff --git a/fs/erofs/zdata.c b/fs/erofs/zdata.c
index bb20f73f10e0..23940edf16ce 100644
--- a/fs/erofs/zdata.c
+++ b/fs/erofs/zdata.c
@@ -136,6 +136,7 @@ struct z_erofs_decompress_frontend {
 	struct erofs_map_blocks map;
 
 	unsigned int compressedblock_total;
+	bool readahead;
 
 	/* used for applying cache strategy on the fly */
 	bool backmost;
@@ -1220,6 +1221,8 @@ static void z_erofs_submit_queue(struct super_block *sb,
 					LOG_SECTORS_PER_BLOCK;
 				bio->bi_private = bi_private;
 				bio->bi_opf = REQ_OP_READ;
+				if (f->readahead)
+					bio->bi_opf |= REQ_RAHEAD;
 				++nr_bios;
 			}
 
@@ -1318,6 +1321,7 @@ static void z_erofs_readahead(struct readahead_control *rac)
 
 	trace_erofs_readpages(inode, readahead_index(rac), nr_pages, false);
 
+	f.readahead = true;
 	f.headoffset = readahead_pos(rac);
 
 	while ((page = readahead_page(rac))) {
-- 
2.18.1


  parent reply index

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-18 13:54 [PATCH 1/4] erofs: avoid unnecessary variable `err' Gao Xiang
2020-09-18 13:54 ` [PATCH 2/4] erofs: fold in should_decompress_synchronously() Gao Xiang
2020-09-19  6:12   ` Chao Yu
2020-09-18 13:54 ` [PATCH 3/4] erofs: specify accurate nr_iovecs for compressed bios Gao Xiang
2020-09-19  4:50   ` Gao Xiang
2020-09-18 13:54 ` Gao Xiang [this message]
2020-09-19  6:20   ` [PATCH 4/4] erofs: add REQ_RAHEAD flag to readahead requests Chao Yu
2020-09-19  6:12 ` [PATCH 1/4] erofs: avoid unnecessary variable `err' Chao Yu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200918135436.17689-4-hsiangkao@redhat.com \
    --to=hsiangkao@redhat.com \
    --cc=linux-erofs@lists.ozlabs.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=yuchao0@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

Linux-EROFS Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-erofs/0 linux-erofs/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-erofs linux-erofs/ https://lore.kernel.org/linux-erofs \
		linux-erofs@lists.ozlabs.org linux-erofs@ozlabs.org
	public-inbox-index linux-erofs

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.ozlabs.lists.linux-erofs


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git