[Ocfs2-commits] jlbec commits r1585 - trunk/src
svn-commits at oss.oracle.com
svn-commits at oss.oracle.com
Thu Oct 21 22:57:50 CDT 2004
Author: jlbec
Date: 2004-10-21 22:57:49 -0500 (Thu, 21 Oct 2004)
New Revision: 1585
Removed:
trunk/src/extmap.c
trunk/src/extmap.h
Modified:
trunk/src/24io.c
trunk/src/Makefile
trunk/src/alloc.c
trunk/src/alloc.h
trunk/src/aops.c
trunk/src/dir.c
trunk/src/extent_map.h
trunk/src/file.c
trunk/src/file.h
trunk/src/inode.c
trunk/src/journal.c
trunk/src/namei.c
trunk/src/nm.c
trunk/src/ocfs.h
trunk/src/super.c
Log:
o Remove lookup_file_allocation. There was much rejoicing.
Modified: trunk/src/24io.c
===================================================================
--- trunk/src/24io.c 2004-10-21 23:20:17 UTC (rev 1584)
+++ trunk/src/24io.c 2004-10-22 03:57:49 UTC (rev 1585)
@@ -1,3 +1,27 @@
+/* -*- mode: c; c-basic-offset: 8; -*-
+ * vim: noexpandtab sw=8 ts=8 sts=0:
+ *
+ * 24io.c
+ *
+ * O_DIRECT and AIO routines for 2.4 kernels.
+ *
+ * Copyright (C) 2002, 2004 Oracle. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 021110-1307, USA.
+ */
#include <linux/version.h>
@@ -24,49 +48,25 @@
#define KERNEL_NO_F_IOBUF 1
#endif
-static int ocfs_get_block2 (struct inode *inode, long iblock, long *oblock, int len)
+static int ocfs_get_sector(struct inode *inode, unsigned long isector,
+ unsigned long *osector)
{
int err = -EIO;
- ocfs_super *osb;
- __s64 vbo = 0;
- __s64 lbo = 0;
- u64 p_blkno;
- u64 p_sector;
- u64 v_blkno;
+ u64 v_blkno, p_blkno, p_sector;
int s_to_b_bits, offset;
- LOG_ENTRY_ARGS ("(0x%p, %ld)\n", inode, iblock);
+ LOG_ENTRY_ARGS ("(0x%p, %lu)\n", inode, isector);
+ err = -EINVAL;
if (!inode) {
LOG_ERROR_STR ("bad inode");
- err = -1;
goto bail;
}
- osb = OCFS_SB(inode->i_sb);
-
- vbo = (__s64) iblock << osb->s_sectsize_bits;
- err = ocfs_lookup_file_allocation(osb, vbo, &lbo, len, NULL,
- inode);
- if (err < 0) {
- LOG_ERROR_STATUS (err);
- err = -1;
- goto bail;
- }
-
- err = 0;
-
- *oblock = lbo >> osb->s_sectsize_bits;
- if (*oblock == 0) {
- err = -EIO;
- LOG_ERROR_ARGS ("vbo=%lld lbo=%lld len=%u, blkno=(%llu)\n",
- vbo, lbo, len,
- OCFS_I(inode)->ip_blkno);
- }
-
- s_to_b_bits = osb->sb->s_blocksize_bits - osb->s_sectsize_bits;
- v_blkno = (u64)iblock >> s_to_b_bits;
- offset = (int)((u64)iblock & ((1ULL << s_to_b_bits) - 1));
+ s_to_b_bits = inode->i_sb->s_blocksize_bits -
+ OCFS_SB(inode->i_sb)->s_sectsize_bits;
+ v_blkno = (u64)isector >> s_to_b_bits;
+ offset = (int)((u64)isector & ((1ULL << s_to_b_bits) - 1));
err = ocfs2_extent_map_get_blocks(inode, v_blkno, 1, &p_blkno,
NULL);
if (err) {
@@ -76,18 +76,21 @@
p_sector = p_blkno << s_to_b_bits;
p_sector += offset;
- if (p_sector != *oblock) {
- err = -EIO;
- LOG_ERROR_ARGS("p_sector = %llu, *oblock = %llu\n",
- p_sector, (unsigned long long)*oblock);
- }
+ if (p_sector == 0) {
+ err = -EIO;
+ LOG_ERROR_ARGS ("isector=%lu inode=%llu\n",
+ isector, OCFS_I(inode)->ip_blkno);
+ }
+
+ /* 2.4 shouldn't ever have this happen */
+ OCFS_ASSERT(p_sector <= ULONG_MAX);
+
+ *osector = (unsigned long)p_sector;
bail:
- if (err < 0)
- err = -EIO;
LOG_EXIT_INT (err);
return err;
-} /* ocfs_get_block2 */
+} /* ocfs_get_sector */
/*
* ocfs_rw_direct()
@@ -110,7 +113,6 @@
int max_sectors;
int nbhs;
int sector_size, sector_bits, sector_mask, sectors_per_page;
- int ret = 0;
int large_io = 0;
int inuse = 0;
unsigned long blocks_end_cluster = 0;
@@ -194,11 +196,10 @@
firstlogic = blocknr;
totalioblocks = 0;
- ret = ocfs_get_block2 (inode, blocknr, &firstphys, sector_size);
- if (ret == -1) {
- err = 0;
+ err = ocfs_get_sector(inode, blocknr, &firstphys);
+ if (err)
goto out;
- }
+
while (myiosize > 0) {
if (blocks_end_cluster + 1 > myiosize) {
totalioblocks += myiosize;
@@ -210,11 +211,10 @@
nextlogic = firstlogic + blocks_end_cluster;
}
again:
- ret = ocfs_get_block2 (inode, nextlogic, &nextphys, sector_size);
- if (ret == -1) {
- err = 0;
+ err = ocfs_get_sector(inode, nextlogic, &nextphys);
+ if (err)
goto out;
- }
+
if (nextphys == (firstphys + totalioblocks)) {
// merge ok
blocks_end_cluster = clustersize - (nextlogic % clustersize);
@@ -368,7 +368,6 @@
int sector_size = 1 << OCFS_SB(inode->i_sb)->s_sectsize_bits;
int sector_mask = sector_size - 1;
- int ret;
unsigned long firstlogic;
long nextphys;
unsigned long nextlogic = 0;
@@ -396,7 +395,7 @@
blocks = max_sectors;
if (!blocks) {
err = -ENXIO;
- return err;;
+ return err;
}
iosize = blocks << sector_bits;
@@ -406,11 +405,10 @@
firstlogic = blocknr;
totalioblocks = 0;
- err = ocfs_get_block2(inode, blocknr, &firstphys, sector_size);
- if ( err == -1 ) {
- err = 0;
+ err = ocfs_get_sector(inode, blocknr, &firstphys);
+ if (err)
return err;
- }
+
if (blocks_end_cluster + 1 > myiosize) {
totalioblocks += myiosize;
myiosize = 0;
@@ -421,11 +419,10 @@
nextlogic = firstlogic + blocks_end_cluster;
}
again:
- ret = ocfs_get_block2 (inode, nextlogic, &nextphys, sector_size);
- if (ret == -1) {
- err = 0;
+ err = ocfs_get_sector(inode, nextlogic, &nextphys);
+ if (err)
return err;
- }
+
if (nextphys == (firstphys + totalioblocks)) {
blocks_end_cluster = clustersize - (nextlogic % clustersize);
if (blocks_end_cluster + 1 > myiosize) {
Modified: trunk/src/Makefile
===================================================================
--- trunk/src/Makefile 2004-10-21 23:20:17 UTC (rev 1584)
+++ trunk/src/Makefile 2004-10-22 03:57:49 UTC (rev 1585)
@@ -71,7 +71,6 @@
dcache.c \
dir.c \
dlm.c \
- extmap.c \
extent_map.c \
file.c \
heartbeat.c \
@@ -106,7 +105,6 @@
dcache.h \
dir.h \
dlm.h \
- extmap.h \
extent_map.h \
file.h \
heartbeat.h \
Modified: trunk/src/alloc.c
===================================================================
--- trunk/src/alloc.c 2004-10-21 23:20:17 UTC (rev 1584)
+++ trunk/src/alloc.c 2004-10-22 03:57:49 UTC (rev 1585)
@@ -37,7 +37,6 @@
#include "alloc.h"
#include "bitmap.h"
#include "dlm.h"
-#include "extmap.h"
#include "extent_map.h"
#include "inode.h"
#include "localalloc.h"
@@ -942,289 +941,6 @@
return status;
}
-/*
- * ocfs_lookup_file_allocation()
- *
- * This routine looks up the existing mapping of VBO to LBO for a file.
- * The information it queries is either stored in the extent map field
- * of the oin or is stored in the allocation file and needs to be retrieved,
- * decoded and updated in the extent map.
- *
- */
-int ocfs_lookup_file_allocation(ocfs_super *osb, __s64 Vbo,
- __s64 *Lbo, __u32 bytecount,
- __s64 *contig_bytes,
- struct inode *inode)
-{
- int status;
- ocfs2_dinode *fe = NULL;
- struct buffer_head *fe_bh = NULL;
- ocfs2_extent_block *eb = NULL;
- struct buffer_head *eb_bh = NULL;
- u64 next_leaf;
- __u64 remainingLength = 0;
- __s64 localVbo;
- __u64 cnt;
- __u32 NumIndex;
-
- LOG_ENTRY_ARGS("(vbo=%llu, bytecount=%u, inode=%llu)\n", Vbo, bytecount,
- OCFS_I(inode)->ip_blkno);
-
- OCFS_ASSERT (osb);
- OCFS_ASSERT (inode);
-
- /* Make sure we're not trying to read past end of file --
- * alloc_size should be up to date as any nodes changing it
- * will have sent us an UPDATE_INODE message. */
- if (Vbo >= OCFS_I(inode)->ip_alloc_size) {
- status = -EIO;
- LOG_ERROR_STATUS(status);
- goto finally;
- }
-
- status = ocfs_lookup_extent_map_entry(osb,
- &(OCFS_I(inode)->ip_ext_map),
- Vbo, Lbo, &cnt, &NumIndex);
-
-
- if (status &&
- (cnt >= (u64)bytecount)) {
- /* Found a what we were looking for. */
- status = 0;
- goto success;
- }
-
- /* Ok, we didn't find it in the extent map (or we need to
- * refresh as alloc sizes don't match up. */
- remainingLength = (u64)bytecount;
- localVbo = Vbo;
-
- /*
- * We are looking for a Vbo, but it is not in the Map or not
- * Valid. Thus we have to go to the disk, and update the Map
- */
-
- /* Read the file Entry corresponding to this */
- status = ocfs_read_block(osb,
- OCFS_I(inode)->ip_blkno,
- &fe_bh, OCFS_BH_CACHED, inode);
- if (status < 0) {
- LOG_ERROR_STATUS (status);
- goto finally;
- }
-
- fe = (ocfs2_dinode *) fe_bh->b_data;
-
- if (!IS_VALID_FILE_ENTRY (fe)) {
- LOG_ERROR_STATUS (status = -EINVAL);
- goto finally;
- }
-
- if (Vbo >= (__s64)((u64)fe->i_clusters << osb->s_clustersize_bits)) {
- LOG_ERROR_ARGS ("vbo=%llu, fe->i_clusters=%u ip_alloc_size=%llu",
- Vbo, fe->i_clusters,
- OCFS_I(inode)->ip_alloc_size);
- status = -EINVAL;
- goto finally;
- }
-
- if (!fe->id2.i_list.l_tree_depth) {
- status = ocfs_update_extent_map(osb,
- &OCFS_I(inode)->ip_ext_map, fe,
- NULL, NULL, LOCAL_EXT);
- if (status < 0) {
- LOG_ERROR_STATUS (status);
- goto finally;
- }
- } else {
- /* Extents are branched and we are no longer using
- * Local Extents for this File Entry. */
-
- status = ocfs_get_leaf_extent(osb, fe, localVbo,
- &eb_bh, inode);
- if (status < 0) {
- LOG_ERROR_STATUS (status);
- goto finally;
- }
-
- eb = (ocfs2_extent_block *) eb_bh->b_data;
- while (1) {
- status = ocfs_update_extent_map(osb,
- &OCFS_I(inode)->ip_ext_map,
- eb, &localVbo,
- &remainingLength,
- NONLOCAL_EXT);
- if (status < 0) {
- LOG_ERROR_STATUS(status);
- goto finally;
- }
-
- if (remainingLength > 0) {
- if (!eb->h_next_leaf_blk) {
- LOG_ERROR_ARGS ("localVbo=%llu, "
- "ip_alloc_size=%llu, "
- " thisext=%llu",
- localVbo,
- OCFS_I(inode)->ip_alloc_size,
- eb->h_blkno);
- status = -EINVAL;
- goto finally;
- }
-
- next_leaf = eb->h_next_leaf_blk;
-
- brelse(eb_bh);
- eb_bh = NULL;
- eb = NULL;
-
- status = ocfs_read_block(osb,
- next_leaf,
- &eb_bh,
- OCFS_BH_CACHED,
- inode);
- if (status < 0) {
- LOG_ERROR_STATUS(status);
- goto finally;
- }
- eb = (ocfs2_extent_block *) eb_bh->b_data;
- if (!IS_VALID_EXTENT_BLOCK(eb) ||
- eb->h_list.l_tree_depth) {
- LOG_ERROR_STATUS (status = -EINVAL);
- goto finally;
- }
- } else {
- break;
- }
- }
- }
-
- status = ocfs_lookup_extent_map_entry(osb,
- &(OCFS_I(inode)->ip_ext_map),
- Vbo, Lbo, &cnt, &NumIndex);
- if (status && cnt >= (u64)bytecount)
- status = 0;
- else {
- status = -EINVAL;
- if (cnt == 0)
- printk("failed to lookup extmap... vbo=%llu "
- "mapcount=%d, inode = %lu, alloc_size = %llu, "
- "cnt = %llu\n", Vbo,
- OCFS_I(inode)->ip_ext_map.count, inode->i_ino,
- OCFS_I(inode)->ip_alloc_size, cnt);
- }
-
-success:
- /* want to return cnt only if asked for it */
- if (contig_bytes)
- *contig_bytes = cnt;
-
- LOG_TRACE_ARGS("returning contig_bytes=%lld, lbo=%lld\n", cnt, *Lbo);
-
-finally:
-
- if (fe_bh)
- brelse(fe_bh);
-
- if (eb_bh)
- brelse(eb_bh);
-
- LOG_EXIT_STATUS (status);
- return (status);
-} /* ocfs_lookup_file_allocation */
-
-/* ocfs_get_leaf_extent()
- * '*data_exent_bh' should be NULL.
- */
-int ocfs_get_leaf_extent(ocfs_super *osb, ocfs2_dinode *fe,
- __s64 Vbo, struct buffer_head **data_extent_bh,
- struct inode *inode)
-{
- int status = 0, tempstat;
- int i, j;
- struct buffer_head *ext_bh = NULL;
- ocfs2_extent_block *eb = NULL;
- ocfs2_extent_list *el, *fel;
- ocfs2_extent_block *tmp = NULL;
- u64 child_blkno = 0;
-
- LOG_ENTRY ();
-
- fel = &fe->id2.i_list;
-
- for (i = 0; i < fel->l_next_free_rec; i++) {
- if ((__s64)((u64)(fel->l_recs[i].e_cpos + fel->l_recs[i].e_clusters) << osb->s_clustersize_bits) > Vbo) {
- child_blkno = fel->l_recs[i].e_blkno;
- break;
- }
- }
-
- if (i >= fel->l_next_free_rec) {
- LOG_ERROR_STATUS(status = -EINVAL);
- goto finally;
- }
-
- for (i = 1; i < fel->l_tree_depth; i++) {
- tempstat = ocfs_read_block(osb,
- child_blkno,
- &ext_bh, OCFS_BH_CACHED,
- inode);
- if (tempstat < 0) {
- LOG_ERROR_STATUS (status = tempstat);
- goto finally;
- }
-
- eb = (ocfs2_extent_block *) ext_bh->b_data;
- if (!IS_VALID_EXTENT_BLOCK(eb)) {
- LOG_ERROR_STATUS (status = -EINVAL);
- goto finally;
- }
- el = &eb->h_list;
-
- for (j = 0; j < el->l_next_free_rec; j++) {
- if ((__s64)((u64)(el->l_recs[j].e_cpos + el->l_recs[j].e_clusters) << osb->s_clustersize_bits) > Vbo)
- {
- child_blkno = el->l_recs[j].e_blkno;
- break;
- }
- }
-
- brelse(ext_bh);
- ext_bh = NULL;
- eb = NULL;
- }
-
- if (*data_extent_bh) {
- LOG_ERROR_ARGS("*data_extent_bh should be NULL, but is " \
- "%p -- setting it to NULL!\n", *data_extent_bh);
- *data_extent_bh = NULL;
- }
-
- tempstat = ocfs_read_block(osb,
- child_blkno,
- data_extent_bh, OCFS_BH_CACHED,
- inode);
- if (tempstat < 0) {
- LOG_ERROR_STATUS (status = tempstat);
- goto finally;
- }
-
- tmp = (ocfs2_extent_block *) (*data_extent_bh)->b_data;
- if (!IS_VALID_EXTENT_BLOCK(tmp) ||
- tmp->h_list.l_tree_depth) {
- LOG_ERROR_STATUS (status = -EINVAL);
- brelse(*data_extent_bh);
- *data_extent_bh = NULL;
- goto finally;
- }
-
-finally:
- if (ext_bh)
- brelse(ext_bh);
-
- LOG_EXIT_STATUS (status);
- return (status);
-} /* ocfs_get_leaf_extent */
-
void ocfs_free_alloc_context(ocfs2_alloc_context *ac)
{
if (ac->ac_inode)
@@ -1813,10 +1529,6 @@
down_write(&OCFS_I(inode)->ip_alloc_sem);
- spin_lock(&OCFS_I(inode)->ip_lock);
- ocfs_extent_map_trunc(&OCFS_I(inode)->ip_ext_map);
- spin_unlock(&OCFS_I(inode)->ip_lock);
-
last_eb_bh = tc->tc_last_eb_bh;
tc->tc_last_eb_bh = NULL;
handle = tc->tc_handle;
Modified: trunk/src/alloc.h
===================================================================
--- trunk/src/alloc.h 2004-10-21 23:20:17 UTC (rev 1584)
+++ trunk/src/alloc.h 2004-10-22 03:57:49 UTC (rev 1585)
@@ -35,15 +35,6 @@
u32 new_clusters,
struct _ocfs2_alloc_context *meta_ac);
-int ocfs_get_leaf_extent(ocfs_super *osb, ocfs2_dinode *fe,
- __s64 Vbo, struct buffer_head **data_extent_bh,
- struct inode *inode);
-
-int ocfs_lookup_file_allocation(ocfs_super *osb, __s64 Vbo,
- __s64 *Lbo, __u32 blocks,
- __s64 *contig_bytes,
- struct inode *inode);
-
typedef struct _ocfs2_alloc_context {
struct inode *ac_inode; /* which bitmap are we allocating from? */
struct buffer_head *ac_bh; /* file entry bh */
Modified: trunk/src/aops.c
===================================================================
--- trunk/src/aops.c 2004-10-21 23:20:17 UTC (rev 1584)
+++ trunk/src/aops.c 2004-10-22 03:57:49 UTC (rev 1585)
@@ -128,11 +128,8 @@
struct buffer_head *bh_result, int create)
{
int err = -EIO;
- int err2 = -EIO;
- __s64 vbo = 0;
- __s64 lbo = 0;
+ u64 vbo = 0;
u64 p_blkno;
- __u32 len;
int open_direct;
LOG_ENTRY_ARGS("(0x%p, %llu, 0x%p, %d)\n", inode,
@@ -152,7 +149,7 @@
goto bail;
}
- vbo = (__s64) iblock << inode->i_sb->s_blocksize_bits;
+ vbo = (u64)iblock << inode->i_sb->s_blocksize_bits;
/* this can happen if another node truncs after our extend! */
spin_lock(&OCFS_I(inode)->ip_lock);
@@ -163,45 +160,30 @@
}
spin_unlock(&OCFS_I(inode)->ip_lock);
- len = inode->i_sb->s_blocksize;
if (!open_direct)
down_read(&OCFS_I(inode)->ip_node_extend_sem);
- err = ocfs_lookup_file_allocation(OCFS2_SB(inode->i_sb),
- vbo, &lbo, len, NULL,
- inode);
- err2 = ocfs2_extent_map_get_blocks(inode, iblock, 1, &p_blkno,
+ err = ocfs2_extent_map_get_blocks(inode, iblock, 1, &p_blkno,
NULL);
if (!open_direct)
up_read(&OCFS_I(inode)->ip_node_extend_sem);
- if (err < 0) {
- LOG_ERROR_ARGS("vbo=%lld lbo=%lld len=%u", vbo, lbo, len);
- goto bail;
- }
-
- if (err2 < 0) {
- err = err2;
+ if (err) {
LOG_ERROR_ARGS("Error %d from get_blocks(0x%p, %llu, 1, %llu, NULL)\n",
- err2,
+ err,
inode, (unsigned long long)iblock,
p_blkno);
goto bail;
}
- if (p_blkno != (lbo >> inode->i_sb->s_blocksize_bits)) {
- LOG_ERROR_ARGS("get_blocks() returned %llu, expected %lld\n",
- p_blkno, lbo >> inode->i_sb->s_blocksize_bits);
- }
+ map_bh(bh_result, inode->i_sb, p_blkno);
- map_bh(bh_result, inode->i_sb, lbo >> inode->i_sb->s_blocksize_bits);
-
err = 0;
if (bh_result->b_blocknr == 0) {
err = -EIO;
- LOG_ERROR_ARGS ("vbo=%lld lbo=%lld len=%u, blkno=(%llu)\n",
- vbo, lbo, len,
+ LOG_ERROR_ARGS ("iblock = %llu p_blkno = %llu blkno=(%llu)\n",
+ (unsigned long long)iblock, p_blkno,
OCFS_I(inode)->ip_blkno);
}
@@ -457,17 +439,11 @@
{
/* Why do two #ifs? Because Mark is an EMACS user. */
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
- sector_t disk_block = 0;
sector_t status;
#else
- int disk_block = 0;
int status;
#endif
- ocfs_super *osb = OCFS_SB(mapping->host->i_sb);
- __s64 vbo = 0;
- __s64 lbo = 0;
- __u32 len;
- u64 p_blkno;
+ u64 p_blkno = 0;
int err = 0;
struct inode *inode = mapping->host;
@@ -481,17 +457,6 @@
goto bail;
}
- vbo = (__s64) block << inode->i_sb->s_blocksize_bits;
- len = osb->sb->s_blocksize;
- err = ocfs_lookup_file_allocation(osb, vbo, &lbo, len, NULL,
- inode);
- if (err < 0) {
- LOG_ERROR_ARGS ("vbo=%lld lbo=%lld len=%u", vbo,
- lbo, len);
- LOG_ERROR_STATUS(err);
- goto bail;
- }
-
err = ocfs2_extent_map_get_blocks(inode, block, 1, &p_blkno,
NULL);
if (err) {
@@ -501,21 +466,13 @@
goto bail;
}
- disk_block = lbo >> inode->i_sb->s_blocksize_bits;
-
- /* FIXME size of items */
- if (p_blkno != disk_block) {
- LOG_ERROR_ARGS("get_blocks() returned %llu, expected %llu\n",
- p_blkno,
- (unsigned long long)disk_block);
- }
bail:
/* "Gross" - MarkF (While Joel was inserting the #if) */
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
- status = err ? 0 : disk_block;
+ status = err ? 0 : p_blkno;
#else
- status = err ? err : disk_block;
+ status = err ? err : (int)p_blkno;
#endif
LOG_EXIT_STATUS((int)status);
@@ -536,7 +493,7 @@
*
* We should probably have this data in the oin for the inode.
* Otherwise, we might want to look at ocfs_rw_direct,
- * ocfs_lookup_file_allocation and ocfs_get_block
+ * ocfs2_extent_map_get_blocks, and ocfs_get_block
*
* called like this: dio->get_blocks(dio->inode, fs_startblk,
* fs_count, map_bh, dio->rw == WRITE);
@@ -546,13 +503,10 @@
int ret = -1;
int status;
ocfs_super *osb = NULL;
- __s64 vbo; /* file offset */
- __s64 lbo; /* logical (disk) offset */
- __s64 vbo_max; /* file offset, max_blocks from iblock */
+ u64 vbo_max; /* file offset, max_blocks from iblock */
u64 p_blkno;
int contig_blocks;
int set_new = 0; /* flag */
- __u64 new_size; /* In bytes, the size of the contiguous block */
unsigned char blocksize_bits;
if (!inode || !bh_result) {
@@ -560,7 +514,6 @@
return -EIO;
}
- osb = inode->i_sb->s_fs_info;
blocksize_bits = inode->i_sb->s_blocksize_bits;
/* make sure we're up to date... */
if (atomic_read(&OCFS_I(inode)->ip_needs_verification)) {
@@ -577,8 +530,7 @@
* nicely aligned and of the right size, so there's no need
* for us to check any of that. */
- vbo = (__s64) iblock << blocksize_bits;
- vbo_max = vbo + ((__s64) max_blocks << blocksize_bits);
+ vbo_max = (u64)(iblock + max_blocks) << blocksize_bits;
/* NOTE: create flag is set when we ?may? have to allocate some
blocks for the file. */
@@ -595,12 +547,6 @@
/* This figure out the size of the next contiguous block, and
* our logical offset */
- /* TODO: Try our damndest to give sizes in multiples of PAGE_SIZE */
- /* FIXME: nice bug, fail to check status. Which will fail if
- * max_blocks > the contiguousness. */
- status = ocfs_lookup_file_allocation(osb, vbo, &lbo, max_blocks << blocksize_bits,
- &new_size, inode);
-
status = ocfs2_extent_map_get_blocks(inode, iblock, 1, &p_blkno,
&contig_blocks);
if (status) {
@@ -610,36 +556,22 @@
goto bail;
}
- if (p_blkno != (lbo >> blocksize_bits)) {
- LOG_ERROR_ARGS("get_blocks() returned %llu, expected %lld\n",
- p_blkno, lbo >> blocksize_bits);
- }
-
- if (contig_blocks != (new_size >> blocksize_bits)) {
- LOG_ERROR_ARGS("get_blocks() returned contig = %u, expected %lld\n",
- contig_blocks, new_size >> blocksize_bits);
- }
-
- if (max_blocks < contig_blocks)
- contig_blocks = max_blocks;
-
-
/* Do whatever we need to the buffer_head */
if (set_new) {
set_buffer_new(bh_result);
/* Do we really want to set bh_result->b_blocknr here too? */
- bh_result->b_blocknr = lbo >> blocksize_bits;
+ bh_result->b_blocknr = p_blkno;
} else {
clear_buffer_new(bh_result);
/* is the last argument here correct? */
- map_bh(bh_result, inode->i_sb, lbo >> blocksize_bits);
+ map_bh(bh_result, inode->i_sb, p_blkno);
}
/* make sure we don't map more than max_blocks blocks here as
that's all the kernel will handle at this point. */
- if (new_size > (__u64)max_blocks << blocksize_bits)
- new_size = (__u64)max_blocks << blocksize_bits;
- bh_result->b_size = new_size;
+ if (max_blocks < contig_blocks)
+ contig_blocks = max_blocks;
+ bh_result->b_size = contig_blocks << blocksize_bits;
ret = 0;
bail:
Modified: trunk/src/dir.c
===================================================================
--- trunk/src/dir.c 2004-10-21 23:20:17 UTC (rev 1584)
+++ trunk/src/dir.c 2004-10-22 03:57:49 UTC (rev 1585)
@@ -348,7 +348,6 @@
struct buffer_head **new_bh)
{
int status;
- s64 vbo, lbo;
int extend;
u64 p_blkno;
@@ -367,28 +366,14 @@
}
}
- vbo = (s64) dir->i_size;
- lbo = 0;
-
- status = ocfs_lookup_file_allocation(OCFS_SB(sb), vbo, &lbo,
- sb->s_blocksize, NULL, dir);
- if (status < 0) {
- LOG_ERROR_STATUS(status);
- goto bail;
- }
-
status = ocfs2_extent_map_get_blocks(dir, dir->i_blocks, 1,
&p_blkno, NULL);
if (status < 0) {
LOG_ERROR_STATUS(status);
goto bail;
}
- if (p_blkno != (lbo >> sb->s_blocksize_bits)) {
- LOG_ERROR_ARGS("Bad get_blocks(), got %llu, expected %llu\n",
- p_blkno, (lbo >> sb->s_blocksize_bits));
- }
- *new_bh = sb_getblk(sb, lbo >> sb->s_blocksize_bits);
+ *new_bh = sb_getblk(sb, p_blkno);
if (!*new_bh) {
status = -EIO;
LOG_ERROR_STATUS(status);
Modified: trunk/src/extent_map.h
===================================================================
--- trunk/src/extent_map.h 2004-10-21 23:20:17 UTC (rev 1584)
+++ trunk/src/extent_map.h 2004-10-22 03:57:49 UTC (rev 1585)
@@ -20,8 +20,6 @@
* License along with this program; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 021110-1307, USA.
- *
- * Authors: Joel Becker
*/
#ifndef _EXTENT_MAP_H
Deleted: trunk/src/extmap.c
===================================================================
--- trunk/src/extmap.c 2004-10-21 23:20:17 UTC (rev 1584)
+++ trunk/src/extmap.c 2004-10-22 03:57:49 UTC (rev 1585)
@@ -1,640 +0,0 @@
-/* -*- mode: c; c-basic-offset: 8; -*-
- * vim: noexpandtab sw=8 ts=8 sts=0:
- *
- * extmap.c
- *
- * Creates, adds, coalesces, deletes extent maps
- *
- * Copyright (C) 2002, 2004 Oracle. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this program; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 021110-1307, USA.
- */
-
-#include "ocfs_compat.h"
-
-#include <linux/fs.h>
-#include <linux/types.h>
-#include <linux/slab.h>
-
-#include "ocfs_log.h"
-#include "ocfs.h"
-
-#include "extmap.h"
-
-#define OCFS_DEBUG_CONTEXT OCFS_DEBUG_CONTEXT_EXTMAP
-
-/* Crazy wacky extent map stuff */
-/* works ok in userland debugocfs stuff too */
-
-static int ocfs_extent_map_add (ocfs_extent_map * map, __s64 virtual, __s64 physical, __s64 sectors);
-static int ocfs_extent_map_lookup (ocfs_extent_map *map, __s64 virtual, __s64 *physical, __s64 *sectors, __u32 *index);
-static int ocfs_extent_map_next_entry (ocfs_extent_map *map, __u32 index, __s64 *virtual, __s64 *physical, __s64 *sectors);
-
-
-static inline struct _ocfs_inode_private *EM_IP(struct _ocfs_extent_map *em)
-{
- return container_of(em, struct _ocfs_inode_private, ip_ext_map);
-}
-
-
-/*
- * ocfs_extent_map_init()
- *
- */
-void ocfs_extent_map_init (ocfs_extent_map * map)
-{
- LOG_ENTRY ();
-
- OCFS_ASSERT (map != NULL);
-
- spin_lock(&EM_IP(map)->ip_lock);
- map->count = 0;
- map->initialized = 1;
- INIT_LIST_HEAD(&map->head);
- spin_unlock(&EM_IP(map)->ip_lock);
-
- LOG_EXIT ();
- return;
-} /* ocfs_extent_map_init */
-
-/* expects you to hold ip_lock. */
-void ocfs_extent_map_trunc(ocfs_extent_map *map)
-{
- LOG_ENTRY ();
-
- OCFS_ASSERT(map);
-
- if (map->initialized) {
- struct list_head *tmp, *tmp2;
- ocfs_extent *ext;
- list_for_each_safe(tmp, tmp2, &map->head) {
- ext = list_entry (tmp, ocfs_extent, list);
- list_del(&ext->list);
- kmem_cache_free(OcfsGlobalCtxt.extent_cache,
- ext);
- map->count--;
- }
- if (map->count)
- LOG_ERROR_ARGS("count too high by %d!",
- map->count);
- }
- map->count = 0;
- map->initialized = 1;
- INIT_LIST_HEAD(&map->head);
-
- LOG_EXIT ();
- return;
-}
-
-/*
- * get_overlap_type()
- *
- */
-static int get_overlap_type (__u64 new, __u64 newend, __u64 exist, __u64 existend)
-{
- OCFS_ASSERT (newend > new);
- OCFS_ASSERT (existend > exist);
-
- if (new < exist) {
- if (newend < exist)
- return LEFT_NO_OVERLAP;
- else if (newend == exist)
- return LEFT_ADJACENT;
- else if (newend >= existend) /* && newend > exist */
- return FULLY_CONTAINING;
- else /* newend < existend && newend > exist */
- return LEFT_OVERLAP;
- } else if (new > exist) {
- if (new > existend)
- return RIGHT_NO_OVERLAP;
- else if (new == existend)
- return RIGHT_ADJACENT;
- else if (newend > existend) /* && new < existend */
- return RIGHT_OVERLAP;
- else /* newend <= existend && new < existend */
- return FULLY_CONTAINED;
- } else if (newend > existend) /* && new == exist */
- return FULLY_CONTAINING;
- else /* newend <= existend && new == exist */
- return FULLY_CONTAINED;
-} /* get_overlap_type */
-
-/*
- * ocfs_coalesce_extent_map_entry()
- *
- * Must call this with spinlock already held!
- */
-static int ocfs_coalesce_extent_map_entry (ocfs_extent_map * map, __s64 virtual, __s64 physical, __s64 sectors)
-{
- struct list_head *iter, *tmpiter;
- ocfs_extent *tmp, *victim;
- int voverlap, loverlap;
- int ret = 0;
-
- LOG_ENTRY ();
-
- if (!map->initialized) {
- LOG_ERROR_STR ("ExtentMap is not initialized");
- goto bail;
- }
-
- /* attempt to coalesce this into an existing entry */
-
- /*
- * NOTE: if we are successful in coalescing this entry with an entry from somewhere
- * in the list, we still need to check the rest of the list in case this entry
- * ends up filling one or more holes
- * |---- this ----|
- * |-- found --| |-- another entry --|
- * |---| <--- yet another entry
- */
-
- victim = NULL;
- list_for_each_safe(iter, tmpiter, &map->head) {
- int assimilate = 0;
-
- tmp = list_entry (iter, ocfs_extent, list);
- voverlap =
- get_overlap_type (virtual, virtual + sectors,
- tmp->virtual,
- tmp->virtual + tmp->sectors);
- loverlap =
- get_overlap_type (physical, physical + sectors,
- tmp->physical,
- tmp->physical + tmp->sectors);
-
- /* first off, if the virtual range and real range don't */
- /* overlap in the same way it definitely can't be coalesced */
- if (voverlap != loverlap)
- continue;
-
- switch (voverlap) {
- case LEFT_NO_OVERLAP: /* keep looking */
- break;
-
- case FULLY_CONTAINED: /* already fully accounted for, done */
- ret = 1;
- goto bail;
- break;
-
- case RIGHT_NO_OVERLAP: /* DONE! */
- break;
-
- case LEFT_ADJACENT: /* add new left part to found entry */
- assimilate = 1;
- sectors += tmp->sectors;
- ret = 1;
- break;
-
- case LEFT_OVERLAP: /* new physical/virtual ==> old end */
- /* must be same distance from edge */
- if ((tmp->virtual - virtual) == (tmp->physical - physical)) {
- assimilate = 1;
- sectors = tmp->sectors + (tmp->virtual - virtual);
- ret = 1;
- }
- break;
-
- case FULLY_CONTAINING: /* completely take over this entry */
- assimilate = 1;
- ret = 1;
- break;
-
- case RIGHT_OVERLAP: /* old physical/virtual ==> new end */
- /* must be same distance from edge */
- if ((virtual - tmp->virtual) == (physical - tmp->physical)) {
- assimilate = 1;
- sectors += virtual - tmp->virtual;
- virtual = tmp->virtual;
- physical = tmp->physical;
-//KASEY??? tmp->sectors = 0; /* mark for deletion */
- ret = 1;
- }
- break;
-
- case RIGHT_ADJACENT: /* add new right part to found entry */
- assimilate = 1;
- virtual = tmp->virtual;
- physical = tmp->physical;
- sectors += tmp->sectors;
- ret = 1;
- break;
-
- }
-
- if (assimilate) {
- if (victim==NULL) {
- victim = tmp;
- } else {
- list_del(&tmp->list);
- kmem_cache_free(OcfsGlobalCtxt.extent_cache,
- tmp);
- map->count--;
- }
- }
- } /* list_for_each_safe */
-
- if (victim) {
- victim->virtual = virtual;
- victim->physical = physical;
- victim->sectors = sectors;
- }
-
-bail:
-
- LOG_EXIT_INT (ret);
- return ret;
-} /* ocfs_coalesce_extent_map_entry */
-
-/*
- * ocfs_extent_map_add()
- *
- */
-static int ocfs_extent_map_add (ocfs_extent_map * map, __s64 virtual, __s64 physical, __s64 sectors)
-{
- ocfs_extent *ext, *tmp;
- int ret = 0;
- struct list_head *iter, *tmpiter;
- int added;
-
- LOG_ENTRY ();
-
- OCFS_ASSERT (map != NULL);
-
- if (!map->initialized) {
- LOG_ERROR_STATUS (-EINVAL);
- goto bail;
- }
- spin_lock(&EM_IP(map)->ip_lock);
-
- if (ocfs_coalesce_extent_map_entry (map, virtual, physical, sectors)) {
- LOG_TRACE_STR ("Successfully coalesced map entry");
- ret = 1;
- goto release_spinlock;
- }
-
- ext = kmem_cache_alloc(OcfsGlobalCtxt.extent_cache, GFP_NOFS);
- if (ext==NULL) {
- LOG_ERROR_STR ("failed to allocate extent entry");
- goto release_spinlock;
- }
- ext->virtual = virtual;
- ext->physical = physical;
- ext->sectors = sectors;
-
- added = 0;
- list_for_each_safe(iter, tmpiter, &map->head) {
- tmp = list_entry (iter, ocfs_extent, list);
- if (ext->virtual < tmp->virtual) {
- list_add_tail(&ext->list, iter);
- added = 1;
- break;
- }
- }
- if (!added)
- list_add_tail(&ext->list, &map->head);
-
- map->count++;
- ret = 1;
-
-release_spinlock:
- spin_unlock(&EM_IP(map)->ip_lock);
-
-bail:
- LOG_EXIT_INT (ret);
- return ret;
-} /* ocfs_extent_map_add */
-
-/*
- * ocfs_extent_map_lookup()
- *
- */
-static int ocfs_extent_map_lookup (ocfs_extent_map *map, __s64 virtual, __s64 *physical, __s64 *sectors, __u32 *index)
-{
- struct list_head *iter, *tmpiter;
- ocfs_extent *tmp;
- int ret = 0;
- __s64 hi, lo, delta;
-
- LOG_ENTRY ();
-
- OCFS_ASSERT (map != NULL);
-
- if (!map->initialized) {
- LOG_ERROR_STR ("BUG! Uninitialized ExtentMap!");
- goto bail;
- }
-
- spin_lock(&EM_IP(map)->ip_lock);
- list_for_each_safe(iter, tmpiter, &map->head) {
- tmp = list_entry (iter, ocfs_extent, list);
- lo = tmp->virtual;
- hi = lo + tmp->sectors;
- delta = virtual - lo;
- if (virtual >= lo && virtual < hi) {
- *physical = tmp->physical + delta;
- *sectors = tmp->sectors - delta;
- ret = 1;
- break;
- }
- (*index)++;
- }
- spin_unlock(&EM_IP(map)->ip_lock);
-
-bail:
- LOG_EXIT_INT (ret);
- return ret;
-} /* ocfs_extent_map_lookup */
-
-/*
- * ocfs_extent_map_next_entry()
- *
- */
-static int ocfs_extent_map_next_entry (ocfs_extent_map *map, __u32 index, __s64 *virtual, __s64 *physical, __s64 *sectors)
-{
- struct list_head *iter, *tmpiter;
- ocfs_extent *tmp;
- int ret = 0;
-
- LOG_ENTRY ();
-
- OCFS_ASSERT (map != NULL);
-
- if (!map->initialized) {
- LOG_ERROR_STR ("BUG! Uninitialized ExtentMap!");
- goto bail;
- }
-
- spin_lock(&EM_IP(map)->ip_lock);
- if (index >= map->count)
- goto release_spinlock;
-
- list_for_each_safe(iter, tmpiter, &map->head) {
- tmp = list_entry (iter, ocfs_extent, list);
- if (index) {
- index--;
- continue;
- }
- *virtual = tmp->virtual;
- *physical = tmp->physical;
- *sectors = tmp->sectors;
- ret = 1;
- break;
- }
-
-
-release_spinlock:
- spin_unlock(&EM_IP(map)->ip_lock);
-bail:
-
- LOG_EXIT_INT (ret);
- return ret;
-} /* ocfs_extent_map_next_entry */
-
-unsigned int ocfs_extent_map_get_count(ocfs_extent_map *map)
-{
- unsigned int count;
-
- spin_lock(&EM_IP(map)->ip_lock);
- count = map->count;
- spin_unlock(&EM_IP(map)->ip_lock);
-
- return count;
-}
-
-/*
- * ocfs_get_next_extent_map_entry()
- *
- * This routine looks up the existing mapping of VBO to LBO for a file.
- * The information it queries is either stored in the extent map field
- * of the oin or is stored in the allocation file and needs to be
- * retrieved, decoded and updated in the extent map.
- *
- */
-int ocfs_get_next_extent_map_entry (ocfs_super * osb, ocfs_extent_map * Map, __u32 RunIndex, __s64 * Vbo, __s64 * Lbo, __u32 * SectorCount)
-{
- int Results;
- __s64 LiSectorCount;
-
- LOG_ENTRY ();
-
- Results = ocfs_extent_map_next_entry (Map, RunIndex, Vbo, Lbo,
- &LiSectorCount);
-
- (*Vbo) <<= osb->sb->s_blocksize_bits;
- (*Lbo) <<= osb->sb->s_blocksize_bits;
-
- if (LiSectorCount > 0x00000000ffffffffLL) {
- /* overflow */
- Results = 0;
- *SectorCount = 0xffffffffUL;
- } else {
- *SectorCount = ((__u32)(LiSectorCount & 0xFFFFFFFFULL)) << osb->sb->s_blocksize_bits;
- }
-
- LOG_EXIT_INT (Results);
- return Results;
-} /* ocfs_get_next_extent_map_entry */
-
-/*
- * ocfs_lookup_extent_map_entry()
- *
- * search for an VBO in the extent map passed on.
- *
- * Returns true if entry available in the extent map, false otherwise.
- */
-int ocfs_lookup_extent_map_entry (ocfs_super * osb, ocfs_extent_map * Map, __s64 Vbo, __s64 * Lbo, __u64 * SectorCount, __u32 * Index)
-{
- int ret;
- __s64 LiLbo = 0;
- __s64 LiSectorCount = 0;
- __u64 remainder = 0;
-
- LOG_ENTRY ();
-
- /* Sector Align the vbo */
- remainder = Vbo & (osb->sb->s_blocksize - 1);
-
- ret = ocfs_extent_map_lookup (Map, (Vbo >> osb->sb->s_blocksize_bits), &LiLbo,
- &LiSectorCount, Index);
- if ((__u32) LiLbo != -1) {
- *Lbo = (((__s64) LiLbo) << (__s64) osb->sb->s_blocksize_bits);
- if (ret) {
- *Lbo += remainder;
- }
- } else {
- ret = 0;
- *Lbo = 0;
- }
-
- *SectorCount = LiSectorCount;
- if (*SectorCount) {
- *SectorCount <<= (__s64) osb->sb->s_blocksize_bits;
- if (*SectorCount == 0) {
- *SectorCount = (__u32) - 1;
- }
-
- if (ret) {
- *SectorCount -= remainder;
- }
- }
-
-
- LOG_EXIT_INT (ret);
- return ret;
-} /* ocfs_lookup_extent_map_entry */
-
-
-/* ocfs_update_extent_map()
- *
- */
-int ocfs_update_extent_map(ocfs_super *osb, ocfs_extent_map *Map,
- void *Buffer, __s64 *localVbo,
- __u64 *remainingLength, ocfs_ext_flag Flag)
-{
- int ret = -EINVAL;
- ocfs2_dinode *fe;
- ocfs2_extent_block *eb;
- ocfs2_extent_list *el;
- __s64 tempVbo;
- __u64 tempSize;
- int j;
-
- LOG_ENTRY ();
-
- if (Flag == LOCAL_EXT) {
- fe = Buffer;
- el = &fe->id2.i_list;
-
- OCFS_ASSERT(!el->l_tree_depth);
-
- for (j = 0; j < el->l_next_free_rec; j++) {
- /* Add the Extent to extent map list */
- ret = ocfs_add_extent_map_entry_from_rec(osb->sb,
- Map,
- &el->l_recs[j]);
- if (!ret) {
- LOG_ERROR_STATUS (ret = -ENOMEM);
- goto bail;
- }
- }
- ret = 0;
- } else {
- __u64 localLength = 0;
-
- eb = Buffer;
- el = &eb->h_list;
-
- for (j = 0; j < el->l_next_free_rec; j++) {
- if ((__s64)((u64)(el->l_recs[j].e_cpos + el->l_recs[j].e_clusters) << osb->s_clustersize_bits) > (*localVbo)) {
- tempVbo = (u64)el->l_recs[j].e_cpos << osb->s_clustersize_bits;
- tempSize = (u64)el->l_recs[j].e_clusters << osb->s_clustersize_bits;
-
- /* Add the Extent to extent map list */
- ret = ocfs_add_extent_map_entry_from_rec(osb->sb,
- Map,
- &el->l_recs[j]);
- if (!ret) {
- LOG_ERROR_STATUS (ret = -ENOMEM);
- goto bail;
- }
-
- localLength =
- (tempSize - ((*localVbo) - tempVbo));
-
- /* Since we have read the disk we should add some */
- /* more Entries to the extent map list */
- if (localLength >= (*remainingLength)) {
- (*remainingLength) = 0;
- ret = 0;
- goto bail;
- } else {
- (*remainingLength) -= localLength;
- (*localVbo) += localLength;
- }
- }
- }
-
- if ((el->l_next_free_rec != el->l_count) &&
- (*remainingLength)) {
- LOG_ERROR_ARGS ("l_next_free_rec=%d, rem_len=%llu",
- el->l_next_free_rec, *remainingLength);
- } else
- ret = 0;
- }
-
-bail:
- LOG_EXIT_STATUS (ret);
- return ret;
-} /* ocfs_update_extent_map */
-
-
-/*
- * ocfs_add_extent_map_entry_from_rec()
- *
- * Add and entry using the fields of an ocfs2_extent_rec.
- *
- * FIXME This should be coalesced with ocfs_add_extent_map_entry
- * once all callers use this function.
- */
-int ocfs_add_extent_map_entry_from_rec(struct super_block *sb,
- ocfs_extent_map *extmap,
- ocfs2_extent_rec *rec)
-{
- u64 vbo = (u64)rec->e_cpos << OCFS_SB(sb)->s_clustersize_bits;
- u64 lbo = rec->e_blkno << sb->s_blocksize_bits;
- u64 bytes =
- (u64)rec->e_clusters << OCFS_SB(sb)->s_clustersize_bits;
- return ocfs_add_extent_map_entry(OCFS_SB(sb), extmap,
- vbo, lbo, bytes);
-}
-
-
-/*
- * ocfs_add_extent_map_entry()
- *
- * adds an entry to an extent map
- *
- * Returns true on success, false otherwise.
- */
-int ocfs_add_extent_map_entry (ocfs_super * osb, ocfs_extent_map * Map, __s64 Vbo, __s64 Lbo, __u64 ByteCount)
-{
- /* FIXME take ocfs2_extent_rec */
- int ret;
-
- LOG_ENTRY ();
-
- /* Convert the Bytes in to number of Sectors */
- if (ByteCount) {
- /* Round up sectors */
- ByteCount--;
- ByteCount >>= osb->sb->s_blocksize_bits;
- ByteCount++;
- }
-
- /* Make the ByteOffsets in to Sector numbers. */
- Vbo >>= osb->sb->s_blocksize_bits;
- Lbo >>= osb->sb->s_blocksize_bits;
-
- ret = ocfs_extent_map_add (Map, ((__s64) Vbo), ((__s64) Lbo), ((__s64) ByteCount));
- if (!ret)
- LOG_ERROR_ARGS ("fileoff=%llu, diskoff=%llu, len=%llu",
- Vbo, Lbo, ByteCount);
-
-
- LOG_EXIT_INT (ret);
- return ret;
-} /* ocfs_add_extent_map_entry */
Deleted: trunk/src/extmap.h
===================================================================
--- trunk/src/extmap.h 2004-10-21 23:20:17 UTC (rev 1584)
+++ trunk/src/extmap.h 2004-10-22 03:57:49 UTC (rev 1585)
@@ -1,49 +0,0 @@
-/* -*- mode: c; c-basic-offset: 8; -*-
- * vim: noexpandtab sw=8 ts=8 sts=0:
- *
- * extmap.h
- *
- * Function prototypes
- *
- * Copyright (C) 2002, 2004 Oracle. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this program; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 021110-1307, USA.
- */
-
-#ifndef OCFS2_EXTMAP_H
-#define OCFS2_EXTMAP_H
-
-int ocfs_add_extent_map_entry_from_rec(struct super_block *sb,
- ocfs_extent_map *extmap,
- ocfs2_extent_rec *rec);
-int ocfs_add_extent_map_entry(ocfs_super *osb, ocfs_extent_map *Map,
- __s64 Vbo, __s64 Lbo, __u64 ByteCount);
-void ocfs_extent_map_init(ocfs_extent_map *map);
-void ocfs_extent_map_trunc(ocfs_extent_map *map);
-
-unsigned int ocfs_extent_map_get_count(ocfs_extent_map *map);
-int ocfs_get_next_extent_map_entry(ocfs_super *osb,
- ocfs_extent_map *Map, __u32 RunIndex,
- __s64 *Vbo, __s64 *Lbo,
- __u32 *SectorCount);
-int ocfs_lookup_extent_map_entry(ocfs_super *osb, ocfs_extent_map *Map,
- __s64 Vbo, __s64 *Lbo,
- __u64 *SectorCount, __u32 *Index);
-int ocfs_update_extent_map(ocfs_super *osb, ocfs_extent_map *Map,
- void *Buffer, __s64 *localVbo,
- __u64 *remainingLength, ocfs_ext_flag Flag);
-
-#endif /* OCFS2_EXTMAP_H */
Modified: trunk/src/file.c
===================================================================
--- trunk/src/file.c 2004-10-21 23:20:17 UTC (rev 1584)
+++ trunk/src/file.c 2004-10-22 03:57:49 UTC (rev 1585)
@@ -39,7 +39,6 @@
#include "alloc.h"
#include "dir.h"
#include "dlm.h"
-#include "extmap.h"
#include "extent_map.h"
#include "file.h"
#include "sysfile.h"
@@ -267,109 +266,6 @@
return 0;
}
-/*
- * ocfs_inode_fill_ext_map()
- *
- */
-int ocfs_inode_fill_ext_map(ocfs_super *osb, struct buffer_head *fe_bh,
- struct inode *inode)
-{
- int ret = 0;
- int j;
- __u64 tempoff;
- ocfs2_extent_block *eb = NULL;
- ocfs2_extent_list *el;
- struct buffer_head *eb_bh = NULL;
- ocfs2_dinode *fe = NULL;
-
- LOG_ENTRY ();
-
-#ifdef PURE_EVIL
- if (evil_filename_check(EVIL_INODE, inode)) {
- LOG_ERROR_STR("EVIL FILL_EXTMAP");
- }
-#endif
-
- fe = (ocfs2_dinode *) fe_bh->b_data;
- tempoff = fe->i_blkno << osb->sb->s_blocksize_bits;
-
- el = &fe->id2.i_list;
- if (!el->l_tree_depth) {
- for (j = 0; j < el->l_next_free_rec; j++) {
- /* Add the Extent to extent map */
- ret = ocfs_add_extent_map_entry_from_rec(osb->sb,
- &OCFS_I(inode)->ip_ext_map,
- &el->l_recs[j]);
- if (!ret) {
- LOG_ERROR_STATUS (ret = -ENOMEM);
- goto leave;
- }
- }
- } else {
- u64 next_leaf;
-
- /* Extents are branched and we are no longer using */
- /* Local Extents for this File Entry. */
-
- ret = ocfs_get_leaf_extent (osb, fe, 0, &eb_bh, inode);
- if (ret < 0) {
- LOG_ERROR_STATUS (ret);
- goto leave;
- }
-
- while (1) {
- eb = (ocfs2_extent_block *) eb_bh->b_data;
- el = &eb->h_list;
-
- if (!IS_VALID_EXTENT_BLOCK(eb) ||
- el->l_tree_depth) {
- LOG_ERROR_STATUS(ret = -EINVAL);
- goto leave;
- }
-
- for (j = 0; j < el->l_next_free_rec; j++) {
- /* Add the Extent to extent map */
- ret = ocfs_add_extent_map_entry_from_rec(osb->sb,
- &OCFS_I(inode)->ip_ext_map,
- &el->l_recs[j]);
- if (!ret) {
- LOG_ERROR_STATUS (ret =
- -ENOMEM);
- goto leave;
- }
- }
-
- if (eb->h_next_leaf_blk > 0) {
- if (!eb->h_next_leaf_blk) {
- LOG_ERROR_STATUS (ret = -EINVAL);
- goto leave;
- }
- next_leaf = eb->h_next_leaf_blk;
- eb = NULL;
- eb_bh = NULL;
-
- ret = ocfs_read_block(osb,
- next_leaf,
- &eb_bh,
- OCFS_BH_CACHED, inode);
- if (ret < 0) {
- LOG_ERROR_STATUS(ret);
- goto leave;
- }
- } else
- break;
- }
- }
-
-leave:
- if (eb_bh) {
- brelse(eb_bh);
- }
-
- LOG_EXIT_STATUS (ret);
- return ret;
-} /* ocfs_inode_fill_ext_map */
-
/*
* ocfs_sync_file()
*
@@ -843,12 +739,8 @@
spin_lock(&oip->ip_lock);
if (!grow)
oip->ip_mmu_private = inode->i_size;
- /* do we really need to do an extent_map_trunc here? */
- ocfs_extent_map_trunc(&oip->ip_ext_map);
spin_unlock(&oip->ip_lock);
- ocfs2_extent_map_drop(inode,
- ocfs2_clusters_for_bytes(sb, new_i_size));
bail:
LOG_EXIT_STATUS(status);
return status;
Modified: trunk/src/file.h
===================================================================
--- trunk/src/file.h 2004-10-21 23:20:17 UTC (rev 1584)
+++ trunk/src/file.h 2004-10-22 03:57:49 UTC (rev 1585)
@@ -45,8 +45,6 @@
int ocfs_extend_file(ocfs_super *osb,
struct inode *inode,
u64 new_i_size);
-int ocfs_inode_fill_ext_map(ocfs_super *osb, struct buffer_head *fe_bh,
- struct inode *inode);
int ocfs_setattr(struct dentry *dentry, struct iattr *attr);
int ocfs_sync_inode(struct inode *inode);
Modified: trunk/src/inode.c
===================================================================
--- trunk/src/inode.c 2004-10-21 23:20:17 UTC (rev 1584)
+++ trunk/src/inode.c 2004-10-22 03:57:49 UTC (rev 1585)
@@ -40,7 +40,6 @@
#include "alloc.h"
#include "dlm.h"
-#include "extmap.h"
#include "extent_map.h"
#include "file.h"
#include "inode.h"
@@ -311,7 +310,6 @@
init_rwsem(&(i->ip_node_extend_sem));
i->ip_open_cnt = 0;
spin_lock_init(&i->ip_lock);
- ocfs_extent_map_init (&i->ip_ext_map);
ocfs2_extent_map_init(inode);
INIT_LIST_HEAD(&i->ip_recovery_list);
INIT_LIST_HEAD(&i->ip_handle_list);
@@ -820,7 +818,6 @@
goto bail;
}
- ocfs_extent_map_trunc(&OCFS_I(inode)->ip_ext_map);
ocfs2_extent_map_drop(inode, 0);
down(&recovery_list_sem);
@@ -855,43 +852,30 @@
{
struct buffer_head * bh = NULL;
int tmperr;
- ocfs_super *osb;
- __s64 vbo, lbo;
u64 p_blkno;
int readflags = OCFS_BH_CACHED;
- osb = OCFS_SB(inode->i_sb);
- vbo = (__s64) block << inode->i_sb->s_blocksize_bits;
-
#warning only turn this on if we know we can deal with read_block returning nothing
#if 0
if (reada)
readflags |= OCFS_BH_READAHEAD;
#endif
- OCFS_ASSERT((vbo < inode->i_size) || reada);
- if (vbo >= inode->i_size)
- return(NULL);
+ if (((u64)block << inode->i_sb->s_blocksize_bits) >=
+ inode->i_size) {
+ OCFS_ASSERT(reada);
+ return NULL;
+ }
- /* do we need extend sem? no extend dlm message for dirs */
- tmperr = ocfs_lookup_file_allocation(osb, vbo, &lbo,
- osb->sb->s_blocksize, NULL,
- inode);
- if (tmperr < 0)
- goto fail;
-
tmperr = ocfs2_extent_map_get_blocks(inode, block, 1,
&p_blkno, NULL);
- if (tmperr < 0)
+ if (tmperr < 0) {
+ LOG_ERROR_STATUS(tmperr);
goto fail;
-
- if (p_blkno != (lbo >> osb->sb->s_blocksize_bits)) {
- LOG_ERROR_ARGS("get_blocks() expected %llu, got %lld\n",
- p_blkno, lbo >> osb->sb->s_blocksize_bits);
}
- tmperr = ocfs_read_block(osb, lbo >> osb->sb->s_blocksize_bits,
- &bh, readflags, inode);
+ tmperr = ocfs_read_block(OCFS_SB(inode->i_sb), p_blkno, &bh,
+ readflags, inode);
if (tmperr < 0)
goto fail;
@@ -1095,7 +1079,6 @@
OCFS_I(inode)->ip_blkno,
OCFS_I(inode)->ip_alloc_size,
fe->i_clusters);
- ocfs_extent_map_trunc (&OCFS_I(inode)->ip_ext_map);
drop_map = 1; /* Because we have the lock here */
}
@@ -1144,14 +1127,8 @@
spin_unlock(&OCFS_I(inode)->ip_lock);
- if (drop_map) {
- /*
- * If we could trust the ordering of truncate
- * notification, we could some day do:
- * ocfs2_extent_map_trunc(inode, fe->i_clusters)
- */
+ if (drop_map)
ocfs2_extent_map_trunc(inode, fe->i_clusters);
- }
return(status);
} /* ocfs_refresh_inode */
Modified: trunk/src/journal.c
===================================================================
--- trunk/src/journal.c 2004-10-21 23:20:17 UTC (rev 1584)
+++ trunk/src/journal.c 2004-10-22 03:57:49 UTC (rev 1585)
@@ -36,7 +36,7 @@
#include "alloc.h"
#include "dlm.h"
-#include "extmap.h"
+#include "extent_map.h"
#include "inode.h"
#include "journal.h"
#include "localalloc.h"
@@ -56,8 +56,7 @@
spinlock_t trans_inc_lock = SPIN_LOCK_UNLOCKED;
static int ocfs_reset_publish (ocfs_super * osb, __u64 node_num);
-static int ocfs_force_read_journal(ocfs_super *osb, __u64 size,
- struct inode *inode);
+static int ocfs_force_read_journal(struct inode *inode);
static int ocfs_recover_node(struct _ocfs_super *osb, int node_num);
static int __ocfs_recovery_thread(void *arg);
static int ocfs_commit_cache (ocfs_super * osb);
@@ -1063,84 +1062,57 @@
*
* size should be file_size, NOT alloc_size
*/
-static int ocfs_force_read_journal(ocfs_super *osb, __u64 size,
- struct inode *inode)
+#warning ocfs_force_read_journal() needs retesting!
+static int ocfs_force_read_journal(struct inode *inode)
{
int status = 0;
- int i, run;
- __u32 totalblks, alloc_size, numblks, numbytes, numruns;
- __s64 vbo = 0;
- __s64 lbo = 0;
- ocfs_extent_map *map = NULL;
- struct buffer_head **bhs = NULL;
+ int i, p_blocks;
+ u64 v_blkno, p_blkno;
+#define CONCURRENT_JOURNAL_FILL 32
+ struct buffer_head *bhs[CONCURRENT_JOURNAL_FILL];
LOG_ENTRY();
- totalblks = size >> osb->sb->s_blocksize_bits;
- /* Ok, allocate the maximum number of blocks we'll possibly
- * need. This is heavy, but it doesn't happen often. If need
- * be, we can change things to allocate a little memory at a
- * time. ocfs_journal_init should insure that our journals are
- * always *exactly* eight megs large, so running out of memory
- * should not be an issue here. */
- alloc_size = sizeof(struct buffer_head *) * totalblks;
- bhs = ocfs_malloc(alloc_size);
- if (bhs == NULL) {
- LOG_ERROR_STATUS(-ENOMEM);
- goto bail;
- }
- memset(bhs, 0, alloc_size);
+ OCFS_ASSERT(inode->i_blocks ==
+ (inode->i_size >> inode->i_sb->s_blocksize_bits));
- LOG_TRACE_ARGS("Force reading %u blocks\n", totalblks);
+ memset(bhs, 0, sizeof(struct buffer_head *) * CONCURRENT_JOURNAL_FILL);
- status = ocfs_lookup_file_allocation(osb, vbo, &lbo, size, NULL,
- inode);
- if (status < 0) {
- LOG_ERROR_STATUS(status);
- goto bail;
- }
+ LOG_TRACE_ARGS("Force reading %lu blocks\n", inode->i_blocks);
- map = &(OCFS_I(inode)->ip_ext_map);
- numruns = ocfs_extent_map_get_count(map);
-
- LOG_TRACE_ARGS("%d runs in this file\n", numruns);
-
- for(run = 0; run < numruns; run++) {
- vbo = lbo = numbytes = 0;
- if (!ocfs_get_next_extent_map_entry(osb, map, run, &vbo, &lbo,
- &numbytes)) {
- LOG_ERROR_STR("Failure in "
- "ocfs_get_next_extent_map_entry");
- status = -EINVAL;
+ v_blkno = 0;
+ while (v_blkno < inode->i_blocks) {
+ status = ocfs2_extent_map_get_blocks(inode, v_blkno,
+ 1, &p_blkno,
+ &p_blocks);
+ if (status < 0) {
+ LOG_ERROR_STATUS(status);
goto bail;
}
- LOG_TRACE_ARGS("(Run %d), lbo = %lld bytes, numbytes = %u "
- "bytes\n", run, lbo, numbytes);
- /* there are actually returned in bytes. need blocks. */
- numblks = numbytes >> osb->sb->s_blocksize_bits;
+ if (p_blocks > CONCURRENT_JOURNAL_FILL)
+ p_blocks = CONCURRENT_JOURNAL_FILL;
- status = ocfs_read_blocks(osb,
- lbo >> osb->sb->s_blocksize_bits,
- numblks, bhs, 0, inode);
+ status = ocfs_read_blocks(OCFS_SB(inode->i_sb),
+ p_blkno, p_blocks, bhs, 0,
+ inode);
if (status < 0) {
LOG_ERROR_STATUS(status);
goto bail;
}
- for(i = 0; i < numblks; i++) {
+ for(i = 0; i < p_blocks; i++) {
brelse(bhs[i]);
bhs[i] = NULL;
}
+
+ v_blkno += p_blocks;
}
bail:
- if (bhs) {
- for(i = 0; i < totalblks; i++)
- if (bhs[i])
- brelse(bhs[i]);
- kfree(bhs);
- }
+ for(i = 0; i < CONCURRENT_JOURNAL_FILL; i++)
+ if (bhs[i])
+ brelse(bhs[i]);
LOG_EXIT_STATUS(status);
return(status);
}
@@ -1306,7 +1278,7 @@
OCFS_I(inode)->ip_alloc_size = alloc_size;
- status = ocfs_force_read_journal(osb, inode->i_size, inode);
+ status = ocfs_force_read_journal(inode);
if (status < 0) {
LOG_ERROR_STATUS(status);
goto done;
Modified: trunk/src/namei.c
===================================================================
--- trunk/src/namei.c 2004-10-21 23:20:17 UTC (rev 1584)
+++ trunk/src/namei.c 2004-10-22 03:57:49 UTC (rev 1585)
@@ -299,6 +299,8 @@
}
if (S_ISDIR(mode) && (dir->i_nlink >= OCFS2_LINK_MAX)) {
+ printk("inode %llu has i_nlink of %u\n",
+ OCFS_I(dir)->ip_blkno, dir->i_nlink);
status = -EMLINK;
goto leave;
}
@@ -875,10 +877,13 @@
goto leave;
}
- if (S_ISDIR (inode->i_mode))
+ if (S_ISDIR (inode->i_mode)) {
fe->i_links_count = 0;
- else
+ inode->i_nlink = 0;
+ } else {
fe->i_links_count--;
+ inode->i_nlink--;
+ }
status = ocfs_journal_dirty(handle, fe_bh);
if (status < 0) {
@@ -887,32 +892,18 @@
}
if (S_ISDIR (inode->i_mode)) {
- ocfs2_dinode *dirfe;
- status = ocfs_journal_access(handle, dir, parent_node_bh,
- OCFS_JOURNAL_ACCESS_WRITE);
+ dir->i_nlink--;
+ status = ocfs_mark_inode_dirty(handle, dir,
+ parent_node_bh);
if (status < 0) {
LOG_ERROR_STATUS(status);
- goto leave;
+ dir->i_nlink++;
}
- dirfe = (ocfs2_dinode *) parent_node_bh->b_data;
- dirfe->i_links_count--;
- status = ocfs_journal_dirty(handle, parent_node_bh);
- if (status < 0) {
- LOG_ERROR_STATUS(status);
- goto leave;
- }
}
leave:
- if (handle) {
+ if (handle)
ocfs_commit_trans(handle);
- // already checked to make sure dir has nlink==2
- if (S_ISDIR (inode->i_mode)) {
- inode->i_nlink = 0;
- dir->i_nlink--;
- } else
- inode->i_nlink--;
- }
if (status < 0 && status != -ENOTEMPTY &&
status != -EPERM && status != -EBUSY && status != -EINTR) {
@@ -1415,7 +1406,6 @@
struct buffer_head **bhs = NULL;
const char *c;
struct super_block *sb = osb->sb;
- s64 logical, contig;
u64 p_blkno;
int p_blocks;
int virtual, blocks, status, i, bytes_left;
@@ -1443,49 +1433,28 @@
}
memset(bhs, 0, sizeof(struct buffer_head *) * blocks);
- status = ocfs_lookup_file_allocation(osb, 0, &logical, sb->s_blocksize, &contig,
- inode);
+
+ status = ocfs2_extent_map_get_blocks(inode, 0, 1, &p_blkno,
+ &p_blocks);
if (status < 0) {
LOG_ERROR_STATUS(status);
goto bail;
}
- LOG_TRACE_ARGS("logical = %lld, contig = %lld\n", logical, contig);
-
/* links can never be larger than one cluster so we know this
* is all going to be contiguous, but do a sanity check
* anyway. */
- if (contig < bytes_left) {
+ if ((p_blocks << sb->s_blocksize_bits) < bytes_left) {
status = -EIO;
LOG_ERROR_STATUS(status);
goto bail;
}
- /* right now lookup_file_allocation returns bytes, but that
- * changes soon so shift back to blocks. */
- logical = logical >> sb->s_blocksize_bits;
-
- status = ocfs2_extent_map_get_blocks(inode, 0, 1, &p_blkno,
- &p_blocks);
- if (status < 0) {
- LOG_ERROR_STATUS(status);
- goto bail;
- }
-
- if (logical != p_blkno) {
- LOG_ERROR_ARGS("Bad get_blocks(): expected %llu, got %llu\n",
- p_blkno, logical);
- }
- if (p_blocks != (contig >> sb->s_blocksize_bits)) {
- LOG_ERROR_ARGS("Bad get_blocks() length: expected %u, got %lld\n",
- p_blocks, (contig >> sb->s_blocksize_bits));
- }
-
virtual = 0;
while(bytes_left > 0) {
c = &symname[virtual * sb->s_blocksize];
- bhs[virtual] = sb_getblk(sb, logical);
+ bhs[virtual] = sb_getblk(sb, p_blkno);
if (!bhs[virtual]) {
status = -ENOMEM;
LOG_ERROR_STATUS(status);
@@ -1514,7 +1483,7 @@
}
virtual++;
- logical++;
+ p_blkno++;
bytes_left -= sb->s_blocksize;
}
@@ -1677,12 +1646,6 @@
goto bail;
}
- status = ocfs_inode_fill_ext_map(osb, new_fe_bh, inode);
- if (status < 0) {
- LOG_ERROR_STATUS(status);
- goto bail;
- }
-
status = ocfs_create_symlink_data(osb, handle, inode, symname);
if (status < 0) {
LOG_ERROR_STATUS (status);
Modified: trunk/src/nm.c
===================================================================
--- trunk/src/nm.c 2004-10-21 23:20:17 UTC (rev 1584)
+++ trunk/src/nm.c 2004-10-22 03:57:49 UTC (rev 1585)
@@ -38,7 +38,6 @@
#include "alloc.h"
#include "dlm.h"
-#include "extmap.h"
#include "extent_map.h"
#include "file.h"
#include "heartbeat.h"
@@ -309,7 +308,7 @@
* released until he does his last
* release broadcast. This has the
* effect of locking out
- * lookup_file_allocation on this
+ * ocfs2_extent_map lookups
* inode. */
down_write(&OCFS_I(inode)->ip_node_extend_sem);
@@ -442,9 +441,6 @@
d_prune_aliases (inode);
sync_mapping_buffers(inode->i_mapping);
ocfs_truncate_inode_pages(inode, 0);
- spin_lock(&OCFS_I(inode)->ip_lock);
- ocfs_extent_map_trunc(&OCFS_I(inode)->ip_ext_map);
- spin_unlock(&OCFS_I(inode)->ip_lock);
ocfs2_extent_map_drop(inode, 0);
}
@@ -696,7 +692,6 @@
}
ocfs_truncate_inode_pages(inode, 0);
spin_lock(&OCFS_I(inode)->ip_lock);
- ocfs_extent_map_trunc(&OCFS_I(inode)->ip_ext_map);
/* truncate may send this */
if (flags & FLAG_FILE_UPDATE_OIN)
Modified: trunk/src/ocfs.h
===================================================================
--- trunk/src/ocfs.h 2004-10-21 23:20:17 UTC (rev 1584)
+++ trunk/src/ocfs.h 2004-10-22 03:57:49 UTC (rev 1585)
@@ -323,26 +323,7 @@
}
BARF_BARF_BARF;
-typedef struct _ocfs_extent
-{
- struct list_head list;
- __s64 virtual;
- __s64 physical;
- __s64 sectors;
-}
-ocfs_extent;
-typedef struct _ocfs_extent_map
-{
- __u32 count;
- int initialized;
- struct list_head head;
- struct list_head *next_ptr;
-}
-ocfs_extent_map;
-
-
-
typedef struct _ocfs_super ocfs_super;
typedef struct _ocfs_lock_res ocfs_lock_res;
@@ -392,7 +373,6 @@
__s64 ip_alloc_size;
__s64 ip_mmu_private;
__u32 ip_open_flags;
- ocfs_extent_map ip_ext_map;
struct ocfs2_extent_map ip_map;
atomic_t ip_needs_verification;
@@ -646,7 +626,6 @@
struct semaphore global_res;
struct list_head osb_next; /* List of all volumes */
kmem_cache_t *inode_cache;
- kmem_cache_t *extent_cache;
kmem_cache_t *lock_cache;
__u32 flags;
__s16 pref_node_num; /* preferred... osb has the real one */
Modified: trunk/src/super.c
===================================================================
--- trunk/src/super.c 2004-10-21 23:20:17 UTC (rev 1584)
+++ trunk/src/super.c 2004-10-22 03:57:49 UTC (rev 1585)
@@ -817,10 +817,6 @@
sizeof(ocfs_inode_private), 0, SLAB_NO_REAP | SLAB_HWCACHE_ALIGN,
NULL, NULL);
- OcfsGlobalCtxt.extent_cache = kmem_cache_create ("ocfs2_extent",
- sizeof(ocfs_extent) + sizeof(void*), 0, SLAB_NO_REAP | SLAB_HWCACHE_ALIGN,
- NULL, NULL);
-
OcfsGlobalCtxt.lock_cache = kmem_cache_create ("ocfs2_lock",
sizeof(ocfs_journal_lock), 0, SLAB_NO_REAP | SLAB_HWCACHE_ALIGN,
NULL, NULL);
@@ -837,7 +833,6 @@
static void ocfs_free_mem_lists (void)
{
kmem_cache_destroy (OcfsGlobalCtxt.inode_cache);
- kmem_cache_destroy (OcfsGlobalCtxt.extent_cache);
kmem_cache_destroy (OcfsGlobalCtxt.lock_cache);
OCFS_CLEAR_FLAG (OcfsGlobalCtxt.flags, OCFS_FLAG_MEM_LISTS_INITIALIZED);
} /* ocfs_free_mem_lists */
@@ -1339,7 +1334,6 @@
{
int status = 0;
ocfs_publish *publish = NULL;
- __u64 ret;
u64 p_blkno;
struct buffer_head *publish_bh = NULL; /* our own publish sector */
struct buffer_head **publish_bhs = NULL; /* all the publish sectors */
@@ -1555,12 +1549,6 @@
LOG_ERROR_STATUS(status = -EINVAL);
goto bail;
}
- status = ocfs_lookup_file_allocation(osb, 0ULL, &ret, osb->sb->s_blocksize, NULL,
- inode);
- if (status < 0) {
- LOG_ERROR_STATUS(status);
- goto bail;
- }
status = ocfs2_extent_map_get_blocks(inode, 0ULL, 1, &p_blkno,
NULL);
@@ -1569,12 +1557,6 @@
goto bail;
}
- if (p_blkno != (ret >> osb->sb->s_blocksize_bits)) {
- LOG_ERROR_ARGS("get_blocks() returned %llu, expected %lld\n",
- p_blkno,
- ret >> osb->sb->s_blocksize_bits);
- }
-
// i_size must be at least
// (2 + osb->max_nodes + 4) + osb->max_nodes + osb->max_nodes
if (inode->i_size >> osb->sb->s_blocksize_bits <
@@ -1593,7 +1575,7 @@
goto bail;
}
- osb->autoconfig_blkno = ret >> osb->sb->s_blocksize_bits;
+ osb->autoconfig_blkno = p_blkno;
osb->autoconfig_blocks = OCFS_VOLCFG_HDR_SECTORS + osb->max_nodes;
osb->new_autoconfig_blkno = osb->autoconfig_blkno + osb->autoconfig_blocks;
@@ -1635,13 +1617,6 @@
goto bail;
}
- status = ocfs_lookup_file_allocation(osb, 0ULL, &ret, osb->sb->s_blocksize, NULL,
- inode);
- if (status < 0) {
- LOG_ERROR_STATUS(status);
- goto bail;
- }
-
status = ocfs2_extent_map_get_blocks(inode, 0ULL, 1, &p_blkno,
NULL);
if (status < 0) {
@@ -1649,14 +1624,8 @@
goto bail;
}
- if (p_blkno != (ret >> osb->sb->s_blocksize_bits)) {
- LOG_ERROR_ARGS("get_blocks() returned %llu, expected %lld\n",
- p_blkno,
- ret >> osb->sb->s_blocksize_bits);
- }
-
/* for now, just one extent... but in the future... */
- osb->bitmap_blkno = ret >> osb->sb->s_blocksize_bits;
+ osb->bitmap_blkno = p_blkno;
osb->bitmap_blocks = OCFS_I(inode)->ip_alloc_size >> osb->sb->s_blocksize_bits;
osb->num_clusters = OCFS_I(inode)->u.ip_bitinfo.total_bits;
printk("bitmap_blkno=%llu, bitmap_blocks=%u, num_clusters=%u\n",
More information about the Ocfs2-commits
mailing list