aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/fs.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/fs.h')
-rw-r--r--include/linux/fs.h61
1 files changed, 6 insertions, 55 deletions
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 29cb32d3a849..d33beadd9a43 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -695,16 +695,12 @@ struct fown_struct {
695 695
696/* 696/*
697 * Track a single file's readahead state 697 * Track a single file's readahead state
698 *
699 * ================#============|==================#==================|
700 * ^ ^ ^ ^
701 * file_ra_state.la_index .ra_index .lookahead_index .readahead_index
702 */ 698 */
703struct file_ra_state { 699struct file_ra_state {
704 pgoff_t la_index; /* enqueue time */ 700 pgoff_t start; /* where readahead started */
705 pgoff_t ra_index; /* begin offset */ 701 unsigned long size; /* # of readahead pages */
706 pgoff_t lookahead_index; /* time to do next readahead */ 702 unsigned long async_size; /* do asynchronous readahead when
707 pgoff_t readahead_index; /* end offset */ 703 there are only # of pages ahead */
708 704
709 unsigned long ra_pages; /* Maximum readahead window */ 705 unsigned long ra_pages; /* Maximum readahead window */
710 unsigned long mmap_hit; /* Cache hit stat for mmap accesses */ 706 unsigned long mmap_hit; /* Cache hit stat for mmap accesses */
@@ -714,59 +710,14 @@ struct file_ra_state {
714}; 710};
715 711
716/* 712/*
717 * Measuring read-ahead sizes.
718 *
719 * |----------- readahead size ------------>|
720 * ===#============|==================#=====================|
721 * |------- invoke interval ------>|-- lookahead size -->|
722 */
723static inline unsigned long ra_readahead_size(struct file_ra_state *ra)
724{
725 return ra->readahead_index - ra->ra_index;
726}
727
728static inline unsigned long ra_lookahead_size(struct file_ra_state *ra)
729{
730 return ra->readahead_index - ra->lookahead_index;
731}
732
733static inline unsigned long ra_invoke_interval(struct file_ra_state *ra)
734{
735 return ra->lookahead_index - ra->la_index;
736}
737
738/*
739 * Check if @index falls in the readahead windows. 713 * Check if @index falls in the readahead windows.
740 */ 714 */
741static inline int ra_has_index(struct file_ra_state *ra, pgoff_t index) 715static inline int ra_has_index(struct file_ra_state *ra, pgoff_t index)
742{ 716{
743 return (index >= ra->la_index && 717 return (index >= ra->start &&
744 index < ra->readahead_index); 718 index < ra->start + ra->size);
745}
746
747/*
748 * Where is the old read-ahead and look-ahead?
749 */
750static inline void ra_set_index(struct file_ra_state *ra,
751 pgoff_t la_index, pgoff_t ra_index)
752{
753 ra->la_index = la_index;
754 ra->ra_index = ra_index;
755} 719}
756 720
757/*
758 * Where is the new read-ahead and look-ahead?
759 */
760static inline void ra_set_size(struct file_ra_state *ra,
761 unsigned long ra_size, unsigned long la_size)
762{
763 ra->readahead_index = ra->ra_index + ra_size;
764 ra->lookahead_index = ra->ra_index + ra_size - la_size;
765}
766
767unsigned long ra_submit(struct file_ra_state *ra,
768 struct address_space *mapping, struct file *filp);
769
770struct file { 721struct file {
771 /* 722 /*
772 * fu_list becomes invalid after file_free is called and queued via 723 * fu_list becomes invalid after file_free is called and queued via