Skip to content

Commit

Permalink
Merge git://oss.sgi.com:8090/oss/git/xfs-2.6
Browse files Browse the repository at this point in the history
* git://oss.sgi.com:8090/oss/git/xfs-2.6:
  [XFS] Cleanup in XFS after recent get_block_t interface tweaks.
  [XFS] Remove unused/obsoleted function: xfs_bmap_do_search_extents()
  [XFS] A change to inode chunk allocation to try allocating the new chunk
  Fixes a regression from the recent "remove ->get_blocks() support"
  [XFS] Fix compiler warning and small code inconsistencies in compat
  [XFS] We really suck at spulling.  Thanks to Chris Pascoe for fixing all
  • Loading branch information
Linus Torvalds committed Mar 29, 2006
2 parents 224b148 + c253666 commit e71ac60
Show file tree
Hide file tree
Showing 48 changed files with 204 additions and 291 deletions.
7 changes: 4 additions & 3 deletions fs/direct-io.c
Original file line number Diff line number Diff line change
Expand Up @@ -524,8 +524,6 @@ static int get_more_blocks(struct dio *dio)
*/
ret = dio->page_errors;
if (ret == 0) {
map_bh->b_state = 0;
map_bh->b_size = 0;
BUG_ON(dio->block_in_file >= dio->final_block_in_request);
fs_startblk = dio->block_in_file >> dio->blkfactor;
dio_count = dio->final_block_in_request - dio->block_in_file;
Expand All @@ -534,6 +532,9 @@ static int get_more_blocks(struct dio *dio)
if (dio_count & blkmask)
fs_count++;

map_bh->b_state = 0;
map_bh->b_size = fs_count << dio->inode->i_blkbits;

create = dio->rw == WRITE;
if (dio->lock_type == DIO_LOCKING) {
if (dio->block_in_file < (i_size_read(dio->inode) >>
Expand All @@ -542,13 +543,13 @@ static int get_more_blocks(struct dio *dio)
} else if (dio->lock_type == DIO_NO_LOCKING) {
create = 0;
}

/*
* For writes inside i_size we forbid block creations: only
* overwrites are permitted. We fall back to buffered writes
* at a higher level for inside-i_size block-instantiating
* writes.
*/
map_bh->b_size = fs_count << dio->blkbits;
ret = (*dio->get_block)(dio->inode, fs_startblk,
map_bh, create);
}
Expand Down
2 changes: 1 addition & 1 deletion fs/xfs/linux-2.6/mrlock.h
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ static inline void mrdemote(mrlock_t *mrp)
* Debug-only routine, without some platform-specific asm code, we can
* now only answer requests regarding whether we hold the lock for write
* (reader state is outside our visibility, we only track writer state).
* Note: means !ismrlocked would give false positivies, so don't do that.
* Note: means !ismrlocked would give false positives, so don't do that.
*/
static inline int ismrlocked(mrlock_t *mrp, int type)
{
Expand Down
67 changes: 31 additions & 36 deletions fs/xfs/linux-2.6/xfs_aops.c
Original file line number Diff line number Diff line change
Expand Up @@ -372,7 +372,7 @@ static inline int bio_add_buffer(struct bio *bio, struct buffer_head *bh)
* assumes that all buffers on the page are started at the same time.
*
* The fix is two passes across the ioend list - one to start writeback on the
* bufferheads, and then the second one submit them for I/O.
* buffer_heads, and then submit them for I/O on the second pass.
*/
STATIC void
xfs_submit_ioend(
Expand Down Expand Up @@ -699,7 +699,7 @@ xfs_convert_page(

/*
* page_dirty is initially a count of buffers on the page before
* EOF and is decrememted as we move each into a cleanable state.
* EOF and is decremented as we move each into a cleanable state.
*
* Derivation:
*
Expand Down Expand Up @@ -842,7 +842,7 @@ xfs_cluster_write(
* page if possible.
* The bh->b_state's cannot know if any of the blocks or which block for
* that matter are dirty due to mmap writes, and therefore bh uptodate is
* only vaild if the page itself isn't completely uptodate. Some layers
* only valid if the page itself isn't completely uptodate. Some layers
* may clear the page dirty flag prior to calling write page, under the
* assumption the entire page will be written out; by not writing out the
* whole page the page can be reused before all valid dirty data is
Expand Down Expand Up @@ -892,7 +892,7 @@ xfs_page_state_convert(

/*
* page_dirty is initially a count of buffers on the page before
* EOF and is decrememted as we move each into a cleanable state.
* EOF and is decremented as we move each into a cleanable state.
*
* Derivation:
*
Expand Down Expand Up @@ -1223,10 +1223,9 @@ xfs_vm_releasepage(
}

STATIC int
__xfs_get_block(
__xfs_get_blocks(
struct inode *inode,
sector_t iblock,
unsigned long blocks,
struct buffer_head *bh_result,
int create,
int direct,
Expand All @@ -1236,22 +1235,17 @@ __xfs_get_block(
xfs_iomap_t iomap;
xfs_off_t offset;
ssize_t size;
int retpbbm = 1;
int niomap = 1;
int error;

offset = (xfs_off_t)iblock << inode->i_blkbits;
if (blocks)
size = (ssize_t) min_t(xfs_off_t, LONG_MAX,
(xfs_off_t)blocks << inode->i_blkbits);
else
size = 1 << inode->i_blkbits;

ASSERT(bh_result->b_size >= (1 << inode->i_blkbits));
size = bh_result->b_size;
VOP_BMAP(vp, offset, size,
create ? flags : BMAPI_READ, &iomap, &retpbbm, error);
create ? flags : BMAPI_READ, &iomap, &niomap, error);
if (error)
return -error;

if (retpbbm == 0)
if (niomap == 0)
return 0;

if (iomap.iomap_bn != IOMAP_DADDR_NULL) {
Expand All @@ -1271,12 +1265,16 @@ __xfs_get_block(
}
}

/* If this is a realtime file, data might be on a new device */
/*
* If this is a realtime file, data may be on a different device.
* to that pointed to from the buffer_head b_bdev currently.
*/
bh_result->b_bdev = iomap.iomap_target->bt_bdev;

/* If we previously allocated a block out beyond eof and
* we are now coming back to use it then we will need to
* flag it as new even if it has a disk address.
/*
* If we previously allocated a block out beyond eof and we are
* now coming back to use it then we will need to flag it as new
* even if it has a disk address.
*/
if (create &&
((!buffer_mapped(bh_result) && !buffer_uptodate(bh_result)) ||
Expand All @@ -1292,26 +1290,24 @@ __xfs_get_block(
}
}

if (blocks) {
if (direct || size > (1 << inode->i_blkbits)) {
ASSERT(iomap.iomap_bsize - iomap.iomap_delta > 0);
offset = min_t(xfs_off_t,
iomap.iomap_bsize - iomap.iomap_delta,
(xfs_off_t)blocks << inode->i_blkbits);
bh_result->b_size = (u32) min_t(xfs_off_t, UINT_MAX, offset);
iomap.iomap_bsize - iomap.iomap_delta, size);
bh_result->b_size = (ssize_t)min_t(xfs_off_t, LONG_MAX, offset);
}

return 0;
}

int
xfs_get_block(
xfs_get_blocks(
struct inode *inode,
sector_t iblock,
struct buffer_head *bh_result,
int create)
{
return __xfs_get_block(inode, iblock,
bh_result->b_size >> inode->i_blkbits,
return __xfs_get_blocks(inode, iblock,
bh_result, create, 0, BMAPI_WRITE);
}

Expand All @@ -1322,8 +1318,7 @@ xfs_get_blocks_direct(
struct buffer_head *bh_result,
int create)
{
return __xfs_get_block(inode, iblock,
bh_result->b_size >> inode->i_blkbits,
return __xfs_get_blocks(inode, iblock,
bh_result, create, 1, BMAPI_WRITE|BMAPI_DIRECT);
}

Expand All @@ -1339,9 +1334,9 @@ xfs_end_io_direct(
/*
* Non-NULL private data means we need to issue a transaction to
* convert a range from unwritten to written extents. This needs
* to happen from process contect but aio+dio I/O completion
* to happen from process context but aio+dio I/O completion
* happens from irq context so we need to defer it to a workqueue.
* This is not nessecary for synchronous direct I/O, but we do
* This is not necessary for synchronous direct I/O, but we do
* it anyway to keep the code uniform and simpler.
*
* The core direct I/O code might be changed to always call the
Expand All @@ -1358,7 +1353,7 @@ xfs_end_io_direct(
}

/*
* blockdev_direct_IO can return an error even afer the I/O
* blockdev_direct_IO can return an error even after the I/O
* completion handler was called. Thus we need to protect
* against double-freeing.
*/
Expand Down Expand Up @@ -1405,7 +1400,7 @@ xfs_vm_prepare_write(
unsigned int from,
unsigned int to)
{
return block_prepare_write(page, from, to, xfs_get_block);
return block_prepare_write(page, from, to, xfs_get_blocks);
}

STATIC sector_t
Expand All @@ -1422,15 +1417,15 @@ xfs_vm_bmap(
VOP_RWLOCK(vp, VRWLOCK_READ);
VOP_FLUSH_PAGES(vp, (xfs_off_t)0, -1, 0, FI_REMAPF, error);
VOP_RWUNLOCK(vp, VRWLOCK_READ);
return generic_block_bmap(mapping, block, xfs_get_block);
return generic_block_bmap(mapping, block, xfs_get_blocks);
}

STATIC int
xfs_vm_readpage(
struct file *unused,
struct page *page)
{
return mpage_readpage(page, xfs_get_block);
return mpage_readpage(page, xfs_get_blocks);
}

STATIC int
Expand All @@ -1440,7 +1435,7 @@ xfs_vm_readpages(
struct list_head *pages,
unsigned nr_pages)
{
return mpage_readpages(mapping, pages, nr_pages, xfs_get_block);
return mpage_readpages(mapping, pages, nr_pages, xfs_get_blocks);
}

STATIC void
Expand Down
2 changes: 1 addition & 1 deletion fs/xfs/linux-2.6/xfs_aops.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,6 @@ typedef struct xfs_ioend {
} xfs_ioend_t;

extern struct address_space_operations xfs_address_space_operations;
extern int xfs_get_block(struct inode *, sector_t, struct buffer_head *, int);
extern int xfs_get_blocks(struct inode *, sector_t, struct buffer_head *, int);

#endif /* __XFS_IOPS_H__ */
2 changes: 1 addition & 1 deletion fs/xfs/linux-2.6/xfs_export.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
* Note, the NFS filehandle also includes an fsid portion which
* may have an inode number in it. That number is hardcoded to
* 32bits and there is no way for XFS to intercept it. In
* practice this means when exporting an XFS filesytem with 64bit
* practice this means when exporting an XFS filesystem with 64bit
* inodes you should either export the mountpoint (rather than
* a subdirectory) or use the "fsid" export option.
*/
Expand Down
22 changes: 13 additions & 9 deletions fs/xfs/linux-2.6/xfs_ioctl32.c
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ xfs_ioctl32_flock(
copy_in_user(&p->l_pid, &p32->l_pid, sizeof(u32)) ||
copy_in_user(&p->l_pad, &p32->l_pad, 4*sizeof(u32)))
return -EFAULT;

return (unsigned long)p;
}

Expand Down Expand Up @@ -107,11 +107,15 @@ xfs_ioctl32_bulkstat(
#endif

STATIC long
xfs_compat_ioctl(int mode, struct file *f, unsigned cmd, unsigned long arg)
xfs_compat_ioctl(
int mode,
struct file *file,
unsigned cmd,
unsigned long arg)
{
struct inode *inode = file->f_dentry->d_inode;
vnode_t *vp = vn_from_inode(inode);
int error;
struct inode *inode = f->f_dentry->d_inode;
vnode_t *vp = vn_to_inode(inode);

switch (cmd) {
case XFS_IOC_DIOINFO:
Expand Down Expand Up @@ -189,26 +193,26 @@ xfs_compat_ioctl(int mode, struct file *f, unsigned cmd, unsigned long arg)
return -ENOIOCTLCMD;
}

VOP_IOCTL(vp, inode, f, mode, cmd, (void __user *)arg, error);
VOP_IOCTL(vp, inode, file, mode, cmd, (void __user *)arg, error);
VMODIFY(vp);

return error;
}

long
xfs_file_compat_ioctl(
struct file *f,
struct file *file,
unsigned cmd,
unsigned long arg)
{
return xfs_compat_ioctl(0, f, cmd, arg);
return xfs_compat_ioctl(0, file, cmd, arg);
}

long
xfs_file_compat_invis_ioctl(
struct file *f,
struct file *file,
unsigned cmd,
unsigned long arg)
{
return xfs_compat_ioctl(IO_INVIS, f, cmd, arg);
return xfs_compat_ioctl(IO_INVIS, file, cmd, arg);
}
2 changes: 1 addition & 1 deletion fs/xfs/linux-2.6/xfs_iops.c
Original file line number Diff line number Diff line change
Expand Up @@ -708,7 +708,7 @@ STATIC void
xfs_vn_truncate(
struct inode *inode)
{
block_truncate_page(inode->i_mapping, inode->i_size, xfs_get_block);
block_truncate_page(inode->i_mapping, inode->i_size, xfs_get_blocks);
}

STATIC int
Expand Down
2 changes: 1 addition & 1 deletion fs/xfs/linux-2.6/xfs_lrw.c
Original file line number Diff line number Diff line change
Expand Up @@ -681,7 +681,7 @@ xfs_write(
eventsent = 1;

/*
* The iolock was dropped and reaquired in XFS_SEND_DATA
* The iolock was dropped and reacquired in XFS_SEND_DATA
* so we have to recheck the size when appending.
* We will only "goto start;" once, since having sent the
* event prevents another call to XFS_SEND_DATA, which is
Expand Down
2 changes: 1 addition & 1 deletion fs/xfs/linux-2.6/xfs_vfs.h
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ typedef enum {
#define SYNC_FSDATA 0x0020 /* flush fs data (e.g. superblocks) */
#define SYNC_REFCACHE 0x0040 /* prune some of the nfs ref cache */
#define SYNC_REMOUNT 0x0080 /* remount readonly, no dummy LRs */
#define SYNC_QUIESCE 0x0100 /* quiesce fileystem for a snapshot */
#define SYNC_QUIESCE 0x0100 /* quiesce filesystem for a snapshot */

typedef int (*vfs_mount_t)(bhv_desc_t *,
struct xfs_mount_args *, struct cred *);
Expand Down
2 changes: 1 addition & 1 deletion fs/xfs/quota/xfs_dquot_item.c
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ xfs_qm_dqunpin_wait(
* as possible.
*
* We must not be holding the AIL_LOCK at this point. Calling incore() to
* search the buffercache can be a time consuming thing, and AIL_LOCK is a
* search the buffer cache can be a time consuming thing, and AIL_LOCK is a
* spinlock.
*/
STATIC void
Expand Down
Loading

0 comments on commit e71ac60

Please sign in to comment.