Messages in this thread Patch in this message | | | From | Nigel Cunningham <> | Subject | [Suspend2][ 04/35] [Suspend2] Does a filewriter page have contiguous blocks? | Date | Tue, 27 Jun 2006 08:39:17 +1000 |
| |
To simplify things, pages in the file being used by the filewriter which don't have contiguous blocks are ignored. This function determines whether a given page meets this criteria by bmapping each sector in the page to check.
Signed-off-by: Nigel Cunningham <nigel@suspend2.net>
kernel/power/suspend_file.c | 18 ++++++++++++++++++ 1 files changed, 18 insertions(+), 0 deletions(-)
diff --git a/kernel/power/suspend_file.c b/kernel/power/suspend_file.c index caa86bc..41aaed4 100644 --- a/kernel/power/suspend_file.c +++ b/kernel/power/suspend_file.c @@ -136,3 +136,21 @@ static int filewriter_storage_available( return result; } +static int has_contiguous_blocks(int page_num) +{ + int j; + sector_t last = 0; + + for (j = 0; j < devinfo.blocks_per_page; j++) { + sector_t this = bmap(target_inode, + page_num * devinfo.blocks_per_page + j); + + if (!this || (last && (last + 1) != this)) + break; + + last = this; + } + + return (j == devinfo.blocks_per_page); +} + -- Nigel Cunningham nigel at suspend2 dot net - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
| |