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