Commit dc5798d9 authored by Dave Kleikamp's avatar Dave Kleikamp Committed by Linus Torvalds

[PATCH] JFS: Changes for larger page size

JFS code has always assumed a page size of 4K.  This patch fixes the
non-pagecache uses of pages to deal with larger pages.
Signed-off-by: default avatarDave Kleikamp <shaggy@austin.ibm.com>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent d2e83707
...@@ -3181,7 +3181,7 @@ int jfs_readdir(struct file *filp, void *dirent, filldir_t filldir) ...@@ -3181,7 +3181,7 @@ int jfs_readdir(struct file *filp, void *dirent, filldir_t filldir)
d = (struct ldtentry *) & p->slot[stbl[i]]; d = (struct ldtentry *) & p->slot[stbl[i]];
if (((long) jfs_dirent + d->namlen + 1) > if (((long) jfs_dirent + d->namlen + 1) >
(dirent_buf + PSIZE)) { (dirent_buf + PAGE_SIZE)) {
/* DBCS codepages could overrun dirent_buf */ /* DBCS codepages could overrun dirent_buf */
index = i; index = i;
overflow = 1; overflow = 1;
......
...@@ -1669,6 +1669,7 @@ int lmLogShutdown(struct jfs_log * log) ...@@ -1669,6 +1669,7 @@ int lmLogShutdown(struct jfs_log * log)
lp->h.eor = lp->t.eor = cpu_to_le16(bp->l_eor); lp->h.eor = lp->t.eor = cpu_to_le16(bp->l_eor);
lbmWrite(log, log->bp, lbmWRITE | lbmRELEASE | lbmSYNC, 0); lbmWrite(log, log->bp, lbmWRITE | lbmRELEASE | lbmSYNC, 0);
lbmIOWait(log->bp, lbmFREE); lbmIOWait(log->bp, lbmFREE);
log->bp = NULL;
/* /*
* synchronous update log superblock * synchronous update log superblock
...@@ -1819,20 +1820,34 @@ static int lbmLogInit(struct jfs_log * log) ...@@ -1819,20 +1820,34 @@ static int lbmLogInit(struct jfs_log * log)
log->lbuf_free = NULL; log->lbuf_free = NULL;
for (i = 0; i < LOGPAGES; i++) { for (i = 0; i < LOGPAGES;) {
lbuf = kmalloc(sizeof(struct lbuf), GFP_KERNEL); char *buffer;
if (lbuf == 0) uint offset;
struct page *page;
buffer = (char *) get_zeroed_page(GFP_KERNEL);
if (buffer == NULL)
goto error; goto error;
lbuf->l_ldata = (char *) get_zeroed_page(GFP_KERNEL); page = virt_to_page(buffer);
if (lbuf->l_ldata == 0) { for (offset = 0; offset < PAGE_SIZE; offset += LOGPSIZE) {
kfree(lbuf); lbuf = kmalloc(sizeof(struct lbuf), GFP_KERNEL);
if (lbuf == NULL) {
if (offset == 0)
free_page((unsigned long) buffer);
goto error; goto error;
} }
if (offset) /* we already have one reference */
get_page(page);
lbuf->l_offset = offset;
lbuf->l_ldata = buffer + offset;
lbuf->l_page = page;
lbuf->l_log = log; lbuf->l_log = log;
init_waitqueue_head(&lbuf->l_ioevent); init_waitqueue_head(&lbuf->l_ioevent);
lbuf->l_freelist = log->lbuf_free; lbuf->l_freelist = log->lbuf_free;
log->lbuf_free = lbuf; log->lbuf_free = lbuf;
i++;
}
} }
return (0); return (0);
...@@ -1857,12 +1872,10 @@ static void lbmLogShutdown(struct jfs_log * log) ...@@ -1857,12 +1872,10 @@ static void lbmLogShutdown(struct jfs_log * log)
lbuf = log->lbuf_free; lbuf = log->lbuf_free;
while (lbuf) { while (lbuf) {
struct lbuf *next = lbuf->l_freelist; struct lbuf *next = lbuf->l_freelist;
free_page((unsigned long) lbuf->l_ldata); __free_page(lbuf->l_page);
kfree(lbuf); kfree(lbuf);
lbuf = next; lbuf = next;
} }
log->bp = NULL;
} }
...@@ -1974,9 +1987,9 @@ static int lbmRead(struct jfs_log * log, int pn, struct lbuf ** bpp) ...@@ -1974,9 +1987,9 @@ static int lbmRead(struct jfs_log * log, int pn, struct lbuf ** bpp)
bio->bi_sector = bp->l_blkno << (log->l2bsize - 9); bio->bi_sector = bp->l_blkno << (log->l2bsize - 9);
bio->bi_bdev = log->bdev; bio->bi_bdev = log->bdev;
bio->bi_io_vec[0].bv_page = virt_to_page(bp->l_ldata); bio->bi_io_vec[0].bv_page = bp->l_page;
bio->bi_io_vec[0].bv_len = LOGPSIZE; bio->bi_io_vec[0].bv_len = LOGPSIZE;
bio->bi_io_vec[0].bv_offset = 0; bio->bi_io_vec[0].bv_offset = bp->l_offset;
bio->bi_vcnt = 1; bio->bi_vcnt = 1;
bio->bi_idx = 0; bio->bi_idx = 0;
...@@ -2115,9 +2128,9 @@ static void lbmStartIO(struct lbuf * bp) ...@@ -2115,9 +2128,9 @@ static void lbmStartIO(struct lbuf * bp)
bio = bio_alloc(GFP_NOFS, 1); bio = bio_alloc(GFP_NOFS, 1);
bio->bi_sector = bp->l_blkno << (log->l2bsize - 9); bio->bi_sector = bp->l_blkno << (log->l2bsize - 9);
bio->bi_bdev = log->bdev; bio->bi_bdev = log->bdev;
bio->bi_io_vec[0].bv_page = virt_to_page(bp->l_ldata); bio->bi_io_vec[0].bv_page = bp->l_page;
bio->bi_io_vec[0].bv_len = LOGPSIZE; bio->bi_io_vec[0].bv_len = LOGPSIZE;
bio->bi_io_vec[0].bv_offset = 0; bio->bi_io_vec[0].bv_offset = bp->l_offset;
bio->bi_vcnt = 1; bio->bi_vcnt = 1;
bio->bi_idx = 0; bio->bi_idx = 0;
...@@ -2127,16 +2140,13 @@ static void lbmStartIO(struct lbuf * bp) ...@@ -2127,16 +2140,13 @@ static void lbmStartIO(struct lbuf * bp)
bio->bi_private = bp; bio->bi_private = bp;
/* check if journaling to disk has been disabled */ /* check if journaling to disk has been disabled */
if (!log->no_integrity) { if (log->no_integrity) {
bio->bi_size = 0;
lbmIODone(bio, 0, 0);
} else {
submit_bio(WRITE_SYNC, bio); submit_bio(WRITE_SYNC, bio);
INCREMENT(lmStat.submitted); INCREMENT(lmStat.submitted);
} }
else {
bio->bi_size = 0;
lbmIODone(bio, 0, 0); /* 2nd argument appears to not be used => 0
* 3rd argument appears to not be used => 0
*/
}
} }
......
...@@ -463,9 +463,10 @@ struct lbuf { ...@@ -463,9 +463,10 @@ struct lbuf {
s64 l_blkno; /* 8: log page block number */ s64 l_blkno; /* 8: log page block number */
caddr_t l_ldata; /* 4: data page */ caddr_t l_ldata; /* 4: data page */
struct page *l_page; /* The page itself */
uint l_offset; /* Offset of l_ldata within the page */
wait_queue_head_t l_ioevent; /* 4: i/o done event */ wait_queue_head_t l_ioevent; /* 4: i/o done event */
struct page *l_page; /* The page itself */
}; };
/* Reuse l_freelist for redrive list */ /* Reuse l_freelist for redrive list */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment