mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-05 10:29:37 +00:00
[GFS2] Update GFS2 for the recent pull from Linus
Some interfaces have changed. In particular one of the posix locking functions has changed prototype, along with the address space operation invalidatepage and the block getting callback to the direct IO function. In addition add the splice file operations. These will need to be updated to support AOP_TRUNCATED_PAGE before they will be of much use to us. Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
This commit is contained in:
parent
86579dd06d
commit
8628de0583
3 changed files with 19 additions and 81 deletions
|
@ -176,14 +176,13 @@ static void nolock_sync_lvb(lm_lock_t *lock, char *lvb)
|
||||||
static int nolock_plock_get(lm_lockspace_t *lockspace, struct lm_lockname *name,
|
static int nolock_plock_get(lm_lockspace_t *lockspace, struct lm_lockname *name,
|
||||||
struct file *file, struct file_lock *fl)
|
struct file *file, struct file_lock *fl)
|
||||||
{
|
{
|
||||||
struct file_lock *tmp;
|
struct file_lock tmp;
|
||||||
|
int ret;
|
||||||
|
|
||||||
lock_kernel();
|
ret = posix_test_lock(file, fl, &tmp);
|
||||||
tmp = posix_test_lock(file, fl);
|
|
||||||
fl->fl_type = F_UNLCK;
|
fl->fl_type = F_UNLCK;
|
||||||
if (tmp)
|
if (ret)
|
||||||
memcpy(fl, tmp, sizeof(struct file_lock));
|
memcpy(fl, &tmp, sizeof(struct file_lock));
|
||||||
unlock_kernel();
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -192,9 +191,7 @@ static int nolock_plock(lm_lockspace_t *lockspace, struct lm_lockname *name,
|
||||||
struct file *file, int cmd, struct file_lock *fl)
|
struct file *file, int cmd, struct file_lock *fl)
|
||||||
{
|
{
|
||||||
int error;
|
int error;
|
||||||
lock_kernel();
|
|
||||||
error = posix_lock_file_wait(file, fl);
|
error = posix_lock_file_wait(file, fl);
|
||||||
unlock_kernel();
|
|
||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -202,9 +199,7 @@ static int nolock_punlock(lm_lockspace_t *lockspace, struct lm_lockname *name,
|
||||||
struct file *file, struct file_lock *fl)
|
struct file *file, struct file_lock *fl)
|
||||||
{
|
{
|
||||||
int error;
|
int error;
|
||||||
lock_kernel();
|
|
||||||
error = posix_lock_file_wait(file, fl);
|
error = posix_lock_file_wait(file, fl);
|
||||||
unlock_kernel();
|
|
||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -96,59 +96,6 @@ static int get_block_noalloc(struct inode *inode, sector_t lblock,
|
||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int get_blocks(struct inode *inode, sector_t lblock,
|
|
||||||
unsigned long max_blocks, struct buffer_head *bh_result,
|
|
||||||
int create)
|
|
||||||
{
|
|
||||||
struct gfs2_inode *ip = inode->u.generic_ip;
|
|
||||||
int new = create;
|
|
||||||
uint64_t dblock;
|
|
||||||
uint32_t extlen;
|
|
||||||
int error;
|
|
||||||
|
|
||||||
error = gfs2_block_map(ip, lblock, &new, &dblock, &extlen);
|
|
||||||
if (error)
|
|
||||||
return error;
|
|
||||||
|
|
||||||
if (!dblock)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
map_bh(bh_result, inode->i_sb, dblock);
|
|
||||||
if (new)
|
|
||||||
set_buffer_new(bh_result);
|
|
||||||
|
|
||||||
if (extlen > max_blocks)
|
|
||||||
extlen = max_blocks;
|
|
||||||
bh_result->b_size = extlen << inode->i_blkbits;
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int get_blocks_noalloc(struct inode *inode, sector_t lblock,
|
|
||||||
unsigned long max_blocks,
|
|
||||||
struct buffer_head *bh_result, int create)
|
|
||||||
{
|
|
||||||
struct gfs2_inode *ip = inode->u.generic_ip;
|
|
||||||
int new = 0;
|
|
||||||
uint64_t dblock;
|
|
||||||
uint32_t extlen;
|
|
||||||
int error;
|
|
||||||
|
|
||||||
error = gfs2_block_map(ip, lblock, &new, &dblock, &extlen);
|
|
||||||
if (error)
|
|
||||||
return error;
|
|
||||||
|
|
||||||
if (dblock) {
|
|
||||||
map_bh(bh_result, inode->i_sb, dblock);
|
|
||||||
if (extlen > max_blocks)
|
|
||||||
extlen = max_blocks;
|
|
||||||
bh_result->b_size = extlen << inode->i_blkbits;
|
|
||||||
} else if (gfs2_assert_withdraw(ip->i_sbd, !create))
|
|
||||||
error = -EIO;
|
|
||||||
|
|
||||||
return error;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* gfs2_writepage - Write complete page
|
* gfs2_writepage - Write complete page
|
||||||
* @page: Page to write
|
* @page: Page to write
|
||||||
|
@ -527,16 +474,15 @@ static void discard_buffer(struct gfs2_sbd *sdp, struct buffer_head *bh)
|
||||||
unlock_buffer(bh);
|
unlock_buffer(bh);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int gfs2_invalidatepage(struct page *page, unsigned long offset)
|
static void gfs2_invalidatepage(struct page *page, unsigned long offset)
|
||||||
{
|
{
|
||||||
struct gfs2_sbd *sdp = page->mapping->host->i_sb->s_fs_info;
|
struct gfs2_sbd *sdp = page->mapping->host->i_sb->s_fs_info;
|
||||||
struct buffer_head *head, *bh, *next;
|
struct buffer_head *head, *bh, *next;
|
||||||
unsigned int curr_off = 0;
|
unsigned int curr_off = 0;
|
||||||
int ret = 1;
|
|
||||||
|
|
||||||
BUG_ON(!PageLocked(page));
|
BUG_ON(!PageLocked(page));
|
||||||
if (!page_has_buffers(page))
|
if (!page_has_buffers(page))
|
||||||
return 1;
|
return;
|
||||||
|
|
||||||
bh = head = page_buffers(page);
|
bh = head = page_buffers(page);
|
||||||
do {
|
do {
|
||||||
|
@ -551,9 +497,9 @@ static int gfs2_invalidatepage(struct page *page, unsigned long offset)
|
||||||
} while (bh != head);
|
} while (bh != head);
|
||||||
|
|
||||||
if (!offset)
|
if (!offset)
|
||||||
ret = try_to_release_page(page, 0);
|
try_to_release_page(page, 0);
|
||||||
|
|
||||||
return ret;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
static ssize_t gfs2_direct_IO_write(struct kiocb *iocb, const struct iovec *iov,
|
static ssize_t gfs2_direct_IO_write(struct kiocb *iocb, const struct iovec *iov,
|
||||||
|
@ -587,7 +533,7 @@ static ssize_t gfs2_direct_IO_write(struct kiocb *iocb, const struct iovec *iov,
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
rv = __blockdev_direct_IO(WRITE, iocb, inode, inode->i_sb->s_bdev,
|
rv = __blockdev_direct_IO(WRITE, iocb, inode, inode->i_sb->s_bdev,
|
||||||
iov, offset, nr_segs, get_blocks_noalloc,
|
iov, offset, nr_segs, gfs2_get_block,
|
||||||
NULL, DIO_OWN_LOCKING);
|
NULL, DIO_OWN_LOCKING);
|
||||||
out:
|
out:
|
||||||
gfs2_glock_dq_m(1, &gh);
|
gfs2_glock_dq_m(1, &gh);
|
||||||
|
@ -619,7 +565,7 @@ static ssize_t gfs2_direct_IO(int rw, struct kiocb *iocb,
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
return __blockdev_direct_IO(READ, iocb, inode, inode->i_sb->s_bdev, iov,
|
return __blockdev_direct_IO(READ, iocb, inode, inode->i_sb->s_bdev, iov,
|
||||||
offset, nr_segs, get_blocks, NULL,
|
offset, nr_segs, gfs2_get_block, NULL,
|
||||||
DIO_OWN_LOCKING);
|
DIO_OWN_LOCKING);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -833,20 +833,15 @@ static int gfs2_lock(struct file *file, int cmd, struct file_lock *fl)
|
||||||
|
|
||||||
if (sdp->sd_args.ar_localflocks) {
|
if (sdp->sd_args.ar_localflocks) {
|
||||||
if (IS_GETLK(cmd)) {
|
if (IS_GETLK(cmd)) {
|
||||||
struct file_lock *tmp;
|
struct file_lock tmp;
|
||||||
lock_kernel();
|
int ret;
|
||||||
tmp = posix_test_lock(file, fl);
|
ret = posix_test_lock(file, fl, &tmp);
|
||||||
fl->fl_type = F_UNLCK;
|
fl->fl_type = F_UNLCK;
|
||||||
if (tmp)
|
if (ret)
|
||||||
memcpy(fl, tmp, sizeof(struct file_lock));
|
memcpy(fl, &tmp, sizeof(struct file_lock));
|
||||||
unlock_kernel();
|
|
||||||
return 0;
|
return 0;
|
||||||
} else {
|
} else {
|
||||||
int error;
|
return posix_lock_file_wait(file, fl);
|
||||||
lock_kernel();
|
|
||||||
error = posix_lock_file_wait(file, fl);
|
|
||||||
unlock_kernel();
|
|
||||||
return error;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -983,6 +978,8 @@ struct file_operations gfs2_file_fops = {
|
||||||
.lock = gfs2_lock,
|
.lock = gfs2_lock,
|
||||||
.sendfile = gfs2_sendfile,
|
.sendfile = gfs2_sendfile,
|
||||||
.flock = gfs2_flock,
|
.flock = gfs2_flock,
|
||||||
|
.splice_read = generic_file_splice_read,
|
||||||
|
.splice_write = generic_file_splice_write,
|
||||||
};
|
};
|
||||||
|
|
||||||
struct file_operations gfs2_dir_fops = {
|
struct file_operations gfs2_dir_fops = {
|
||||||
|
|
Loading…
Reference in a new issue