[PATCH v2 01/16] FS: Added demand paging markers to filesystem

From: Venkatraman S
Date: Thu May 03 2012 - 10:31:29 EST


From: Ilan Smith <ilan.smith@xxxxxxxxxxx>

Add attribute to identify demand paging requests.
Mark readpages with demand paging attribute.

Signed-off-by: Ilan Smith <ilan.smith@xxxxxxxxxxx>
Signed-off-by: Alex Lemberg <alex.lemberg@xxxxxxxxxxx>
Signed-off-by: Venkatraman S <svenkatr@xxxxxx>
---
fs/mpage.c | 2 ++
include/linux/bio.h | 7 +++++++
include/linux/blk_types.h | 2 ++
3 files changed, 11 insertions(+)

diff --git a/fs/mpage.c b/fs/mpage.c
index 0face1c..8b144f5 100644
--- a/fs/mpage.c
+++ b/fs/mpage.c
@@ -386,6 +386,8 @@ mpage_readpages(struct address_space *mapping, struct list_head *pages,
&last_block_in_bio, &map_bh,
&first_logical_block,
get_block);
+ if (bio)
+ bio->bi_rw |= REQ_RW_DMPG;
}
page_cache_release(page);
}
diff --git a/include/linux/bio.h b/include/linux/bio.h
index 4d94eb8..264e0ef 100644
--- a/include/linux/bio.h
+++ b/include/linux/bio.h
@@ -57,6 +57,13 @@
(bio)->bi_rw |= ((unsigned long) (prio) << BIO_PRIO_SHIFT); \
} while (0)

+static inline bool bio_rw_flagged(struct bio *bio, unsigned long flag)
+{
+ return ((bio->bi_rw & flag) != 0);
+}
+
+#define bio_dmpg(bio) bio_rw_flagged(bio, REQ_RW_DMPG)
+
/*
* various member access, note that bio_data should of course not be used
* on highmem page vectors
diff --git a/include/linux/blk_types.h b/include/linux/blk_types.h
index 4053cbd..87feb80 100644
--- a/include/linux/blk_types.h
+++ b/include/linux/blk_types.h
@@ -150,6 +150,7 @@ enum rq_flag_bits {
__REQ_FLUSH_SEQ, /* request for flush sequence */
__REQ_IO_STAT, /* account I/O stat */
__REQ_MIXED_MERGE, /* merge of different types, fail separately */
+ __REQ_RW_DMPG,
__REQ_NR_BITS, /* stops here */
};

@@ -191,5 +192,6 @@ enum rq_flag_bits {
#define REQ_IO_STAT (1 << __REQ_IO_STAT)
#define REQ_MIXED_MERGE (1 << __REQ_MIXED_MERGE)
#define REQ_SECURE (1 << __REQ_SECURE)
+#define REQ_RW_DMPG (1 << __REQ_RW_DMPG)

#endif /* __LINUX_BLK_TYPES_H */
--
1.7.10.rc2

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/