Commit 79cbe128 authored by Nathan Scott's avatar Nathan Scott

[XFS] Use a naming convention here thats more consistent with everything else.

SGI Modid: xfs-linux:xfs-kern:166562a
parent 55e585b4
/*
* Copyright (c) 2000-2003 Silicon Graphics, Inc. All Rights Reserved.
* Copyright (c) 2000-2004 Silicon Graphics, Inc. All Rights Reserved.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of version 2 of the GNU General Public License as
......@@ -54,9 +54,9 @@
#include "xfs_iomap.h"
#include <linux/mpage.h>
STATIC void count_page_state(struct page *, int *, int *, int *);
STATIC void convert_page(struct inode *, struct page *,
xfs_iomap_t *, void *, int, int);
STATIC void xfs_count_page_state(struct page *, int *, int *, int *);
STATIC void xfs_convert_page(struct inode *, struct page *,
xfs_iomap_t *, void *, int, int);
#if defined(XFS_RW_TRACE)
void
......@@ -73,7 +73,7 @@ xfs_page_trace(
loff_t offset = page->index << PAGE_CACHE_SHIFT;
int delalloc, unmapped, unwritten;
count_page_state(page, &delalloc, &unmapped, &unwritten);
xfs_count_page_state(page, &delalloc, &unmapped, &unwritten);
bdp = vn_bhv_lookup(VN_BHV_HEAD(vp), &xfs_vnodeops);
ip = XFS_BHVTOI(bdp);
......@@ -166,7 +166,7 @@ linvfs_unwritten_convert_direct(
}
STATIC int
map_blocks(
xfs_map_blocks(
struct inode *inode,
loff_t offset,
ssize_t count,
......@@ -196,12 +196,11 @@ map_blocks(
}
/*
* match_offset_to_mapping
* Finds the corresponding mapping in block @map array of the
* given @offset within a @page.
*/
STATIC xfs_iomap_t *
match_offset_to_mapping(
xfs_offset_to_map(
struct page *page,
xfs_iomap_t *iomapp,
unsigned long offset)
......@@ -222,7 +221,7 @@ match_offset_to_mapping(
}
STATIC void
map_buffer_at_offset(
xfs_map_at_offset(
struct page *page,
struct buffer_head *bh,
unsigned long offset,
......@@ -263,7 +262,7 @@ map_buffer_at_offset(
* in units of filesystem blocks.
*/
STATIC struct page *
probe_unwritten_page(
xfs_probe_unwritten_page(
struct address_space *mapping,
unsigned long index,
xfs_iomap_t *iomapp,
......@@ -289,11 +288,11 @@ probe_unwritten_page(
do {
if (!buffer_unwritten(bh))
break;
if (!match_offset_to_mapping(page, iomapp, p_offset))
if (!xfs_offset_to_map(page, iomapp, p_offset))
break;
if (p_offset >= max_offset)
break;
map_buffer_at_offset(page, bh, p_offset, bbits, iomapp);
xfs_map_at_offset(page, bh, p_offset, bbits, iomapp);
set_buffer_unwritten_io(bh);
bh->b_private = pb;
p_offset += bh->b_size;
......@@ -314,7 +313,7 @@ probe_unwritten_page(
* yet - clustering for mmap write case.
*/
STATIC unsigned int
probe_unmapped_page(
xfs_probe_unmapped_page(
struct address_space *mapping,
unsigned long index,
unsigned int pg_offset)
......@@ -350,7 +349,7 @@ probe_unmapped_page(
}
STATIC unsigned int
probe_unmapped_cluster(
xfs_probe_unmapped_cluster(
struct inode *inode,
struct page *startpage,
struct buffer_head *bh,
......@@ -375,7 +374,7 @@ probe_unmapped_cluster(
/* Prune this back to avoid pathological behavior */
tloff = min(tlast, startpage->index + 64);
for (tindex = startpage->index + 1; tindex < tloff; tindex++) {
len = probe_unmapped_page(mapping, tindex,
len = xfs_probe_unmapped_page(mapping, tindex,
PAGE_CACHE_SIZE);
if (!len)
return total;
......@@ -383,7 +382,8 @@ probe_unmapped_cluster(
}
if (tindex == tlast &&
(tloff = i_size_read(inode) & (PAGE_CACHE_SIZE - 1))) {
total += probe_unmapped_page(mapping, tindex, tloff);
total += xfs_probe_unmapped_page(mapping,
tindex, tloff);
}
}
return total;
......@@ -395,7 +395,7 @@ probe_unmapped_cluster(
* reference count.
*/
STATIC struct page *
probe_delalloc_page(
xfs_probe_delalloc_page(
struct inode *inode,
unsigned long index)
{
......@@ -431,7 +431,7 @@ probe_delalloc_page(
}
STATIC int
map_unwritten(
xfs_map_unwritten(
struct inode *inode,
struct page *start_page,
struct buffer_head *head,
......@@ -479,22 +479,16 @@ map_unwritten(
do {
if (!buffer_unwritten(bh))
break;
tmp = match_offset_to_mapping(start_page, iomapp, p_offset);
tmp = xfs_offset_to_map(start_page, iomapp, p_offset);
if (!tmp)
break;
map_buffer_at_offset(start_page, bh, p_offset, block_bits, iomapp);
xfs_map_at_offset(start_page, bh, p_offset, block_bits, iomapp);
set_buffer_unwritten_io(bh);
bh->b_private = pb;
p_offset += bh->b_size;
nblocks++;
} while ((bh = bh->b_this_page) != head);
if (unlikely(nblocks == 0)) {
printk("XFS: bad unwritten extent map: bh=0x%p, iomapp=0x%p\n",
curr, iomapp);
BUG();
}
atomic_add(nblocks, &pb->pb_io_remaining);
/* If we reached the end of the page, map forwards in any
......@@ -510,13 +504,15 @@ map_unwritten(
tloff = (iomapp->iomap_offset + iomapp->iomap_bsize) >> PAGE_CACHE_SHIFT;
tloff = min(tlast, tloff);
for (tindex = start_page->index + 1; tindex < tloff; tindex++) {
page = probe_unwritten_page(mapping, tindex, iomapp, pb,
page = xfs_probe_unwritten_page(mapping,
tindex, iomapp, pb,
PAGE_CACHE_SIZE, &bs, bbits);
if (!page)
break;
nblocks += bs;
atomic_add(bs, &pb->pb_io_remaining);
convert_page(inode, page, iomapp, pb, startio, all_bh);
xfs_convert_page(inode, page, iomapp, pb,
startio, all_bh);
/* stop if converting the next page might add
* enough blocks that the corresponding byte
* count won't fit in our ulong page buf length */
......@@ -526,12 +522,14 @@ map_unwritten(
if (tindex == tlast &&
(tloff = (i_size_read(inode) & (PAGE_CACHE_SIZE - 1)))) {
page = probe_unwritten_page(mapping, tindex, iomapp, pb,
page = xfs_probe_unwritten_page(mapping,
tindex, iomapp, pb,
tloff, &bs, bbits);
if (page) {
nblocks += bs;
atomic_add(bs, &pb->pb_io_remaining);
convert_page(inode, page, iomapp, pb, startio, all_bh);
xfs_convert_page(inode, page, iomapp, pb,
startio, all_bh);
if (nblocks >= ((ULONG_MAX - PAGE_SIZE) >> block_bits))
goto enough;
}
......@@ -558,7 +556,7 @@ map_unwritten(
}
STATIC void
submit_page(
xfs_submit_page(
struct page *page,
struct buffer_head *bh_arr[],
int cnt)
......@@ -594,7 +592,7 @@ submit_page(
* that the page has no mapping at all.
*/
STATIC void
convert_page(
xfs_convert_page(
struct inode *inode,
struct page *page,
xfs_iomap_t *iomapp,
......@@ -627,7 +625,7 @@ convert_page(
}
continue;
}
tmp = match_offset_to_mapping(page, mp, offset);
tmp = xfs_offset_to_map(page, mp, offset);
if (!tmp)
continue;
ASSERT(!(tmp->iomap_flags & IOMAP_HOLE));
......@@ -639,10 +637,10 @@ convert_page(
*/
if (buffer_unwritten(bh) && !bh->b_end_io) {
ASSERT(tmp->iomap_flags & IOMAP_UNWRITTEN);
map_unwritten(inode, page, head, bh,
xfs_map_unwritten(inode, page, head, bh,
offset, bbits, tmp, startio, all_bh);
} else if (! (buffer_unwritten(bh) && buffer_locked(bh))) {
map_buffer_at_offset(page, bh, offset, bbits, tmp);
xfs_map_at_offset(page, bh, offset, bbits, tmp);
if (buffer_unwritten(bh)) {
set_buffer_unwritten_io(bh);
bh->b_private = private;
......@@ -659,7 +657,7 @@ convert_page(
} while (i++, (bh = bh->b_this_page) != head);
if (startio) {
submit_page(page, bh_arr, index);
xfs_submit_page(page, bh_arr, index);
} else {
unlock_page(page);
}
......@@ -670,7 +668,7 @@ convert_page(
* by mp and following the start page.
*/
STATIC void
cluster_write(
xfs_cluster_write(
struct inode *inode,
unsigned long tindex,
xfs_iomap_t *iomapp,
......@@ -682,10 +680,10 @@ cluster_write(
tlast = (iomapp->iomap_offset + iomapp->iomap_bsize) >> PAGE_CACHE_SHIFT;
for (; tindex < tlast; tindex++) {
page = probe_delalloc_page(inode, tindex);
page = xfs_probe_delalloc_page(inode, tindex);
if (!page)
break;
convert_page(inode, page, iomapp, NULL, startio, all_bh);
xfs_convert_page(inode, page, iomapp, NULL, startio, all_bh);
}
}
......@@ -709,7 +707,7 @@ cluster_write(
*/
STATIC int
page_state_convert(
xfs_page_state_convert(
struct inode *inode,
struct page *page,
int startio,
......@@ -752,7 +750,7 @@ page_state_convert(
continue;
if (iomp) {
iomp = match_offset_to_mapping(page, &iomap, p_offset);
iomp = xfs_offset_to_map(page, &iomap, p_offset);
}
/*
......@@ -761,17 +759,17 @@ page_state_convert(
*/
if (buffer_unwritten(bh)) {
if (!iomp) {
err = map_blocks(inode, offset, len, &iomap,
err = xfs_map_blocks(inode, offset, len, &iomap,
BMAPI_READ|BMAPI_IGNSTATE);
if (err) {
goto error;
}
iomp = match_offset_to_mapping(page, &iomap,
iomp = xfs_offset_to_map(page, &iomap,
p_offset);
}
if (iomp && startio) {
if (!bh->b_end_io) {
err = map_unwritten(inode, page,
err = xfs_map_unwritten(inode, page,
head, bh, p_offset,
inode->i_blkbits, iomp,
startio, unmapped);
......@@ -788,17 +786,17 @@ page_state_convert(
*/
} else if (buffer_delay(bh)) {
if (!iomp) {
err = map_blocks(inode, offset, len, &iomap,
BMAPI_ALLOCATE | flags);
err = xfs_map_blocks(inode, offset, len, &iomap,
BMAPI_ALLOCATE | flags);
if (err) {
goto error;
}
iomp = match_offset_to_mapping(page, &iomap,
iomp = xfs_offset_to_map(page, &iomap,
p_offset);
}
if (iomp) {
map_buffer_at_offset(page, bh, p_offset,
inode->i_blkbits, iomp);
xfs_map_at_offset(page, bh, p_offset,
inode->i_blkbits, iomp);
if (startio) {
bh_arr[cnt++] = bh;
} else {
......@@ -820,19 +818,19 @@ page_state_convert(
* need to write the whole page out.
*/
if (!iomp) {
size = probe_unmapped_cluster(
size = xfs_probe_unmapped_cluster(
inode, page, bh, head);
err = map_blocks(inode, offset,
size, &iomap,
BMAPI_WRITE | BMAPI_MMAP);
err = xfs_map_blocks(inode, offset,
size, &iomap,
BMAPI_WRITE|BMAPI_MMAP);
if (err) {
goto error;
}
iomp = match_offset_to_mapping(page, &iomap,
iomp = xfs_offset_to_map(page, &iomap,
p_offset);
}
if (iomp) {
map_buffer_at_offset(page,
xfs_map_at_offset(page,
bh, p_offset,
inode->i_blkbits, iomp);
if (startio) {
......@@ -859,10 +857,10 @@ page_state_convert(
SetPageUptodate(page);
if (startio)
submit_page(page, bh_arr, cnt);
xfs_submit_page(page, bh_arr, cnt);
if (iomp)
cluster_write(inode, page->index + 1, iomp, startio, unmapped);
xfs_cluster_write(inode, page->index + 1, iomp, startio, unmapped);
return page_dirty;
......@@ -1076,7 +1074,7 @@ linvfs_readpages(
}
STATIC void
count_page_state(
xfs_count_page_state(
struct page *page,
int *delalloc,
int *unmapped,
......@@ -1144,7 +1142,7 @@ linvfs_writepage(
unmapped = 1;
need_trans = 1;
} else {
count_page_state(page, &delalloc, &unmapped, &unwritten);
xfs_count_page_state(page, &delalloc, &unmapped, &unwritten);
if (!PageUptodate(page))
unmapped = 0;
need_trans = delalloc + unmapped + unwritten;
......@@ -1170,7 +1168,7 @@ linvfs_writepage(
* Convert delayed allocate, unwritten or unmapped space
* to real space and flush out to disk.
*/
error = page_state_convert(inode, page, 1, unmapped);
error = xfs_page_state_convert(inode, page, 1, unmapped);
if (error == -EAGAIN)
goto out_fail;
if (unlikely(error < 0))
......@@ -1216,7 +1214,7 @@ linvfs_release_page(
xfs_page_trace(XFS_RELEASEPAGE_ENTER, inode, page, gfp_mask);
count_page_state(page, &delalloc, &unmapped, &unwritten);
xfs_count_page_state(page, &delalloc, &unmapped, &unwritten);
if (!delalloc && !unwritten)
goto free_buffers;
......@@ -1235,7 +1233,7 @@ linvfs_release_page(
* Never need to allocate space here - we will always
* come back to writepage in that case.
*/
dirty = page_state_convert(inode, page, 0, 0);
dirty = xfs_page_state_convert(inode, page, 0, 0);
if (dirty == 0 && !unwritten)
goto free_buffers;
return 0;
......
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