Skip to content

Commit

Permalink
Merge branch 'for-linus' of git://oss.sgi.com/xfs/xfs
Browse files Browse the repository at this point in the history
* 'for-linus' of git://oss.sgi.com/xfs/xfs:
  xfs: Fix error return for fallocate() on XFS
  xfs: cleanup dmapi macros in the umount path
  xfs: remove incorrect sparse annotation for xfs_iget_cache_miss
  xfs: kill the STATIC_INLINE macro
  xfs: uninline xfs_get_extsz_hint
  xfs: rename xfs_attr_fetch to xfs_attr_get_int
  xfs: simplify xfs_buf_get / xfs_buf_read interfaces
  xfs: remove IO_ISAIO
  xfs: Wrapped journal record corruption on read at recovery
  xfs: cleanup data end I/O handlers
  xfs: use WRITE_SYNC_PLUG for synchronous writeout
  xfs: reset the i_iolock lock class in the reclaim path
  xfs: I/O completion handlers must use NOFS allocations
  xfs: fix mmap_sem/iolock inversion in xfs_free_eofblocks
  xfs: simplify inode teardown
  • Loading branch information
Linus Torvalds committed Dec 11, 2009
2 parents 0e2f7b8 + 44a743f commit f4d544e
Show file tree
Hide file tree
Showing 30 changed files with 254 additions and 321 deletions.
114 changes: 37 additions & 77 deletions fs/xfs/linux-2.6/xfs_aops.c
Original file line number Diff line number Diff line change
Expand Up @@ -235,71 +235,36 @@ xfs_setfilesize(
}

/*
* Buffered IO write completion for delayed allocate extents.
* IO write completion.
*/
STATIC void
xfs_end_bio_delalloc(
struct work_struct *work)
{
xfs_ioend_t *ioend =
container_of(work, xfs_ioend_t, io_work);

xfs_setfilesize(ioend);
xfs_destroy_ioend(ioend);
}

/*
* Buffered IO write completion for regular, written extents.
*/
STATIC void
xfs_end_bio_written(
struct work_struct *work)
{
xfs_ioend_t *ioend =
container_of(work, xfs_ioend_t, io_work);

xfs_setfilesize(ioend);
xfs_destroy_ioend(ioend);
}

/*
* IO write completion for unwritten extents.
*
* Issue transactions to convert a buffer range from unwritten
* to written extents.
*/
STATIC void
xfs_end_bio_unwritten(
xfs_end_io(
struct work_struct *work)
{
xfs_ioend_t *ioend =
container_of(work, xfs_ioend_t, io_work);
struct xfs_inode *ip = XFS_I(ioend->io_inode);
xfs_off_t offset = ioend->io_offset;
size_t size = ioend->io_size;

if (likely(!ioend->io_error)) {
if (!XFS_FORCED_SHUTDOWN(ip->i_mount)) {
int error;
error = xfs_iomap_write_unwritten(ip, offset, size);
if (error)
ioend->io_error = error;
}
xfs_setfilesize(ioend);
}
xfs_destroy_ioend(ioend);
}

/*
* IO read completion for regular, written extents.
*/
STATIC void
xfs_end_bio_read(
struct work_struct *work)
{
xfs_ioend_t *ioend =
container_of(work, xfs_ioend_t, io_work);
/*
* For unwritten extents we need to issue transactions to convert a
* range to normal written extens after the data I/O has finished.
*/
if (ioend->io_type == IOMAP_UNWRITTEN &&
likely(!ioend->io_error && !XFS_FORCED_SHUTDOWN(ip->i_mount))) {
int error;

error = xfs_iomap_write_unwritten(ip, ioend->io_offset,
ioend->io_size);
if (error)
ioend->io_error = error;
}

/*
* We might have to update the on-disk file size after extending
* writes.
*/
if (ioend->io_type != IOMAP_READ)
xfs_setfilesize(ioend);
xfs_destroy_ioend(ioend);
}

Expand All @@ -314,10 +279,10 @@ xfs_finish_ioend(
int wait)
{
if (atomic_dec_and_test(&ioend->io_remaining)) {
struct workqueue_struct *wq = xfsdatad_workqueue;
if (ioend->io_work.func == xfs_end_bio_unwritten)
wq = xfsconvertd_workqueue;
struct workqueue_struct *wq;

wq = (ioend->io_type == IOMAP_UNWRITTEN) ?
xfsconvertd_workqueue : xfsdatad_workqueue;
queue_work(wq, &ioend->io_work);
if (wait)
flush_workqueue(wq);
Expand Down Expand Up @@ -355,15 +320,7 @@ xfs_alloc_ioend(
ioend->io_offset = 0;
ioend->io_size = 0;

if (type == IOMAP_UNWRITTEN)
INIT_WORK(&ioend->io_work, xfs_end_bio_unwritten);
else if (type == IOMAP_DELAY)
INIT_WORK(&ioend->io_work, xfs_end_bio_delalloc);
else if (type == IOMAP_READ)
INIT_WORK(&ioend->io_work, xfs_end_bio_read);
else
INIT_WORK(&ioend->io_work, xfs_end_bio_written);

INIT_WORK(&ioend->io_work, xfs_end_io);
return ioend;
}

Expand All @@ -380,7 +337,7 @@ xfs_map_blocks(
return -xfs_iomap(XFS_I(inode), offset, count, flags, mapp, &nmaps);
}

STATIC_INLINE int
STATIC int
xfs_iomap_valid(
xfs_iomap_t *iomapp,
loff_t offset)
Expand Down Expand Up @@ -412,8 +369,9 @@ xfs_end_bio(

STATIC void
xfs_submit_ioend_bio(
xfs_ioend_t *ioend,
struct bio *bio)
struct writeback_control *wbc,
xfs_ioend_t *ioend,
struct bio *bio)
{
atomic_inc(&ioend->io_remaining);
bio->bi_private = ioend;
Expand All @@ -426,7 +384,8 @@ xfs_submit_ioend_bio(
if (xfs_ioend_new_eof(ioend))
xfs_mark_inode_dirty_sync(XFS_I(ioend->io_inode));

submit_bio(WRITE, bio);
submit_bio(wbc->sync_mode == WB_SYNC_ALL ?
WRITE_SYNC_PLUG : WRITE, bio);
ASSERT(!bio_flagged(bio, BIO_EOPNOTSUPP));
bio_put(bio);
}
Expand Down Expand Up @@ -505,6 +464,7 @@ static inline int bio_add_buffer(struct bio *bio, struct buffer_head *bh)
*/
STATIC void
xfs_submit_ioend(
struct writeback_control *wbc,
xfs_ioend_t *ioend)
{
xfs_ioend_t *head = ioend;
Expand Down Expand Up @@ -533,19 +493,19 @@ xfs_submit_ioend(
retry:
bio = xfs_alloc_ioend_bio(bh);
} else if (bh->b_blocknr != lastblock + 1) {
xfs_submit_ioend_bio(ioend, bio);
xfs_submit_ioend_bio(wbc, ioend, bio);
goto retry;
}

if (bio_add_buffer(bio, bh) != bh->b_size) {
xfs_submit_ioend_bio(ioend, bio);
xfs_submit_ioend_bio(wbc, ioend, bio);
goto retry;
}

lastblock = bh->b_blocknr;
}
if (bio)
xfs_submit_ioend_bio(ioend, bio);
xfs_submit_ioend_bio(wbc, ioend, bio);
xfs_finish_ioend(ioend, 0);
} while ((ioend = next) != NULL);
}
Expand Down Expand Up @@ -1191,7 +1151,7 @@ xfs_page_state_convert(
}

if (iohead)
xfs_submit_ioend(iohead);
xfs_submit_ioend(wbc, iohead);

return page_dirty;

Expand Down Expand Up @@ -1528,7 +1488,7 @@ xfs_end_io_direct(
* didn't map an unwritten extent so switch it's completion
* handler.
*/
INIT_WORK(&ioend->io_work, xfs_end_bio_written);
ioend->io_type = IOMAP_NEW;
xfs_finish_ioend(ioend, 0);
}

Expand Down
14 changes: 7 additions & 7 deletions fs/xfs/linux-2.6/xfs_buf.c
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ page_region_mask(
return mask;
}

STATIC_INLINE void
STATIC void
set_page_region(
struct page *page,
size_t offset,
Expand All @@ -161,7 +161,7 @@ set_page_region(
SetPageUptodate(page);
}

STATIC_INLINE int
STATIC int
test_page_region(
struct page *page,
size_t offset,
Expand Down Expand Up @@ -582,7 +582,7 @@ _xfs_buf_find(
* although backing storage may not be.
*/
xfs_buf_t *
xfs_buf_get_flags(
xfs_buf_get(
xfs_buftarg_t *target,/* target for buffer */
xfs_off_t ioff, /* starting offset of range */
size_t isize, /* length of range */
Expand Down Expand Up @@ -661,7 +661,7 @@ _xfs_buf_read(
}

xfs_buf_t *
xfs_buf_read_flags(
xfs_buf_read(
xfs_buftarg_t *target,
xfs_off_t ioff,
size_t isize,
Expand All @@ -671,7 +671,7 @@ xfs_buf_read_flags(

flags |= XBF_READ;

bp = xfs_buf_get_flags(target, ioff, isize, flags);
bp = xfs_buf_get(target, ioff, isize, flags);
if (bp) {
if (!XFS_BUF_ISDONE(bp)) {
XB_TRACE(bp, "read", (unsigned long)flags);
Expand Down Expand Up @@ -718,7 +718,7 @@ xfs_buf_readahead(
return;

flags |= (XBF_TRYLOCK|XBF_ASYNC|XBF_READ_AHEAD);
xfs_buf_read_flags(target, ioff, isize, flags);
xfs_buf_read(target, ioff, isize, flags);
}

xfs_buf_t *
Expand Down Expand Up @@ -1113,7 +1113,7 @@ xfs_bdwrite(
xfs_buf_delwri_queue(bp, 1);
}

STATIC_INLINE void
STATIC void
_xfs_buf_ioend(
xfs_buf_t *bp,
int schedule)
Expand Down
9 changes: 2 additions & 7 deletions fs/xfs/linux-2.6/xfs_buf.h
Original file line number Diff line number Diff line change
Expand Up @@ -186,15 +186,10 @@ extern xfs_buf_t *_xfs_buf_find(xfs_buftarg_t *, xfs_off_t, size_t,
#define xfs_incore(buftarg,blkno,len,lockit) \
_xfs_buf_find(buftarg, blkno ,len, lockit, NULL)

extern xfs_buf_t *xfs_buf_get_flags(xfs_buftarg_t *, xfs_off_t, size_t,
extern xfs_buf_t *xfs_buf_get(xfs_buftarg_t *, xfs_off_t, size_t,
xfs_buf_flags_t);
#define xfs_buf_get(target, blkno, len, flags) \
xfs_buf_get_flags((target), (blkno), (len), XBF_LOCK | XBF_MAPPED)

extern xfs_buf_t *xfs_buf_read_flags(xfs_buftarg_t *, xfs_off_t, size_t,
extern xfs_buf_t *xfs_buf_read(xfs_buftarg_t *, xfs_off_t, size_t,
xfs_buf_flags_t);
#define xfs_buf_read(target, blkno, len, flags) \
xfs_buf_read_flags((target), (blkno), (len), XBF_LOCK | XBF_MAPPED)

extern xfs_buf_t *xfs_buf_get_empty(size_t, xfs_buftarg_t *);
extern xfs_buf_t *xfs_buf_get_noaddr(size_t, xfs_buftarg_t *);
Expand Down
4 changes: 2 additions & 2 deletions fs/xfs/linux-2.6/xfs_file.c
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ xfs_file_aio_read(
loff_t pos)
{
struct file *file = iocb->ki_filp;
int ioflags = IO_ISAIO;
int ioflags = 0;

BUG_ON(iocb->ki_pos != pos);
if (unlikely(file->f_flags & O_DIRECT))
Expand All @@ -71,7 +71,7 @@ xfs_file_aio_write(
loff_t pos)
{
struct file *file = iocb->ki_filp;
int ioflags = IO_ISAIO;
int ioflags = 0;

BUG_ON(iocb->ki_pos != pos);
if (unlikely(file->f_flags & O_DIRECT))
Expand Down
6 changes: 3 additions & 3 deletions fs/xfs/linux-2.6/xfs_iops.c
Original file line number Diff line number Diff line change
Expand Up @@ -573,8 +573,8 @@ xfs_vn_fallocate(
bf.l_len = len;

xfs_ilock(ip, XFS_IOLOCK_EXCL);
error = xfs_change_file_space(ip, XFS_IOC_RESVSP, &bf,
0, XFS_ATTR_NOLOCK);
error = -xfs_change_file_space(ip, XFS_IOC_RESVSP, &bf,
0, XFS_ATTR_NOLOCK);
if (!error && !(mode & FALLOC_FL_KEEP_SIZE) &&
offset + len > i_size_read(inode))
new_size = offset + len;
Expand All @@ -585,7 +585,7 @@ xfs_vn_fallocate(

iattr.ia_valid = ATTR_SIZE;
iattr.ia_size = new_size;
error = xfs_setattr(ip, &iattr, XFS_ATTR_NOLOCK);
error = -xfs_setattr(ip, &iattr, XFS_ATTR_NOLOCK);
}

xfs_iunlock(ip, XFS_IOLOCK_EXCL);
Expand Down
5 changes: 0 additions & 5 deletions fs/xfs/linux-2.6/xfs_lrw.c
Original file line number Diff line number Diff line change
Expand Up @@ -255,8 +255,6 @@ xfs_read(

iocb->ki_pos = *offset;
ret = generic_file_aio_read(iocb, iovp, segs, *offset);
if (ret == -EIOCBQUEUED && !(ioflags & IO_ISAIO))
ret = wait_on_sync_kiocb(iocb);
if (ret > 0)
XFS_STATS_ADD(xs_read_bytes, ret);

Expand Down Expand Up @@ -774,9 +772,6 @@ xfs_write(

current->backing_dev_info = NULL;

if (ret == -EIOCBQUEUED && !(ioflags & IO_ISAIO))
ret = wait_on_sync_kiocb(iocb);

isize = i_size_read(inode);
if (unlikely(ret < 0 && ret != -EFAULT && *offset > isize))
*offset = isize;
Expand Down
Loading

0 comments on commit f4d544e

Please sign in to comment.