diff options
author | Fengguang Wu <wfg@mail.ustc.edu.cn> | 2007-07-19 04:48:08 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-07-19 13:04:44 -0400 |
commit | f9acc8c7b35a100f3a9e0e6977f7807b0169f9a5 (patch) | |
tree | 6a4dcd227bb698a217a1d42d37e3f0135a444ea4 /include/linux/fs.h | |
parent | cf914a7d656e62b9dd3e0dffe4f62b953ae6048d (diff) |
readahead: sanify file_ra_state names
Rename some file_ra_state variables and remove some accessors.
It results in much simpler code.
Kudos to Rusty!
Signed-off-by: Fengguang Wu <wfg@mail.ustc.edu.cn>
Cc: Rusty Russell <rusty@rustcorp.com.au>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'include/linux/fs.h')
-rw-r--r-- | include/linux/fs.h | 61 |
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 | */ |
703 | struct file_ra_state { | 699 | struct 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 | */ | ||
723 | static inline unsigned long ra_readahead_size(struct file_ra_state *ra) | ||
724 | { | ||
725 | return ra->readahead_index - ra->ra_index; | ||
726 | } | ||
727 | |||
728 | static inline unsigned long ra_lookahead_size(struct file_ra_state *ra) | ||
729 | { | ||
730 | return ra->readahead_index - ra->lookahead_index; | ||
731 | } | ||
732 | |||
733 | static 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 | */ |
741 | static inline int ra_has_index(struct file_ra_state *ra, pgoff_t index) | 715 | static 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 | */ | ||
750 | static 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 | */ | ||
760 | static 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 | |||
767 | unsigned long ra_submit(struct file_ra_state *ra, | ||
768 | struct address_space *mapping, struct file *filp); | ||
769 | |||
770 | struct file { | 721 | struct 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 |