Commit 59fed502 authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] direct-IO return type fixes

From: me, Badari Pulavarty <pbadari@us.ibm.com>

Currently a direct-IO read or write of more than 2G on 64-bit machines is
broken.  Replace int with ssize_t in various places to fix that up.
parent fdc51945
......@@ -148,7 +148,7 @@ blkdev_get_blocks(struct inode *inode, sector_t iblock,
return 0;
}
static int
static ssize_t
blkdev_direct_IO(int rw, struct kiocb *iocb, const struct iovec *iov,
loff_t offset, unsigned long nr_segs)
{
......
......@@ -125,7 +125,7 @@ struct dio {
/* AIO related stuff */
struct kiocb *iocb; /* kiocb */
int is_async; /* is IO async ? */
int result; /* IO result */
ssize_t result; /* IO result */
};
/*
......@@ -898,7 +898,7 @@ static int do_direct_IO(struct dio *dio)
/*
* Releases both i_sem and i_alloc_sem
*/
static int
static ssize_t
direct_io_worker(int rw, struct kiocb *iocb, struct inode *inode,
const struct iovec *iov, loff_t offset, unsigned long nr_segs,
unsigned blkbits, get_blocks_t get_blocks, dio_iodone_t end_io,
......@@ -906,8 +906,8 @@ direct_io_worker(int rw, struct kiocb *iocb, struct inode *inode,
{
unsigned long user_addr;
int seg;
int ret = 0;
int ret2;
ssize_t ret = 0;
ssize_t ret2;
size_t bytes;
dio->bio = NULL;
......@@ -1096,7 +1096,7 @@ direct_io_worker(int rw, struct kiocb *iocb, struct inode *inode,
*
* For writes to S_ISBLK files, i_sem is not held on entry; it is never taken.
*/
int
ssize_t
__blockdev_direct_IO(int rw, struct kiocb *iocb, struct inode *inode,
struct block_device *bdev, const struct iovec *iov, loff_t offset,
unsigned long nr_segs, get_blocks_t get_blocks, dio_iodone_t end_io,
......
......@@ -655,7 +655,7 @@ ext2_get_blocks(struct inode *inode, sector_t iblock, unsigned long max_blocks,
return ret;
}
static int
static ssize_t
ext2_direct_IO(int rw, struct kiocb *iocb, const struct iovec *iov,
loff_t offset, unsigned long nr_segs)
{
......
......@@ -1525,7 +1525,7 @@ static int ext3_releasepage(struct page *page, int wait)
* If the O_DIRECT write is intantiating holes inside i_size and the machine
* crashes then stale disk data _may_ be exposed inside the file.
*/
static int ext3_direct_IO(int rw, struct kiocb *iocb,
static ssize_t ext3_direct_IO(int rw, struct kiocb *iocb,
const struct iovec *iov, loff_t offset,
unsigned long nr_segs)
{
......@@ -1533,7 +1533,7 @@ static int ext3_direct_IO(int rw, struct kiocb *iocb,
struct inode *inode = file->f_mapping->host;
struct ext3_inode_info *ei = EXT3_I(inode);
handle_t *handle = NULL;
int ret;
ssize_t ret;
int orphan = 0;
size_t count = iov_length(iov, nr_segs);
......
......@@ -114,8 +114,8 @@ static int hfs_get_blocks(struct inode *inode, sector_t iblock, unsigned long ma
return ret;
}
static int hfs_direct_IO(int rw, struct kiocb *iocb, const struct iovec *iov,
loff_t offset, unsigned long nr_segs)
static ssize_t hfs_direct_IO(int rw, struct kiocb *iocb,
const struct iovec *iov, loff_t offset, unsigned long nr_segs)
{
struct file *file = iocb->ki_filp;
struct inode *inode = file->f_dentry->d_inode->i_mapping->host;
......
......@@ -114,8 +114,8 @@ static int hfsplus_get_blocks(struct inode *inode, sector_t iblock, unsigned lon
return ret;
}
static int hfsplus_direct_IO(int rw, struct kiocb *iocb, const struct iovec *iov,
loff_t offset, unsigned long nr_segs)
static ssize_t hfsplus_direct_IO(int rw, struct kiocb *iocb,
const struct iovec *iov, loff_t offset, unsigned long nr_segs)
{
struct file *file = iocb->ki_filp;
struct inode *inode = file->f_dentry->d_inode->i_mapping->host;
......
......@@ -302,8 +302,8 @@ static sector_t jfs_bmap(struct address_space *mapping, sector_t block)
return generic_block_bmap(mapping, block, jfs_get_block);
}
static int jfs_direct_IO(int rw, struct kiocb *iocb, const struct iovec *iov,
loff_t offset, unsigned long nr_segs)
static ssize_t jfs_direct_IO(int rw, struct kiocb *iocb,
const struct iovec *iov, loff_t offset, unsigned long nr_segs)
{
struct file *file = iocb->ki_filp;
struct inode *inode = file->f_mapping->host;
......
......@@ -191,16 +191,17 @@ nfs_direct_read_seg(struct inode *inode, struct file *file,
* writes so that this read will see them when we read from the
* server.
*/
static int
static ssize_t
nfs_direct_read(struct inode *inode, struct file *file,
const struct iovec *iov, loff_t file_offset,
unsigned long nr_segs)
{
int tot_bytes = 0;
ssize_t tot_bytes = 0;
unsigned long seg = 0;
while ((seg < nr_segs) && (tot_bytes >= 0)) {
int result, page_count;
ssize_t result;
int page_count;
struct page **pages;
const struct iovec *vec = &iov[seg++];
unsigned long user_addr = (unsigned long) vec->iov_base;
......@@ -359,16 +360,17 @@ nfs_direct_write_seg(struct inode *inode, struct file *file,
* that non-direct readers might access, so they will pick up these
* writes immediately.
*/
static int
static ssize_t
nfs_direct_write(struct inode *inode, struct file *file,
const struct iovec *iov, loff_t file_offset,
unsigned long nr_segs)
{
int tot_bytes = 0;
ssize_t tot_bytes = 0;
unsigned long seg = 0;
while ((seg < nr_segs) && (tot_bytes >= 0)) {
int result, page_count;
ssize_t result;
int page_count;
struct page **pages;
const struct iovec *vec = &iov[seg++];
unsigned long user_addr = (unsigned long) vec->iov_base;
......@@ -414,11 +416,11 @@ nfs_direct_write(struct inode *inode, struct file *file,
* The inode's i_sem is no longer held by the VFS layer before it calls
* this function to do a write.
*/
int
ssize_t
nfs_direct_IO(int rw, struct kiocb *iocb, const struct iovec *iov,
loff_t file_offset, unsigned long nr_segs)
{
int result = -EINVAL;
ssize_t result = -EINVAL;
struct file *file = iocb->ki_filp;
struct dentry *dentry = file->f_dentry;
struct inode *inode = dentry->d_inode;
......
......@@ -2498,8 +2498,8 @@ static int reiserfs_releasepage(struct page *page, int unused_gfp_flags)
/* We thank Mingming Cao for helping us understand in great detail what
to do in this section of the code. */
static int reiserfs_direct_IO(int rw, struct kiocb *iocb, const struct iovec *iov,
loff_t offset, unsigned long nr_segs)
static ssize_t reiserfs_direct_IO(int rw, struct kiocb *iocb,
const struct iovec *iov, loff_t offset, unsigned long nr_segs)
{
struct file *file = iocb->ki_filp;
struct inode *inode = file->f_mapping->host;
......
......@@ -1013,7 +1013,7 @@ linvfs_get_blocks_direct(
create, 1, BMAPI_WRITE|BMAPI_DIRECT);
}
STATIC int
STATIC ssize_t
linvfs_direct_IO(
int rw,
struct kiocb *iocb,
......
......@@ -317,7 +317,7 @@ struct address_space_operations {
sector_t (*bmap)(struct address_space *, sector_t);
int (*invalidatepage) (struct page *, unsigned long);
int (*releasepage) (struct page *, int);
int (*direct_IO)(int, struct kiocb *, const struct iovec *iov,
ssize_t (*direct_IO)(int, struct kiocb *, const struct iovec *iov,
loff_t offset, unsigned long nr_segs);
};
......@@ -1409,7 +1409,7 @@ static inline void do_generic_file_read(struct file * filp, loff_t *ppos,
actor);
}
int __blockdev_direct_IO(int rw, struct kiocb *iocb, struct inode *inode,
ssize_t __blockdev_direct_IO(int rw, struct kiocb *iocb, struct inode *inode,
struct block_device *bdev, const struct iovec *iov, loff_t offset,
unsigned long nr_segs, get_blocks_t get_blocks, dio_iodone_t end_io,
int needs_special_locking);
......@@ -1417,7 +1417,7 @@ int __blockdev_direct_IO(int rw, struct kiocb *iocb, struct inode *inode,
/*
* For filesystems which need locking between buffered and direct access
*/
static inline int blockdev_direct_IO(int rw, struct kiocb *iocb,
static inline ssize_t blockdev_direct_IO(int rw, struct kiocb *iocb,
struct inode *inode, struct block_device *bdev, const struct iovec *iov,
loff_t offset, unsigned long nr_segs, get_blocks_t get_blocks,
dio_iodone_t end_io)
......@@ -1426,7 +1426,7 @@ static inline int blockdev_direct_IO(int rw, struct kiocb *iocb,
nr_segs, get_blocks, end_io, 1);
}
static inline int blockdev_direct_IO_no_locking(int rw, struct kiocb *iocb,
static inline ssize_t blockdev_direct_IO_no_locking(int rw, struct kiocb *iocb,
struct inode *inode, struct block_device *bdev, const struct iovec *iov,
loff_t offset, unsigned long nr_segs, get_blocks_t get_blocks,
dio_iodone_t end_io)
......
......@@ -304,7 +304,7 @@ nfs_file_cred(struct file *file)
/*
* linux/fs/nfs/direct.c
*/
extern int nfs_direct_IO(int, struct kiocb *, const struct iovec *, loff_t,
extern ssize_t nfs_direct_IO(int, struct kiocb *, const struct iovec *, loff_t,
unsigned long);
/*
......
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