From: Hugh Dickins <hugh@veritas.com>
To: Christoph Lameter <clameter@sgi.com>
Cc: linux-kernel@vger.kernel.org
Subject: [PATCH 6/6] LBS: support largeblocked swapfile
Date: Fri, 21 Sep 2007 21:48:06 +0100 (BST) [thread overview]
Message-ID: <Pine.LNX.4.64.0709212147270.13529@blonde.wat.veritas.com> (raw)
In-Reply-To: <Pine.LNX.4.64.0709212141220.6532@blonde.wat.veritas.com>
Adjust setup_swap_extents so as not to assume that PAGE_SIZE is a multiple
of its swapfile blocksize: blocksize might now be a multiple of PAGE_SIZE.
Not vital to support this, but LTP in ext2 -b 32768 /tmp was failing before.
Signed-off-by: Hugh Dickins <hugh@veritas.com>
--- 2.6.23-rc6-lbs/mm/swapfile.c 2007-08-04 07:08:50.000000000 +0100
+++ linux/mm/swapfile.c 2007-09-17 17:09:03.000000000 +0100
@@ -1057,6 +1057,7 @@ static int setup_swap_extents(struct swa
{
struct inode *inode;
unsigned blocks_per_page;
+ unsigned pages_per_block;
unsigned long page_no;
unsigned blkbits;
sector_t probe_block;
@@ -1074,7 +1075,13 @@ static int setup_swap_extents(struct swa
}
blkbits = inode->i_blkbits;
- blocks_per_page = PAGE_SIZE >> blkbits;
+ if (blkbits <= PAGE_SHIFT) {
+ blocks_per_page = 1 << (PAGE_SHIFT - blkbits);
+ pages_per_block = 1;
+ } else {
+ blocks_per_page = 1;
+ pages_per_block = 1 << (blkbits - PAGE_SHIFT);
+ }
/*
* Map all the blocks into the extent list. This code doesn't try
@@ -1114,28 +1121,34 @@ static int setup_swap_extents(struct swa
}
}
- first_block >>= (PAGE_SHIFT - blkbits);
+ if (blkbits <= PAGE_SHIFT)
+ first_block >>= (PAGE_SHIFT - blkbits);
+ else {
+ first_block <<= (blkbits - PAGE_SHIFT);
+ if (page_no + pages_per_block > sis->max)
+ pages_per_block = sis->max - page_no;
+ }
if (page_no) { /* exclude the header page */
if (first_block < lowest_block)
lowest_block = first_block;
- if (first_block > highest_block)
- highest_block = first_block;
+ if (first_block >= highest_block)
+ highest_block = first_block + pages_per_block;
}
/*
* We found a PAGE_SIZE-length, PAGE_SIZE-aligned run of blocks
*/
- ret = add_swap_extent(sis, page_no, 1, first_block);
+ ret = add_swap_extent(sis,page_no,pages_per_block,first_block);
if (ret < 0)
goto out;
nr_extents += ret;
- page_no++;
+ page_no += pages_per_block;
probe_block += blocks_per_page;
reprobe:
continue;
}
ret = nr_extents;
- *span = 1 + highest_block - lowest_block;
+ *span = highest_block - lowest_block;
if (page_no == 0)
page_no = 1; /* force Empty message */
sis->max = page_no;
prev parent reply other threads:[~2007-09-21 21:01 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-09-21 20:42 [PATCH 1/6] LBS: fix unexported swapper_space Hugh Dickins
2007-09-21 20:45 ` [PATCH 2/6] LBS: fix uninitialized swapper_space Hugh Dickins
2007-09-24 21:16 ` Christoph Lameter
2007-09-26 18:34 ` Hugh Dickins
2007-09-26 18:44 ` Christoph Lameter
2007-09-21 20:45 ` [PATCH 3/6] LBS: fix hang in isolate_lru_pages Hugh Dickins
2007-09-21 20:46 ` [PATCH 4/6] LBS: fix oops in try_to_release_page Hugh Dickins
2007-09-21 20:47 ` [PATCH 5/6] LBS: fix crashes in vma_address Hugh Dickins
2007-09-21 20:48 ` Hugh Dickins [this message]
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=Pine.LNX.4.64.0709212147270.13529@blonde.wat.veritas.com \
--to=hugh@veritas.com \
--cc=clameter@sgi.com \
--cc=linux-kernel@vger.kernel.org \
/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
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®