git://ftp.safe.ca
/
safe
/
jmp
/
linux-2.6
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge git://git.kernel.org/pub/scm/linux/kernel/git/sfrench/cifs-2.6
[safe/jmp/linux-2.6]
/
fs
/
jfs
/
jfs_metapage.c
diff --git
a/fs/jfs/jfs_metapage.c
b/fs/jfs/jfs_metapage.c
index
b27fa11
..
07b6c5d
100644
(file)
--- a/
fs/jfs/jfs_metapage.c
+++ b/
fs/jfs/jfs_metapage.c
@@
-19,10
+19,12
@@
#include <linux/fs.h>
#include <linux/mm.h>
#include <linux/fs.h>
#include <linux/mm.h>
+#include <linux/module.h>
#include <linux/bio.h>
#include <linux/init.h>
#include <linux/buffer_head.h>
#include <linux/mempool.h>
#include <linux/bio.h>
#include <linux/init.h>
#include <linux/buffer_head.h>
#include <linux/mempool.h>
+#include <linux/seq_file.h>
#include "jfs_incore.h"
#include "jfs_superblock.h"
#include "jfs_filsys.h"
#include "jfs_incore.h"
#include "jfs_superblock.h"
#include "jfs_filsys.h"
@@
-39,11
+41,11
@@
static struct {
#endif
#define metapage_locked(mp) test_bit(META_locked, &(mp)->flag)
#endif
#define metapage_locked(mp) test_bit(META_locked, &(mp)->flag)
-#define trylock_metapage(mp) test_and_set_bit(META_locked, &(mp)->flag)
+#define trylock_metapage(mp) test_and_set_bit
_lock
(META_locked, &(mp)->flag)
static inline void unlock_metapage(struct metapage *mp)
{
static inline void unlock_metapage(struct metapage *mp)
{
- clear_bit(META_locked, &mp->flag);
+ clear_bit
_unlock
(META_locked, &mp->flag);
wake_up(&mp->wait);
}
wake_up(&mp->wait);
}
@@
-88,7
+90,7
@@
struct meta_anchor {
};
#define mp_anchor(page) ((struct meta_anchor *)page_private(page))
};
#define mp_anchor(page) ((struct meta_anchor *)page_private(page))
-static inline struct metapage *page_to_mp(struct page *page,
u
int offset)
+static inline struct metapage *page_to_mp(struct page *page, int offset)
{
if (!PagePrivate(page))
return NULL;
{
if (!PagePrivate(page))
return NULL;
@@
-153,7
+155,7
@@
static inline void dec_io(struct page *page, void (*handler) (struct page *))
}
#else
}
#else
-static inline struct metapage *page_to_mp(struct page *page,
u
int offset)
+static inline struct metapage *page_to_mp(struct page *page, int offset)
{
return PagePrivate(page) ? (struct metapage *)page_private(page) : NULL;
}
{
return PagePrivate(page) ? (struct metapage *)page_private(page) : NULL;
}
@@
-180,7
+182,7
@@
static inline void remove_metapage(struct page *page, struct metapage *mp)
#endif
#endif
-static void init_once(
struct kmem_cache *cachep,
void *foo)
+static void init_once(void *foo)
{
struct metapage *mp = (struct metapage *)foo;
{
struct metapage *mp = (struct metapage *)foo;
@@
-249,7
+251,7
@@
static inline void drop_metapage(struct page *page, struct metapage *mp)
*/
static sector_t metapage_get_blocks(struct inode *inode, sector_t lblock,
*/
static sector_t metapage_get_blocks(struct inode *inode, sector_t lblock,
-
unsigned
int *len)
+ int *len)
{
int rc = 0;
int xflag;
{
int rc = 0;
int xflag;
@@
-352,11
+354,11
@@
static void metapage_write_end_io(struct bio *bio, int err)
static int metapage_writepage(struct page *page, struct writeback_control *wbc)
{
struct bio *bio = NULL;
static int metapage_writepage(struct page *page, struct writeback_control *wbc)
{
struct bio *bio = NULL;
-
unsigned int block_offset;
/* block offset of mp within page */
+
int block_offset;
/* block offset of mp within page */
struct inode *inode = page->mapping->host;
struct inode *inode = page->mapping->host;
-
unsigned
int blocks_per_mp = JFS_SBI(inode->i_sb)->nbperpage;
-
unsigned
int len;
-
unsigned
int xlen;
+ int blocks_per_mp = JFS_SBI(inode->i_sb)->nbperpage;
+ int len;
+ int xlen;
struct metapage *mp;
int redirty = 0;
sector_t lblock;
struct metapage *mp;
int redirty = 0;
sector_t lblock;
@@
-366,7
+368,8
@@
static int metapage_writepage(struct page *page, struct writeback_control *wbc)
sector_t page_start;
unsigned long bio_bytes = 0;
unsigned long bio_offset = 0;
sector_t page_start;
unsigned long bio_bytes = 0;
unsigned long bio_offset = 0;
- unsigned int offset;
+ int offset;
+ int bad_blocks = 0;
page_start = (sector_t)page->index <<
(PAGE_CACHE_SHIFT - inode->i_blkbits);
page_start = (sector_t)page->index <<
(PAGE_CACHE_SHIFT - inode->i_blkbits);
@@
-392,6
+395,7
@@
static int metapage_writepage(struct page *page, struct writeback_control *wbc)
}
clear_bit(META_dirty, &mp->flag);
}
clear_bit(META_dirty, &mp->flag);
+ set_bit(META_io, &mp->flag);
block_offset = offset >> inode->i_blkbits;
lblock = page_start + block_offset;
if (bio) {
block_offset = offset >> inode->i_blkbits;
lblock = page_start + block_offset;
if (bio) {
@@
-400,7
+404,6
@@
static int metapage_writepage(struct page *page, struct writeback_control *wbc)
len = min(xlen, blocks_per_mp);
xlen -= len;
bio_bytes += len << inode->i_blkbits;
len = min(xlen, blocks_per_mp);
xlen -= len;
bio_bytes += len << inode->i_blkbits;
- set_bit(META_io, &mp->flag);
continue;
}
/* Not contiguous */
continue;
}
/* Not contiguous */
@@
-422,13
+425,15
@@
static int metapage_writepage(struct page *page, struct writeback_control *wbc)
xlen = (PAGE_CACHE_SIZE - offset) >> inode->i_blkbits;
pblock = metapage_get_blocks(inode, lblock, &xlen);
if (!pblock) {
xlen = (PAGE_CACHE_SIZE - offset) >> inode->i_blkbits;
pblock = metapage_get_blocks(inode, lblock, &xlen);
if (!pblock) {
- /* Need better error handling */
printk(KERN_ERR "JFS: metapage_get_blocks failed\n");
printk(KERN_ERR "JFS: metapage_get_blocks failed\n");
- dec_io(page, last_write_complete);
+ /*
+ * We already called inc_io(), but can't cancel it
+ * with dec_io() until we're done with the page
+ */
+ bad_blocks++;
continue;
}
continue;
}
- set_bit(META_io, &mp->flag);
- len = min(xlen, (uint) JFS_SBI(inode->i_sb)->nbperpage);
+ len = min(xlen, (int)JFS_SBI(inode->i_sb)->nbperpage);
bio = bio_alloc(GFP_NOFS, 1);
bio->bi_bdev = inode->i_sb->s_bdev;
bio = bio_alloc(GFP_NOFS, 1);
bio->bi_bdev = inode->i_sb->s_bdev;
@@
-457,6
+462,9
@@
static int metapage_writepage(struct page *page, struct writeback_control *wbc)
unlock_page(page);
unlock_page(page);
+ if (bad_blocks)
+ goto err_out;
+
if (nr_underway == 0)
end_page_writeback(page);
if (nr_underway == 0)
end_page_writeback(page);
@@
-472,7
+480,9
@@
skip:
bio_put(bio);
unlock_page(page);
dec_io(page, last_write_complete);
bio_put(bio);
unlock_page(page);
dec_io(page, last_write_complete);
-
+err_out:
+ while (bad_blocks--)
+ dec_io(page, last_write_complete);
return -EIO;
}
return -EIO;
}
@@
-480,13
+490,13
@@
static int metapage_readpage(struct file *fp, struct page *page)
{
struct inode *inode = page->mapping->host;
struct bio *bio = NULL;
{
struct inode *inode = page->mapping->host;
struct bio *bio = NULL;
-
unsigned
int block_offset;
-
unsigned
int blocks_per_page = PAGE_CACHE_SIZE >> inode->i_blkbits;
+ int block_offset;
+ int blocks_per_page = PAGE_CACHE_SIZE >> inode->i_blkbits;
sector_t page_start; /* address of page in fs blocks */
sector_t pblock;
sector_t page_start; /* address of page in fs blocks */
sector_t pblock;
-
unsigned
int xlen;
+ int xlen;
unsigned int len;
unsigned int len;
-
unsigned
int offset;
+ int offset;
BUG_ON(!PageLocked(page));
page_start = (sector_t)page->index <<
BUG_ON(!PageLocked(page));
page_start = (sector_t)page->index <<
@@
-535,7
+545,7
@@
static int metapage_releasepage(struct page *page, gfp_t gfp_mask)
{
struct metapage *mp;
int ret = 1;
{
struct metapage *mp;
int ret = 1;
-
unsigned
int offset;
+ int offset;
for (offset = 0; offset < PAGE_CACHE_SIZE; offset += PSIZE) {
mp = page_to_mp(page, offset);
for (offset = 0; offset < PAGE_CACHE_SIZE; offset += PSIZE) {
mp = page_to_mp(page, offset);
@@
-804,13
+814,9
@@
void __invalidate_metapages(struct inode *ip, s64 addr, int len)
}
#ifdef CONFIG_JFS_STATISTICS
}
#ifdef CONFIG_JFS_STATISTICS
-int jfs_mpstat_read(char *buffer, char **start, off_t offset, int length,
- int *eof, void *data)
+static int jfs_mpstat_proc_show(struct seq_file *m, void *v)
{
{
- int len = 0;
- off_t begin;
-
- len += sprintf(buffer,
+ seq_printf(m,
"JFS Metapage statistics\n"
"=======================\n"
"page allocations = %d\n"
"JFS Metapage statistics\n"
"=======================\n"
"page allocations = %d\n"
@@
-819,19
+825,19
@@
int jfs_mpstat_read(char *buffer, char **start, off_t offset, int length,
mpStat.pagealloc,
mpStat.pagefree,
mpStat.lockwait);
mpStat.pagealloc,
mpStat.pagefree,
mpStat.lockwait);
+ return 0;
+}
- begin = offset;
- *start = buffer + begin;
- len -= begin;
-
- if (len > length)
- len = length;
- else
- *eof = 1;
-
- if (len < 0)
- len = 0;
-
- return len;
+static int jfs_mpstat_proc_open(struct inode *inode, struct file *file)
+{
+ return single_open(file, jfs_mpstat_proc_show, NULL);
}
}
+
+const struct file_operations jfs_mpstat_proc_fops = {
+ .owner = THIS_MODULE,
+ .open = jfs_mpstat_proc_open,
+ .read = seq_read,
+ .llseek = seq_lseek,
+ .release = single_release,
+};
#endif
#endif