[Ocfs2-commits]
jlbec commits r1086 - in branches/s_blocksize/src: . inc
svn-commits at oss.oracle.com
svn-commits at oss.oracle.com
Sun Jun 13 22:14:44 CDT 2004
Author: jlbec
Date: 2004-06-13 21:14:41 -0500 (Sun, 13 Jun 2004)
New Revision: 1086
Modified:
branches/s_blocksize/src/alloc.c
branches/s_blocksize/src/bitmap.c
branches/s_blocksize/src/inc/journal.h
branches/s_blocksize/src/inc/ocfs.h
branches/s_blocksize/src/inc/proto.h
branches/s_blocksize/src/inode.c
branches/s_blocksize/src/journal.c
branches/s_blocksize/src/osb.c
branches/s_blocksize/src/super.c
branches/s_blocksize/src/sysfile.c
Log:
because
Modified: branches/s_blocksize/src/alloc.c
===================================================================
--- branches/s_blocksize/src/alloc.c 2004-06-14 01:52:45 UTC (rev 1085)
+++ branches/s_blocksize/src/alloc.c 2004-06-14 02:14:41 UTC (rev 1086)
@@ -331,9 +331,9 @@
/* Get all the locks we need. do global bitmap last to
* preserve lock ordering with extend/create */
- lock_id = (OCFS_FILE_DIR_ALLOC_BITMAP * osb->sect_size) +
+ lock_id = (OCFS_FILE_DIR_ALLOC_BITMAP * osb->sb->s_blocksize) +
osb->vol_layout.root_int_off;
- for (i = 0; i < OCFS_MAXIMUM_NODES; i++, lock_id += osb->sect_size) {
+ for (i = 0; i < OCFS_MAXIMUM_NODES; i++, lock_id += osb->sb->s_blocksize) {
if (free_dir_node[i] != NULL) {
dirnode_inode[i] = ocfs_iget(osb, lock_id, NULL);
if (!dirnode_inode[i]) {
@@ -363,9 +363,9 @@
}
}
- lock_id = (OCFS_FILE_FILE_ALLOC_BITMAP * osb->sect_size) +
+ lock_id = (OCFS_FILE_FILE_ALLOC_BITMAP * osb->sb->s_blocksize) +
osb->vol_layout.root_int_off;
- for (i = 0; i < OCFS_MAXIMUM_NODES; i++, lock_id += osb->sect_size) {
+ for (i = 0; i < OCFS_MAXIMUM_NODES; i++, lock_id += osb->sb->s_blocksize) {
if (free_ext_node[i] != NULL) {
extnode_inode[i] = ocfs_iget(osb, lock_id, NULL);
if (!extnode_inode[i]) {
@@ -480,9 +480,9 @@
}
}
- lock_id = (OCFS_FILE_DIR_ALLOC_BITMAP * osb->sect_size) +
+ lock_id = (OCFS_FILE_DIR_ALLOC_BITMAP * osb->sb->s_blocksize) +
osb->vol_layout.root_int_off;
- for (i = 0; i < OCFS_MAXIMUM_NODES; i++, lock_id += osb->sect_size) {
+ for (i = 0; i < OCFS_MAXIMUM_NODES; i++, lock_id += osb->sb->s_blocksize) {
if (free_dir_node[i] != NULL) {
status = ocfs_release_lock (osb, lock_id,
OCFS_DLM_EXCLUSIVE_LOCK,
@@ -495,9 +495,9 @@
}
}
- lock_id = (OCFS_FILE_FILE_ALLOC_BITMAP * osb->sect_size) +
+ lock_id = (OCFS_FILE_FILE_ALLOC_BITMAP * osb->sb->s_blocksize) +
osb->vol_layout.root_int_off;
- for (i = 0; i < OCFS_MAXIMUM_NODES; i++, lock_id += osb->sect_size) {
+ for (i = 0; i < OCFS_MAXIMUM_NODES; i++, lock_id += osb->sb->s_blocksize) {
if (free_ext_node[i] != NULL) {
status = ocfs_release_lock (osb, lock_id,
OCFS_DLM_EXCLUSIVE_LOCK,
@@ -560,10 +560,10 @@
bitmap = &osb->cluster_bitmap;
- bitmapblocks = (OCFS_ALIGN(bitmap->validbits, OCFS_BITS_IN_CHUNK) / OCFS_BITS_IN_CHUNK);
+ bitmapblocks = ocfs_blocks_for_bits(osb->sb, bitmap->validbits);
status = ocfs_read_bhs(osb, osb->vol_layout.bitmap_off,
- bitmapblocks * osb->sect_size,
+ bitmapblocks * osb->sb->s_blocksize,
bitmap->chunk, 0, NULL);
if (status < 0) {
LOG_ERROR_STATUS(status);
@@ -571,7 +571,9 @@
}
for (i = 0; i < freelog->num_updates; i++)
- ocfs_clear_bits(handle, bitmap, freelog->update[i].file_off, freelog->update[i].length);
+ ocfs_clear_bits(osb->sb, handle, bitmap,
+ freelog->update[i].file_off,
+ freelog->update[i].length);
status = 0;
bail:
@@ -648,13 +650,15 @@
goto leave;
}
- ocfs_initialize_bitmap(&AllocBitmap, fileSize * 8, allocSize * 8);
+ ocfs_initialize_bitmap(osb, &AllocBitmap,
+ fileSize * 8, allocSize * 8);
tmpbitmap = &AllocBitmap;
needs_uninit = 1;
- bitmapblocks = (OCFS_ALIGN(tmpbitmap->validbits, OCFS_BITS_IN_CHUNK) / OCFS_BITS_IN_CHUNK);
+ bitmapblocks = ocfs_blocks_for_bits(osb->sb,
+ tmpbitmap->validbits);
status = ocfs_read_system_file(osb, fileId, AllocBitmap.chunk,
- bitmapblocks * osb->sect_size,
+ bitmapblocks * osb->sb->s_blocksize,
offset);
if (status < 0) {
LOG_ERROR_STATUS (status);
@@ -682,8 +686,9 @@
foundBit = (__u32)
(FreeLog->update[i].file_off >>
blockSizeBits);
- ocfs_clear_bits(handle, tmpbitmap, (__u32) foundBit,
- (__u32) FreeLog->update[i].length);
+ ocfs_clear_bits(osb->sb, handle, tmpbitmap,
+ (__u32) foundBit,
+ (__u32) FreeLog->update[i].length);
}
}
@@ -700,32 +705,32 @@
/* ocfs_allocate_new_data_node()
*
*/
-static int ocfs_allocate_new_data_node (ocfs_super * osb,
- ocfs_file_entry * FileEntry,
- __u64 actualDiskOffset, __u64 actualLength,
- struct buffer_head * extent_header_bh,
- __u64 * NewExtentOffset, ocfs_journal_handle *handle, struct inode *inode)
+static int ocfs_allocate_new_data_node(ocfs_super * osb,
+ ocfs_file_entry * fe,
+ __u64 disk_off,
+ __u64 length,
+ struct buffer_head *exthdr_bh,
+ __u64 * new_off,
+ ocfs_journal_handle *handle,
+ struct inode *inode)
{
int status = 0;
__u8 *buff = NULL;
__u32 k, i;
- __u32 depth;
- __u32 allocSize;
- __u64 upHeaderPtr;
- __u64 physicalOffset;
- __u64 fileOffset = 0;
- __u64 numSectorsAlloc = 0;
- __u64 lastExtPointer;
+ unsigned int depth, size, alloc_size, alloc_blocks = 0;
+ __u64 uphdr_ptr;
+ __u64 phys_off;
+ __u64 file_off = 0;
+ __u64 last_ext;
ocfs_extent_group* extent_header = NULL;
struct buffer_head **header_bhs = NULL;
struct buffer_head *bh = NULL;
int bh_locked = 0;
- int size;
LOG_ENTRY ();
- if (extent_header_bh) {
- status = ocfs_journal_access(handle, extent_header_bh,
+ if (exthdr_bh) {
+ status = ocfs_journal_access(handle, exthdr_bh,
OCFS_JOURNAL_ACCESS_WRITE);
if (status < 0) {
@@ -733,30 +738,31 @@
goto finally;
}
- extent_header = (ocfs_extent_group *) OCFS_BH_GET_DATA_WRITE(extent_header_bh); /* write */
+ extent_header = (ocfs_extent_group *) OCFS_BH_GET_DATA_WRITE(exthdr_bh); /* write */
bh_locked = 1;
}
if (extent_header != NULL) {
depth = extent_header->granularity;
- upHeaderPtr = extent_header->this_ext;
+ uphdr_ptr = extent_header->this_ext;
} else {
- depth = FileEntry->granularity;
- upHeaderPtr = FileEntry->this_sector;
+ depth = fe->granularity;
+ uphdr_ptr = fe->this_sector;
}
- numSectorsAlloc = NUM_SECTORS_IN_LEAF_NODE + depth;
- allocSize = (numSectorsAlloc * osb->sect_size);
+ alloc_blocks = NUM_SECTORS_IN_LEAF_NODE + depth;
+ alloc_size = alloc_blocks << osb->sb->s_blocksize_bits;
/* allocate contiguous blocks on disk */
- status = ocfs_alloc_node_block (osb, allocSize, &physicalOffset,
- &fileOffset, osb->node_num,
+ status = ocfs_alloc_node_block (osb, alloc_size,
+ &phys_off,
+ &file_off, osb->node_num,
DISK_ALLOC_EXTENT_NODE, handle);
if (status < 0) {
LOG_ERROR_STATUS (status);
goto finally;
}
- size = sizeof(struct buffer_head *) * numSectorsAlloc;
+ size = sizeof(struct buffer_head *) * alloc_blocks;
header_bhs = ocfs_malloc(size);
if (header_bhs == NULL) {
status = -ENOMEM;
@@ -765,14 +771,15 @@
}
memset(header_bhs, 0, size);
- status = ocfs_read_bhs(osb, physicalOffset, numSectorsAlloc * osb->sect_size, header_bhs, OCFS_BH_CACHED, inode);
+ status = ocfs_read_bhs(osb, phys_off, alloc_size,
+ header_bhs, OCFS_BH_CACHED, inode);
if (status < 0) {
LOG_ERROR_STATUS (status);
goto finally;
}
/* zero them all out */
- for(i = 0; i < numSectorsAlloc; i++) {
+ for(i = 0; i < alloc_blocks; i++) {
status = ocfs_journal_access(handle, header_bhs[i],
OCFS_JOURNAL_ACCESS_CREATE);
if (status < 0) {
@@ -781,67 +788,69 @@
}
buff = OCFS_BH_GET_DATA_WRITE(header_bhs[i]); /* write */
- memset(buff, 0, osb->sect_size);
+ memset(buff, 0, osb->sb->s_blocksize);
set_buffer_uptodate(header_bhs[i]);
OCFS_BH_PUT_DATA(header_bhs[i]);
}
- if (fileOffset == 0) {
- LOG_ERROR_ARGS ("offset=0, file=%s", FileEntry->filename);
+ if (file_off == 0) {
+ LOG_ERROR_ARGS ("offset=0, file=%s", fe->filename);
}
if (extent_header != NULL) {
k = extent_header->next_free_ext;
- extent_header->extents[k].file_off = FileEntry->alloc_size;
- extent_header->extents[k].num_bytes = actualLength;
- extent_header->extents[k].disk_off = physicalOffset;
+ extent_header->extents[k].file_off = fe->alloc_size;
+ extent_header->extents[k].num_bytes = length;
+ extent_header->extents[k].disk_off = phys_off;
extent_header->next_free_ext++;
} else {
- k = FileEntry->next_free_ext;
- FileEntry->extents[k].file_off = FileEntry->alloc_size;
- FileEntry->extents[k].num_bytes = actualLength;
- FileEntry->extents[k].disk_off = physicalOffset;
- FileEntry->next_free_ext++;
+ k = fe->next_free_ext;
+ fe->extents[k].file_off = fe->alloc_size;
+ fe->extents[k].num_bytes = length;
+ fe->extents[k].disk_off = phys_off;
+ fe->next_free_ext++;
}
- lastExtPointer = FileEntry->last_ext_ptr;
+ last_ext = fe->last_ext_ptr;
/* Fill in all the headers and the leaf */
for (i = 0; i <= depth; i++) {
ocfs_extent_group *ext;
ext = (ocfs_extent_group *) OCFS_BH_GET_DATA_WRITE(header_bhs[i]); /* write */
- ext->last_ext_ptr = lastExtPointer;
- ext->up_hdr_node_ptr = upHeaderPtr;
+ ext->last_ext_ptr = last_ext;
+ ext->up_hdr_node_ptr = uphdr_ptr;
ext->next_free_ext = 1;
- ext->alloc_file_off = fileOffset + (osb->sect_size * i);
+ ext->alloc_file_off = file_off +
+ (i << osb->sb->s_blocksize_bits);
ext->alloc_node = osb->node_num;
- ext->extents[0].file_off = FileEntry->alloc_size;
- ext->extents[0].num_bytes = actualLength;
- ext->this_ext = (__u64) (physicalOffset + (osb->sect_size * i));
+ ext->extents[0].file_off = fe->alloc_size;
+ ext->extents[0].num_bytes = length;
+ ext->this_ext = (__u64)(phys_off +
+ (i << osb->sb->s_blocksize_bits));
if (i != depth) {
/* fill in each header */
ext->type = OCFS_EXTENT_HEADER;
- ext->extents[0].disk_off = (__u64) (physicalOffset + (osb->sect_size * (i + 1)));
+ ext->extents[0].disk_off = (__u64) (phys_off + ((i + 1) << osb->sb->s_blocksize_bits));
ext->granularity = (depth - 1 - i);
strcpy (ext->signature, OCFS_EXTENT_HEADER_SIGNATURE);
} else {
/* fill in the leaf */
ext->type = OCFS_EXTENT_DATA;
- ext->extents[0].disk_off = actualDiskOffset;
+ ext->extents[0].disk_off = disk_off;
ext->curr_sect = 1;
ext->max_sects = NUM_SECTORS_IN_LEAF_NODE;
strcpy (ext->signature, OCFS_EXTENT_DATA_SIGNATURE);
- (*NewExtentOffset) = FileEntry->last_ext_ptr = ext->this_ext;
+ (*new_off) = fe->last_ext_ptr = ext->this_ext;
}
- upHeaderPtr = lastExtPointer = ext->this_ext;
+ uphdr_ptr = last_ext = ext->this_ext;
OCFS_BH_PUT_DATA(header_bhs[i]);
}
- for(i = 0; i < numSectorsAlloc; i++) {
+ for(i = 0; i < alloc_blocks; i++) {
status = ocfs_journal_dirty(handle, header_bhs[i]);
if (status < 0) {
LOG_ERROR_STATUS (status);
@@ -854,11 +863,11 @@
__u64 up_hdr_node_ptr = extent_header->up_hdr_node_ptr;
int granularity = extent_header->granularity;
- OCFS_BH_PUT_DATA(extent_header_bh);
+ OCFS_BH_PUT_DATA(exthdr_bh);
bh_locked = 0;
extent_header = NULL;
- status = ocfs_journal_dirty(handle, extent_header_bh);
+ status = ocfs_journal_dirty(handle, exthdr_bh);
if (status < 0) {
LOG_ERROR_STATUS (status);
goto finally;
@@ -867,7 +876,7 @@
/* gotta fix up his parent extents now. We totally
* reuse the extent_header variable now as it's no
* longer needed for it's original purpose. */
- for (i = granularity + 1; i < FileEntry->granularity; i++) {
+ for (i = granularity + 1; i < fe->granularity; i++) {
bh = NULL;
status = ocfs_read_bh (osb, up_hdr_node_ptr, &bh, OCFS_BH_COND_CACHED, inode);
if (status < 0) {
@@ -897,7 +906,7 @@
}
k = extent_header->next_free_ext - 1;
- extent_header->extents[k].num_bytes += actualLength;
+ extent_header->extents[k].num_bytes += length;
up_hdr_node_ptr = extent_header->up_hdr_node_ptr;
OCFS_BH_PUT_DATA(bh);
@@ -911,14 +920,14 @@
brelse(bh);
}
- k = FileEntry->next_free_ext - 1;
- FileEntry->extents[k].num_bytes += actualLength;
+ k = fe->next_free_ext - 1;
+ fe->extents[k].num_bytes += length;
}
finally:
if (bh_locked)
- OCFS_BH_PUT_DATA(extent_header_bh);
+ OCFS_BH_PUT_DATA(exthdr_bh);
if (header_bhs) {
- for (i = 0; i < numSectorsAlloc; i++)
+ for (i = 0; i < alloc_blocks; i++)
if (header_bhs[i])
brelse(header_bhs[i]);
ocfs_free(header_bhs);
@@ -930,17 +939,21 @@
/* ocfs_grow_extent_tree()
*
*/
-static int ocfs_grow_extent_tree (ocfs_super * osb, struct buffer_head *fe_bh, ocfs_journal_handle *handle, __u64 disk_off, __u64 length, struct inode *inode)
+static int ocfs_grow_extent_tree(ocfs_super * osb,
+ struct buffer_head *fe_bh,
+ ocfs_journal_handle *handle,
+ __u64 disk_off, __u64 length,
+ struct inode *inode)
{
int status = 0;
__s32 k, i;
ocfs_extent_group *OcfsExtent = NULL;
- ocfs_extent_group *ExtentHeader = NULL;
+ ocfs_extent_group *exthdr = NULL;
ocfs_extent_group *ext = NULL;
- __u64 physicalOffset;
- __u64 fileOffset = 0;
- __u64 upHeaderPtr, lastExtentPtr;
- __u32 AllocSize;
+ __u64 phys_off, phys_block;
+ __u64 file_off = 0;
+ __u64 uphdr_ptr, last_ext;
+ __u32 alloc_size;
__u64 new_up_hdr_ptr = 0;
struct buffer_head **bhs = NULL;
int numbhs = 0;
@@ -957,13 +970,13 @@
goto finally;
}
real_fe = (ocfs_file_entry *)OCFS_BH_GET_DATA_READ(fe_bh); /* read */
- memcpy(fe, real_fe, osb->sect_size);
+ memcpy(fe, real_fe, osb->sb->s_blocksize);
OCFS_BH_PUT_DATA(fe_bh);
real_fe = NULL;
- AllocSize = ((fe->granularity + 2) * osb->sect_size);
+ numbhs = fe->granularity + 2;
+ alloc_size = numbhs << osb->sb->s_blocksize_bits;
- numbhs = fe->granularity + 2;
bhs = ocfs_malloc(numbhs * sizeof(*bhs));
if (bhs == NULL) {
status = -ENOMEM;
@@ -974,18 +987,19 @@
/* Allocate the space from the Extent file. This function should */
/* return contigous disk blocks requested. */
- status = ocfs_alloc_node_block (osb, AllocSize, &physicalOffset,
- &fileOffset, osb->node_num,
- DISK_ALLOC_EXTENT_NODE, handle);
+ status = ocfs_alloc_node_block(osb, alloc_size, &phys_off,
+ &file_off, osb->node_num,
+ DISK_ALLOC_EXTENT_NODE, handle);
if (status < 0) {
LOG_ERROR_STATUS (status);
goto finally;
}
+ phys_block = phys_off >> osb->sb->s_blocksize_bits;
+
for (i = 0; i < numbhs; i++) {
bhs[i] = getblk(OCFS_GET_BLOCKDEV(osb->sb),
- (physicalOffset + i * osb->sect_size) >>
- osb->sect_size_bits,
+ phys_block + i,
osb->sb->s_blocksize);
if (bhs[i] == NULL) {
status = -EIO;
@@ -993,16 +1007,16 @@
goto finally;
}
buf = OCFS_BH_GET_DATA_WRITE(bhs[i]); /* write */
- memset(buf, 0, osb->sect_size);
+ memset(buf, 0, osb->sb->s_blocksize);
set_buffer_uptodate(bhs[i]);
OCFS_BH_PUT_DATA(bhs[i]);
}
- if (fileOffset == 0) {
+ if (file_off == 0) {
LOG_TRACE_ARGS ("offset=0, file=%s\n", fe->filename);
}
- if (physicalOffset == 0) {
+ if (phys_off == 0) {
LOG_ERROR_STATUS(status = -ENOMEM);
goto finally;
}
@@ -1016,9 +1030,9 @@
}
OcfsExtent->last_ext_ptr = fe->last_ext_ptr;
- lastExtentPtr = fe->last_ext_ptr;
- OcfsExtent->this_ext = new_up_hdr_ptr = physicalOffset;
- OcfsExtent->alloc_file_off = fileOffset;
+ last_ext = fe->last_ext_ptr;
+ OcfsExtent->this_ext = new_up_hdr_ptr = phys_off;
+ OcfsExtent->alloc_file_off = file_off;
OcfsExtent->alloc_node = osb->node_num;
OcfsExtent->next_data_ext = 0;
fe->local_ext = 0;
@@ -1032,41 +1046,41 @@
/* First time a file is created ,granularity = -1 and local_ext flag */
/* is set to true */
- upHeaderPtr = fe->this_sector;
+ uphdr_ptr = fe->this_sector;
for (i = 0; i < fe->granularity; i++) {
- ExtentHeader = (ocfs_extent_group *) OCFS_BH_GET_DATA_WRITE(bhs[i]); /* write */
+ exthdr = (ocfs_extent_group *) OCFS_BH_GET_DATA_WRITE(bhs[i]); /* write */
- ExtentHeader->type = OCFS_EXTENT_HEADER;
- ExtentHeader->granularity = (fe->granularity - 1) - i;
+ exthdr->type = OCFS_EXTENT_HEADER;
+ exthdr->granularity = (fe->granularity - 1) - i;
- strcpy (ExtentHeader->signature, OCFS_EXTENT_HEADER_SIGNATURE);
+ strcpy (exthdr->signature, OCFS_EXTENT_HEADER_SIGNATURE);
if (i == 0) {
- ExtentHeader->extents[OCFS_MAX_FILE_ENTRY_EXTENTS].disk_off = physicalOffset + osb->sect_size;
- ExtentHeader->extents[OCFS_MAX_FILE_ENTRY_EXTENTS].file_off = fe->alloc_size;
- ExtentHeader->extents[OCFS_MAX_FILE_ENTRY_EXTENTS].num_bytes = length;
+ exthdr->extents[OCFS_MAX_FILE_ENTRY_EXTENTS].disk_off = phys_off + osb->sb->s_blocksize;
+ exthdr->extents[OCFS_MAX_FILE_ENTRY_EXTENTS].file_off = fe->alloc_size;
+ exthdr->extents[OCFS_MAX_FILE_ENTRY_EXTENTS].num_bytes = length;
- ExtentHeader->next_free_ext = OCFS_MAX_FILE_ENTRY_EXTENTS + 1;
- ExtentHeader->this_ext = physicalOffset;
- ExtentHeader->last_ext_ptr = lastExtentPtr;
- ExtentHeader->up_hdr_node_ptr = upHeaderPtr;
+ exthdr->next_free_ext = OCFS_MAX_FILE_ENTRY_EXTENTS + 1;
+ exthdr->this_ext = phys_off;
+ exthdr->last_ext_ptr = last_ext;
+ exthdr->up_hdr_node_ptr = uphdr_ptr;
- upHeaderPtr = ExtentHeader->this_ext;
- lastExtentPtr = ExtentHeader->this_ext;
+ uphdr_ptr = exthdr->this_ext;
+ last_ext = exthdr->this_ext;
} else {
- ExtentHeader->extents[0].disk_off = physicalOffset + (osb->sect_size * (i + 1));
- ExtentHeader->extents[0].file_off = fe->alloc_size;
- ExtentHeader->extents[0].num_bytes = length;
- ExtentHeader->next_free_ext = 1;
- ExtentHeader->alloc_file_off = fileOffset + (osb->sect_size * i);
- ExtentHeader->alloc_node = osb->node_num;
- ExtentHeader->this_ext = physicalOffset + (osb->sect_size * i);
- ExtentHeader->up_hdr_node_ptr = upHeaderPtr;
- ExtentHeader->last_ext_ptr = lastExtentPtr;
+ exthdr->this_ext = (phys_block + i) << osb->sb->s_blocksize_bits;
+ exthdr->extents[0].disk_off = exthdr->this_ext + osb->sb->s_blocksize;
+ exthdr->extents[0].file_off = fe->alloc_size;
+ exthdr->extents[0].num_bytes = length;
+ exthdr->next_free_ext = 1;
+ exthdr->alloc_file_off = file_off + (i << osb->sb->s_blocksize_bits);
+ exthdr->alloc_node = osb->node_num;
+ exthdr->up_hdr_node_ptr = uphdr_ptr;
+ exthdr->last_ext_ptr = last_ext;
- upHeaderPtr = ExtentHeader->this_ext;
- lastExtentPtr = ExtentHeader->this_ext;
+ uphdr_ptr = exthdr->this_ext;
+ last_ext = exthdr->this_ext;
}
OCFS_BH_PUT_DATA(bhs[i]);
}
@@ -1090,15 +1104,16 @@
OcfsExtent->max_sects = NUM_SECTORS_IN_LEAF_NODE;
OcfsExtent->type = OCFS_EXTENT_DATA;
OcfsExtent->next_free_ext = i + 1;
- OcfsExtent->alloc_file_off = fileOffset + (fe->granularity * osb->sect_size);
+ OcfsExtent->alloc_file_off = file_off + (fe->granularity << osb->sb->s_blocksize_bits);
OcfsExtent->alloc_node = osb->node_num;
- OcfsExtent->this_ext = physicalOffset + (fe->granularity * osb->sect_size);
- OcfsExtent->up_hdr_node_ptr = upHeaderPtr;
- OcfsExtent->last_ext_ptr = lastExtentPtr;
+ OcfsExtent->this_ext = phys_off +
+ (fe->granularity << osb->sb->s_blocksize_bits);
+ OcfsExtent->up_hdr_node_ptr = uphdr_ptr;
+ OcfsExtent->last_ext_ptr = last_ext;
OcfsExtent->next_data_ext = 0;
- upHeaderPtr = OcfsExtent->this_ext;
- lastExtentPtr = OcfsExtent->this_ext;
+ uphdr_ptr = OcfsExtent->this_ext;
+ last_ext = OcfsExtent->this_ext;
OCFS_BH_PUT_DATA(bhs[fe->granularity]);
@@ -1114,7 +1129,8 @@
if (fe->last_ext_ptr != 0) {
struct buffer_head *bh = NULL;
- status = ocfs_read_bh(osb, fe->last_ext_ptr, &bh, OCFS_BH_COND_CACHED, inode);
+ status = ocfs_read_bh(osb, fe->last_ext_ptr, &bh,
+ OCFS_BH_COND_CACHED, inode);
if (status < 0) {
LOG_ERROR_STATUS (status);
goto finally;
@@ -1135,7 +1151,7 @@
goto finally;
}
- ext->next_data_ext = lastExtentPtr;
+ ext->next_data_ext = last_ext;
OCFS_BH_PUT_DATA(bh);
status = ocfs_journal_dirty(handle, bh);
@@ -1155,7 +1171,9 @@
status = 0;
for (i = 0; i < OCFS_MAX_FILE_ENTRY_EXTENTS; ++i) {
offset = fe->extents[i].disk_off;
- status = ocfs_read_bh(osb, offset, &bh, OCFS_BH_COND_CACHED, inode);
+ status = ocfs_read_bh(osb, offset, &bh,
+ OCFS_BH_COND_CACHED,
+ inode);
if (status < 0) {
LOG_ERROR_STATUS(status);
brelse(bh);
@@ -1194,15 +1212,15 @@
LOG_TRACE_ARGS("fe->alloc_size = %llu\n", fe->alloc_size);
fe->extents[0].file_off = 0;
fe->extents[0].num_bytes = fe->alloc_size + length;
- fe->extents[0].disk_off = physicalOffset;
- fe->last_ext_ptr = lastExtentPtr;
+ fe->extents[0].disk_off = phys_off;
+ fe->last_ext_ptr = last_ext;
fe->next_free_ext = 1;
finally:
if (fe) {
real_fe = (ocfs_file_entry *)OCFS_BH_GET_DATA_WRITE(fe_bh); /* write */
- memcpy(real_fe, fe, osb->sect_size);
+ memcpy(real_fe, fe, osb->sb->s_blocksize);
OCFS_BH_PUT_DATA(fe_bh);
real_fe = NULL;
ocfs_release_file_entry(fe);
@@ -1657,9 +1675,9 @@
for (i =0; i < OCFS_TREE_STACK_SIZE; i++)
stack[i] = NULL;
- stack[tos] = ocfs_malloc(osb->sect_size);
+ stack[tos] = ocfs_malloc(osb->sb->s_blocksize);
memcpy(stack[tos], OCFS_BH_GET_DATA_READ(extent_grp_bh),
- osb->sect_size);
+ osb->sb->s_blocksize);
OCFS_BH_PUT_DATA(extent_grp_bh);
do {
@@ -1712,7 +1730,7 @@
/* should already be null, but we can do this
* just in case. */
- stack[tos] = ocfs_malloc(osb->sect_size);
+ stack[tos] = ocfs_malloc(osb->sb->s_blocksize);
status = ocfs_read_bh(osb, tmp_off, &tmp_bh,
OCFS_BH_COND_CACHED, inode);
@@ -1723,7 +1741,7 @@
memcpy(stack[tos],
OCFS_BH_GET_DATA_READ(tmp_bh),
- osb->sect_size);
+ osb->sb->s_blocksize);
OCFS_BH_PUT_DATA(tmp_bh);
brelse(tmp_bh);
tmp_bh = NULL;
@@ -2850,12 +2868,12 @@
LargeAllocOffset = five_percent;
}
- bitmapblocks = (OCFS_ALIGN(osb->cluster_bitmap.validbits,
- OCFS_BITS_IN_CHUNK) / OCFS_BITS_IN_CHUNK);
+ bitmapblocks = ocfs_blocks_for_bits(osb->sb,
+ osb->cluster_bitmap.validbits);
/* Ok, somewhat lame, but we submit the whole bitmap for reading here*/
if (ocfs_read_bhs(osb, osb->vol_layout.bitmap_off,
- bitmapblocks * osb->sect_size,
+ bitmapblocks * osb->sb->s_blocksize,
osb->cluster_bitmap.chunk, 0, NULL)) {
LOG_ERROR_STATUS(-EIO);
goto leave;
@@ -2898,13 +2916,14 @@
LOG_TRACE_ARGS ("setting at bit offset=%u\n", bitoffset);
- ocfs_set_bits (handle, &osb->cluster_bitmap, bitoffset, ClusterCount);
+ ocfs_set_bits(osb->sb, handle, &osb->cluster_bitmap,
+ bitoffset, ClusterCount);
/* Ok, write out the bitmap now. We optimize only by writing
* out the bitmap blocks which have changed, and not all of
* them like before. */
- startbh = OCFS_GLOBAL_OFF_TO_CHUNK(bitoffset);
- numblocks = OCFS_GLOBAL_OFF_TO_CHUNK(bitoffset + ClusterCount - 1) - startbh + 1;
+ startbh = OCFS_GLOBAL_OFF_TO_CHUNK(osb->sb, bitoffset);
+ numblocks = OCFS_GLOBAL_OFF_TO_CHUNK(osb->sb, bitoffset + ClusterCount - 1) - startbh + 1;
LOG_TRACE_ARGS("bitoffset = %u, ClusterCount = %u, startbh = %u, numblocks = %u\n", bitoffset, ClusterCount, startbh, numblocks);
@@ -2993,7 +3012,8 @@
OCFS_ASSERT (blockSize);
- lockId = (bm_file * osb->sect_size) + osb->vol_layout.root_int_off;
+ lockId = (bm_file * osb->sb->s_blocksize) +
+ osb->vol_layout.root_int_off;
inode = ocfs_iget(osb, lockId, NULL);
if (!inode) {
status = -EINVAL;
@@ -3033,7 +3053,9 @@
if ((fileSize != 0) && (allocSize != 0)) {
/* Round this off to dirnodesize */
- ocfs_initialize_bitmap (&bitmap, (__u32) fileSize * 8, (__u32) allocSize * 8);
+ ocfs_initialize_bitmap (osb, &bitmap,
+ (__u32) fileSize * 8,
+ (__u32) allocSize * 8);
needs_uninit = 1;
status = ocfs_read_system_file (osb, bm_file, bitmap.chunk,
@@ -3102,10 +3124,12 @@
OCFS_BH_PUT_DATA(bh);
if (needs_uninit)
- ocfs_reinitialize_bitmap(&bitmap, fileSize * 8,
+ ocfs_reinitialize_bitmap(osb, &bitmap,
+ fileSize * 8,
allocSize * 8);
else
- ocfs_initialize_bitmap(&bitmap, fileSize * 8,
+ ocfs_initialize_bitmap(osb, &bitmap,
+ fileSize * 8,
allocSize * 8);
needs_uninit = 1;
@@ -3128,16 +3152,17 @@
LOG_TRACE_ARGS ("byte offset=%d\n", foundBit);
- ocfs_set_bits (handle, &bitmap, (__u32) foundBit, (__u32) numBits);
+ ocfs_set_bits(osb->sb, handle, &bitmap,
+ (__u32) foundBit, (__u32) numBits);
/* only write out what has changed... */
- startbh = OCFS_GLOBAL_OFF_TO_CHUNK(foundBit);
- numblocks = OCFS_GLOBAL_OFF_TO_CHUNK(foundBit + numBits - 1) - startbh + 1;
+ startbh = OCFS_GLOBAL_OFF_TO_CHUNK(osb->sb, foundBit);
+ numblocks = OCFS_GLOBAL_OFF_TO_CHUNK(osb->sb, foundBit + numBits - 1) - startbh + 1;
LOG_TRACE_ARGS ("offset=%u, type=%x, blksz=%u, foundbit=%u, fileid=%u\n",
foundBit * blockSize, Type, blockSize, foundBit, alloc_file);
*DiskOffset = ocfs_file_to_disk_off (osb, (alloc_file),
- (foundBit * blockSize));
+ (foundBit * blockSize));
if (*DiskOffset == 0) {
LOG_ERROR_STATUS(status = -EFAIL);
goto leave;
@@ -3870,7 +3895,7 @@
LOG_ENTRY();
/* read the alloc off disk */
- offset = ((OCFS_LOCAL_ALLOC_FILE + osb->node_num) * osb->sect_size) +
+ offset = ((OCFS_LOCAL_ALLOC_FILE + osb->node_num) * osb->sb->s_blocksize) +
osb->vol_layout.root_int_off;
status = ocfs_read_bh(osb, offset, &alloc_bh, 0, NULL);
if (status < 0) {
@@ -3981,7 +4006,7 @@
LOG_ENTRY_ARGS("(node_num = %d)\n", node_num);
- offset = ((OCFS_LOCAL_ALLOC_FILE + node_num) * osb->sect_size) +
+ offset = ((OCFS_LOCAL_ALLOC_FILE + node_num) * osb->sb->s_blocksize) +
osb->vol_layout.root_int_off;
status = ocfs_read_bh(osb, offset, &alloc_bh, 0, NULL);
if (status < 0) {
Modified: branches/s_blocksize/src/bitmap.c
===================================================================
--- branches/s_blocksize/src/bitmap.c 2004-06-14 01:52:45 UTC (rev 1085)
+++ branches/s_blocksize/src/bitmap.c 2004-06-14 02:14:41 UTC (rev 1086)
@@ -38,19 +38,19 @@
* ocfs_initialize_bitmap()
*
*/
-void ocfs_initialize_bitmap (ocfs_alloc_bm * bitmap, __u32 validbits, __u32 allocbits)
+void ocfs_initialize_bitmap(ocfs_super *osb, ocfs_alloc_bm * bitmap,
+ __u32 validbits, __u32 allocbits)
{
- __u32 tmp;
+ LOG_ENTRY_ARGS ("(0x%p, 0x%p, %u, %u)\n", osb, bitmap,
+ validbits, allocbits);
- LOG_ENTRY_ARGS ("(0x%p, %u, %u)\n", bitmap, validbits, allocbits);
-
bitmap->validbits = validbits;
bitmap->allocbits = allocbits;
bitmap->failed = 0;
bitmap->ok_retries = 0;
- tmp = OCFS_ALIGN(allocbits, OCFS_BITS_IN_CHUNK);
- bitmap->numbh = (tmp / OCFS_BITS_IN_CHUNK);
+ bitmap->numbh = ocfs_blocks_for_bits(osb->sb,
+ bitmap->allocbits);
bitmap->chunk = ocfs_malloc(bitmap->numbh * sizeof(struct buffer_head *));
if (!bitmap->chunk)
BUG();
@@ -84,9 +84,9 @@
}
/* we only handle if the bitmap has grown, not shrunk. */
-void ocfs_reinitialize_bitmap(ocfs_alloc_bm *bitmap, __u32 validbits, __u32 allocbits)
+void ocfs_reinitialize_bitmap(ocfs_super *osb, ocfs_alloc_bm *bitmap,
+ __u32 validbits, __u32 allocbits)
{
- __u32 tmp;
__u32 newnumbh;
struct buffer_head **newchunk;
@@ -101,8 +101,7 @@
if (allocbits == bitmap->allocbits)
goto skipbhs;
- tmp = OCFS_ALIGN(allocbits, OCFS_BITS_IN_CHUNK);
- newnumbh = (tmp / OCFS_BITS_IN_CHUNK);
+ newnumbh = ocfs_blocks_for_bits(osb->sb, allocbits);
newchunk = ocfs_malloc(bitmap->numbh * sizeof(struct buffer_head *));
if (!newchunk)
@@ -117,6 +116,7 @@
bitmap->numbh = newnumbh;
bitmap->chunk = newchunk;
bitmap->allocbits = allocbits;
+
skipbhs:
bitmap->validbits = validbits;
@@ -157,9 +157,12 @@
* in case we have a disk full.
*
*/
-int ocfs_find_clear_bits (ocfs_super *osb, ocfs_alloc_bm * bitmap, __u32 numBits, __u32 offset, __u32 sysonly)
+int ocfs_find_clear_bits(ocfs_super *osb, ocfs_alloc_bm * bitmap,
+ __u32 numBits, __u32 offset, __u32 sysonly)
{
- __u32 globalsize, globaloff, localstart, lastbh, size, bitoff, count;
+ __u32 globalsize, globaloff, localstart, lastbh;
+ __u32 size = OCFS_BITS_IN_CHUNK(osb->sb);
+ __u32 bitoff = 0, count = 0;
void *buffer;
int c;
struct buffer_head *currbh = NULL;
@@ -168,19 +171,15 @@
offset, sysonly);
globalsize = bitmap->validbits - sysonly;
- bitoff = count = 0;
- lastbh = (OCFS_ALIGN(globalsize, OCFS_BITS_IN_CHUNK) /
- OCFS_BITS_IN_CHUNK) - 1;
+ lastbh = ocfs_blocks_for_bits(osb->sb, globalsize) - 1;
globaloff = offset;
- localstart = OCFS_GLOBAL_OFF_TO_LOCAL(globaloff);
+ c = OCFS_GLOBAL_OFF_TO_CHUNK(osb->sb, globaloff);
+ localstart = OCFS_GLOBAL_OFF_TO_LOCAL(osb->sb, globaloff);
if (lastbh == 0)
size = globalsize;
- else
- size = OCFS_BITS_IN_CHUNK;
- c = OCFS_GLOBAL_OFF_TO_CHUNK(localstart);
currbh = bitmap->chunk[c];
/*LOG_TRACE_ARGS("globalsize=%u, bitmap->validbits=%u, sysonly=%u\n",
@@ -189,7 +188,8 @@
"localstart=%u\n", c, lastbh, size, localstart);*/
buffer = OCFS_BH_GET_DATA_READ(currbh); /* read */
- while ((bitoff = find_next_zero_bit(buffer, OCFS_BITS_IN_CHUNK,
+ while ((bitoff = find_next_zero_bit(buffer,
+ OCFS_BITS_IN_CHUNK(osb->sb),
localstart)) != -1) {
/*LOG_TRACE_ARGS("c=%u, globaloff=%u, bitoff=%u, "
"localstart=%u\n", c, globaloff, bitoff,
@@ -219,8 +219,10 @@
currbh = bitmap->chunk[c];
buffer = OCFS_BH_GET_DATA_READ(currbh); /* read */
if (c == lastbh)
- size = globalsize-(OCFS_BITS_IN_CHUNK*lastbh);
- globaloff = c * OCFS_BITS_IN_CHUNK;
+ size = globalsize -
+ (OCFS_BITS_IN_CHUNK(osb->sb) *
+ lastbh);
+ globaloff = c * OCFS_BITS_IN_CHUNK(osb->sb);
continue;
}
@@ -246,7 +248,9 @@
bitoff, localstart);*/
/* we had to skip over some ones */
count = 1;
- globaloff = OCFS_CHUNK_TO_GLOBAL_OFF(c, bitoff) + 1;
+ globaloff = OCFS_CHUNK_TO_GLOBAL_OFF(osb->sb,
+ c,
+ bitoff) + 1;
localstart = bitoff + 1;
}
@@ -308,15 +312,16 @@
* ocfs_set_bits()
*
*/
-void ocfs_set_bits (ocfs_journal_handle *handle, ocfs_alloc_bm * bitmap,
- __u32 start, __u32 num)
+void ocfs_set_bits(struct super_block *sb, ocfs_journal_handle *handle,
+ ocfs_alloc_bm * bitmap, __u32 start, __u32 num)
{
struct buffer_head *currbh = NULL;
void *buff;
int i, local;
int status;
- LOG_ENTRY_ARGS ("(0x%p, %u, %u)\n", bitmap, start, num);
+ LOG_ENTRY_ARGS ("(0x%p, 0x%p, 0x%p, %u, %u)\n", sb, handle,
+ bitmap, start, num);
if ((start + num) > bitmap->validbits) {
LOG_ERROR_ARGS("bitmap->validbits = %u but start = %u and " \
@@ -324,8 +329,8 @@
goto bail;
}
- i = OCFS_GLOBAL_OFF_TO_CHUNK(start);
- local = OCFS_GLOBAL_OFF_TO_LOCAL(start);
+ i = OCFS_GLOBAL_OFF_TO_CHUNK(sb, start);
+ local = OCFS_GLOBAL_OFF_TO_LOCAL(sb, start);
currbh = bitmap->chunk[i];
status = ocfs_journal_access(handle, currbh, OCFS_JOURNAL_ACCESS_UNDO);
@@ -338,7 +343,7 @@
while (num--) {
set_bit (local++, buff);
- if (local >= OCFS_BITS_IN_CHUNK && num != 0) {
+ if (local >= OCFS_BITS_IN_CHUNK(sb) && num != 0) {
local = 0;
OCFS_BH_PUT_DATA(currbh);
status = ocfs_journal_dirty(handle, currbh);
@@ -377,15 +382,17 @@
* ocfs_clear_bits()
*
*/
-void ocfs_clear_bits (ocfs_journal_handle *handle, ocfs_alloc_bm * bitmap,
- __u32 start, __u32 num)
+void ocfs_clear_bits(struct super_block *sb,
+ ocfs_journal_handle *handle,
+ ocfs_alloc_bm * bitmap, __u32 start, __u32 num)
{
struct buffer_head *currbh = NULL;
void *buff;
int i, local;
int status;
- LOG_ENTRY_ARGS ("(0x%p, %u, %u)\n", bitmap, start, num);
+ LOG_ENTRY_ARGS ("(0x%p, 0x%p, 0x%p, %u, %u)\n", sb, handle,
+ bitmap, start, num);
if ((start + num) > bitmap->validbits) {
LOG_ERROR_ARGS("bitmap->validbits = %u but start = %u and " \
@@ -393,8 +400,8 @@
goto bail;
}
- i = OCFS_GLOBAL_OFF_TO_CHUNK(start);
- local = OCFS_GLOBAL_OFF_TO_LOCAL(start);
+ i = OCFS_GLOBAL_OFF_TO_CHUNK(sb, start);
+ local = OCFS_GLOBAL_OFF_TO_LOCAL(sb, start);
currbh = bitmap->chunk[i];
status = ocfs_journal_access(handle, currbh, OCFS_JOURNAL_ACCESS_UNDO);
@@ -412,7 +419,7 @@
(unsigned long *)bh2jh(currbh)->b_committed_data);
local++;
- if (local >= OCFS_BITS_IN_CHUNK && num != 0) {
+ if (local >= OCFS_BITS_IN_CHUNK(sb) && num != 0) {
local = 0;
OCFS_BH_PUT_DATA(currbh);
Modified: branches/s_blocksize/src/inc/journal.h
===================================================================
--- branches/s_blocksize/src/inc/journal.h 2004-06-14 01:52:45 UTC (rev 1085)
+++ branches/s_blocksize/src/inc/journal.h 2004-06-14 02:14:41 UTC (rev 1086)
@@ -353,12 +353,10 @@
int bitmap_blocks;
unsigned int bits_wanted;
- bits_wanted = (__u32)OCFS_ALIGN(bytes_wanted, cluster_size) /
- cluster_size;
+ bits_wanted = ocfs_clusters_for_bytes(sb, bytes_wanted);
/* take advantage of the fact that we always allocate in one
* large chunk. */
- bitmap_blocks = 1 + OCFS_ALIGN(bits_wanted, OCFS_BITS_IN_CHUNK) /
- OCFS_BITS_IN_CHUNK;
+ bitmap_blocks = ocfs_blocks_for_bits(sb, bits_wanted);
return(bitmap_blocks + OCFS_FILE_EXTEND_CREDITS);
}
Modified: branches/s_blocksize/src/inc/ocfs.h
===================================================================
--- branches/s_blocksize/src/inc/ocfs.h 2004-06-14 01:52:45 UTC (rev 1085)
+++ branches/s_blocksize/src/inc/ocfs.h 2004-06-14 02:14:41 UTC (rev 1086)
@@ -99,21 +99,29 @@
#define OCFS_BITMAP_CHUNK (512) /* size of a chunk, in bytes */
-#define OCFS_BITS_IN_CHUNK (OCFS_BITMAP_CHUNK * 8)
+#define OCFS_BITS_IN_CHUNK(sb) ((sb)->s_blocksize * 8)
//#define OCFS_BITMAP_NUM_BH (ONE_MEGA_BYTE / OCFS_BITMAP_CHUNK)
/* Lovely convenience macros. If we move to a scheme where
* OCFS_BITS_IN_CHUNK or OCFS_BITMAP_NUM_BH are not constant, this'll
* be nice. */
-#define OCFS_CHUNK_TO_GLOBAL_OFF(index, localoffset) \
- ((index) * OCFS_BITS_IN_CHUNK + (localoffset))
-#define OCFS_GLOBAL_OFF_TO_CHUNK(globaloffset) \
- ((globaloffset) / OCFS_BITS_IN_CHUNK)
-#define OCFS_GLOBAL_OFF_TO_LOCAL(globaloffset) \
- ((globaloffset) % OCFS_BITS_IN_CHUNK)
-#define OCFS_BITMAP_RANGE_BITS(startbh, startoff, endbh, endoff) \
- (OCFS_CHUNK_TO_GLOBAL_OFF((endbh), (endoff)) - \
- OCFS_CHUNK_TO_GLOBAL_OFF((startbh), (startoff)))
+#define OCFS_CHUNK_TO_GLOBAL_OFF(sb, index, localoffset) \
+ ((index) * OCFS_BITS_IN_CHUNK(sb) + (localoffset))
+#define OCFS_GLOBAL_OFF_TO_CHUNK(sb, globaloffset) \
+ ((globaloffset) / OCFS_BITS_IN_CHUNK(sb))
+#define OCFS_GLOBAL_OFF_TO_LOCAL(sb, globaloffset) \
+ ((globaloffset) % OCFS_BITS_IN_CHUNK(sb))
+#define OCFS_BITMAP_RANGE_BITS(sb, startbh, startoff, endbh, endoff)\
+ (OCFS_CHUNK_TO_GLOBAL_OFF((sb), (endbh), (endoff)) - \
+ OCFS_CHUNK_TO_GLOBAL_OFF((sb), (startbh), (startoff)))
+static inline int ocfs_blocks_for_bits(struct super_block *sb,
+ __u32 num_bits)
+{
+ int bits_per_chunk = OCFS_BITS_IN_CHUNK(sb);
+
+ return (num_bits + (bits_per_chunk - 1)) / bits_per_chunk;
+}
+
typedef struct _ocfs_alloc_bm
{
__u32 validbits; /* number of valid bits */
@@ -641,11 +649,6 @@
#define OCFS_SET_FLAG(flag, value) ((flag) |= (value))
#define OCFS_CLEAR_FLAG(flag, value) ((flag) &= ~(value))
-#define OCFS_SECTOR_ALIGN(buf) \
- ((__u64)buf + \
- (((__u64)buf % OCFS_SECTOR_SIZE) ? \
- (OCFS_SECTOR_SIZE - ((__u64)buf % OCFS_SECTOR_SIZE)):0))
-
/*
** Structures...
*/
@@ -1409,6 +1412,7 @@
__u32 uid; // UID
__u32 gid; // GID
__s32 excl_mount; // NODENUM
+ __u32 blocksize_bits; // NUMBER RANGE(9, 12)
}
ocfs_vol_disk_hdr; // END CLASS
@@ -1677,6 +1681,7 @@
__u64 start_off;
__u32 num_nodes;
__u32 cluster_size;
+ __u32 blocksize_bits;
__u8 mount_point[MAX_MOUNT_POINT_LEN];
__u8 vol_id[MAX_VOL_ID_LENGTH];
__u8 label[MAX_VOL_LABEL_LEN];
Modified: branches/s_blocksize/src/inc/proto.h
===================================================================
--- branches/s_blocksize/src/inc/proto.h 2004-06-14 01:52:45 UTC (rev 1085)
+++ branches/s_blocksize/src/inc/proto.h 2004-06-14 02:14:41 UTC (rev 1086)
@@ -155,6 +155,9 @@
ocfs_journal_handle *handle, struct inode *inode);
int ocfs_initialize_osb (ocfs_super * osb, ocfs_vol_disk_hdr * vdh, ocfs_vol_label * vol_label, __u32 sect_size);
+int ocfs_start_global_bitmap(ocfs_super *osb);
+int ocfs_start_publish(ocfs_super *osb);
+int ocfs_insert_osb(ocfs_super *osb);
int ocfs_verify_volume (ocfs_vol_disk_hdr * vdh);
int ocfs_check_volume (ocfs_super * osb);
void ocfs_delete_osb (ocfs_super * osb);
@@ -182,13 +185,18 @@
int ocfs_drop_readonly_cache_lock(ocfs_super *osb, struct inode *inode,int yield);
-void ocfs_initialize_bitmap (ocfs_alloc_bm * bitmap, __u32 validbits, __u32 allocbits);
+void ocfs_initialize_bitmap(ocfs_super *osb, ocfs_alloc_bm * bitmap,
+ __u32 validbits, __u32 allocbits);
void ocfs_uninitialize_bitmap(ocfs_alloc_bm * bitmap);
-void ocfs_reinitialize_bitmap(ocfs_alloc_bm *bitmap, __u32 validbits, __u32 allocbits);
+void ocfs_reinitialize_bitmap(ocfs_super *osb, ocfs_alloc_bm *bitmap,
+ __u32 validbits, __u32 allocbits);
int ocfs_find_clear_bits (ocfs_super *osb, ocfs_alloc_bm * bitmap, __u32 numBits, __u32 offset, __u32 sysonly);
int ocfs_count_bits (ocfs_alloc_bm * bitmap);
-void ocfs_set_bits (ocfs_journal_handle *handle, ocfs_alloc_bm * bitmap, __u32 start, __u32 num);
-void ocfs_clear_bits (ocfs_journal_handle *handle, ocfs_alloc_bm * bitmap, __u32 start, __u32 num);
+void ocfs_set_bits(struct super_block *sb, ocfs_journal_handle *handle,
+ ocfs_alloc_bm * bitmap, __u32 start, __u32 num);
+void ocfs_clear_bits(struct super_block *sb,
+ ocfs_journal_handle *handle,
+ ocfs_alloc_bm * bitmap, __u32 start, __u32 num);
int ocfs_get_config (ocfs_super * osb);
int ocfs_chk_update_config (ocfs_super * osb);
Modified: branches/s_blocksize/src/inode.c
===================================================================
--- branches/s_blocksize/src/inode.c 2004-06-14 01:52:45 UTC (rev 1085)
+++ branches/s_blocksize/src/inode.c 2004-06-14 02:14:41 UTC (rev 1086)
@@ -835,7 +835,8 @@
static int ocfs_symlink_get_block (struct inode *inode, sector_t iblock, struct buffer_head *bh_result, int create)
{
int err = -EIO;
- ocfs_super *osb;
+ struct super_block *sb = inode->i_sb;
+ ocfs_super *osb = OCFS_SB(sb);
int status;
ocfs_file_entry *fe = NULL;
__u64 entryOffset;
@@ -849,9 +850,7 @@
goto bail;
}
- osb = OCFS_SB(inode->i_sb);
-
- if ((iblock << 9) > PATH_MAX + 1) {
+ if ((iblock << sb->s_blocksize_bits) > PATH_MAX + 1) {
LOG_ERROR_ARGS ("file offset > PATH_MAX: %llu",
(unsigned long long)iblock << 9);
goto bail;
@@ -872,14 +871,14 @@
goto bail;
}
- if ((iblock << 9) >= (__s64)fe->alloc_size) {
+ if ((iblock << sb->s_blocksize_bits) >= (__s64)fe->alloc_size) {
OCFS_BH_PUT_DATA(bh);
- LOG_ERROR_ARGS ("file offset is outside the allocated size: %llu",
- (unsigned long long)iblock << 9);
+ LOG_ERROR_ARGS ("file offset is outside the allocated size: %lu",
+ iblock << sb->s_blocksize_bits);
goto bail;
}
- map_bh(bh_result, inode->i_sb, (fe->extents[0].disk_off >> osb->sect_size_bits) + iblock);
+ map_bh(bh_result, sb, (fe->extents[0].disk_off >> sb->s_blocksize_bits) + iblock);
OCFS_BH_PUT_DATA(bh);
err = 0;
@@ -923,7 +922,7 @@
if (!INODE_JOURNAL(inode) && vbo >= OCFS_I(inode)->alloc_size) {
LOG_TRACE_STR("Extending allocation");
- err = ocfs_extend_file(osb, vbo + osb->sect_size, GET_INODE_FEOFF(inode), NULL, inode, NULL);
+ err = ocfs_extend_file(osb, vbo + inode->i_sb->s_blocksize, GET_INODE_FEOFF(inode), NULL, inode, NULL);
if (err < 0) {
err = -ENOSPC;
LOG_ERROR_STATUS (err);
@@ -1219,12 +1218,12 @@
* struct inode *inode,
* struct kiobuf *iobuf, unsigned long blocknr, int blocksize)
*
- * now:
+ * now:
static int ocfs_direct_IO(int rw, struct kiocb *iocb,
const struct iovec *iov, loff_t offset,
unsigned long nr_segs)
* int (*direct_IO)(int, struct kiocb *, const struct iovec *iov,
- * loff_t offset, unsigned long nr_segs);
+ * loff_t offset, unsigned long nr_segs);
*/
static int ocfs_direct_IO(int rw, struct kiocb *iocb, const struct iovec *iov, loff_t offset, unsigned long nr_segs)
{
@@ -1297,7 +1296,7 @@
struct inode *inode = filp->f_dentry->d_inode;
int max_sectors;
int nbhs;
- int sector_size, sector_bits, sector_mask;
+ int sector_size, sector_bits, sector_mask, sectors_per_page;
int ret = 0;
int large_io = 0;
int inuse = 0;
@@ -1314,9 +1313,10 @@
saved_size = size;
/* FIXME: Need to differentiate between sectors and blocksize */
- sector_size = 512;
- sector_bits = 9;
- sector_mask = 511;
+ sector_size = OCFS_SB(inode->i_sb)->sect_size;
+ sector_bits = OCFS_SB(inode->i_sb)->sect_size_bits;
+ sector_mask = sector_size - 1;
+ sectors_per_page = PAGE_SIZE / sector_size;
/* max sectors is 1024 in 2.4.9
* max data is 512kb
*/
@@ -1334,7 +1334,7 @@
size = inode->i_size - *offp;
}
- /* make sure we are aligned to either 4kb or 512 byte IO */
+ /* make sure aligned to either PAGE_SIZE or sect_size IO */
#ifndef LARGEIOS
if ((*offp & sector_mask) || (size & sector_mask))
/* if not, then fail, we need either to do dio */
@@ -1344,19 +1344,19 @@
large_io = 0;
#endif
#ifdef LARGEIOS
- if ((*offp & 4095) || (size & 4095)) {
- /* if it's not 4kb, then 512 */
+ if ((*offp & ~PAGE_MASK) || (size & ~PAGE_MASK)) {
+ /* if it's not PAGE_SIZE, then sect_size */
if ((*offp & sector_mask) || (size & sector_mask))
/* if not, then fail, we need either to do dio */
return err;
max_sectors = KIO_MAX_SECTORS; /* for 2.4.9 - 1024 */
- } /* ok we 're 4kb aligned, lets see if the buffer is */
+ } /* ok we 're PAGE_SIZE aligned, lets see if the buffer is */
else {
- if (!((unsigned long) buf & 4095)) {
- /* yippie we are .. we can do 4kb size io's */
+ if (!((unsigned long) buf & ~PAGE_MASK)) {
+ /* yippie we are .. we can do PAGE_SIZE size io's */
large_io = 1;
/* for 2.4.9 */
- max_sectors = KIO_MAX_SECTORS / 8;
+ max_sectors = KIO_MAX_SECTORS / sectors_per_page;
} else {
max_sectors = KIO_MAX_SECTORS;
large_io = 0;
@@ -1418,7 +1418,7 @@
doio:
size = totalioblocks << sector_bits;
if (large_io)
- nbhs = (size >> 12);
+ nbhs = (size >> PAGE_SHIFT);
else
nbhs = (size >> sector_bits);
if (nbhs > max_sectors)
@@ -1447,10 +1447,10 @@
totalioblocks = 0;
while (size > 0) {
if (large_io) {
- blocks = size >> 12;
+ blocks = size >> PAGE_SHIFT;
if (blocks > max_sectors)
blocks = max_sectors;
- iosize = blocks << 12;
+ iosize = blocks << PAGE_SHIFT;
} else {
blocks = size >> sector_bits;
if (blocks > max_sectors)
@@ -1467,22 +1467,22 @@
OCFS_KIO_BLOCKS(iobuf)[0] = firstphys + totalioblocks;
if (large_io) {
- blocknr+=8;
- OCFS_KIO_BLOCKS(iobuf)[0] = OCFS_KIO_BLOCKS(iobuf)[0] / 8;
+ blocknr += sectors_per_page;
+ OCFS_KIO_BLOCKS(iobuf)[0] = OCFS_KIO_BLOCKS(iobuf)[0] / sectors_per_page;
} else {
blocknr++;
}
for (i = 1; i < blocks; i++) {
if (large_io) {
- blocknr+=8;
+ blocknr += sectors_per_page;
} else {
blocknr++;
}
OCFS_KIO_BLOCKS(iobuf)[i] = OCFS_KIO_BLOCKS(iobuf)[0] + i;
}
err = brw_kiovec (rw, 1, &iobuf, inode->i_dev, OCFS_KIO_BLOCKS(iobuf),
- large_io ? 4096 : sector_size);
+ large_io ? PAGE_SIZE : sector_size);
#ifdef SUSE
if (rw == READ && err > 0)
mark_dirty_kiobuf(iobuf, err);
@@ -1492,7 +1492,8 @@
size -= err;
buf += err;
if (large_io) {
- totalioblocks += (blocks * 8);
+ totalioblocks +=
+ (blocks * sectors_per_page);
} else {
totalioblocks += blocks;
}
@@ -1551,7 +1552,7 @@
int ocfs_kvec_rw(struct file *filp, int rw, kvec_cb_t cb, size_t size, loff_t pos)
{
- int err = 0;
+ int err = 0;
int max_sectors = 25000;
struct inode *inode = filp->f_dentry->d_inode;
unsigned long blocknr, blocks, iosize,myiosize;
@@ -1560,9 +1561,9 @@
unsigned long blocks_end_cluster = 0;
/* FIXME: Need to differentiate betwen sectors and blocksize */
- int sector_bits = 9;
- int sector_size = 512;
- int sector_mask = 511;
+ int sector_bits = OCFS_SB(inode->i_sb)->sect_size_bits;
+ int sector_size = OCFS_SB(inode->i_sb)->sect_size;
+ int sector_mask = sector_size - 1;
int ret;
unsigned long firstlogic;
@@ -1598,7 +1599,7 @@
iosize = blocks << sector_bits;
clustersize = inode->i_blksize >> sector_bits;
blocks_end_cluster = clustersize - (blocknr % clustersize);
- myiosize = size >> 9;
+ myiosize = size >> sector_bits;
firstlogic = blocknr;
totalioblocks = 0;
Modified: branches/s_blocksize/src/journal.c
===================================================================
--- branches/s_blocksize/src/journal.c 2004-06-14 01:52:45 UTC (rev 1085)
+++ branches/s_blocksize/src/journal.c 2004-06-14 02:14:41 UTC (rev 1086)
@@ -857,8 +857,8 @@
init_MUTEX(&(osb->journal.commit_sem));
journal_file_id = (__u32) (OCFS_JOURNAL_FILE + osb->node_num);
- lock_id = ((OCFS_JOURNAL_FILE + osb->node_num) * osb->sect_size) +
- osb->vol_layout.root_int_off;
+ lock_id = (journal_file_id << osb->sb->s_blocksize_bits) +
+ osb->vol_layout.root_int_off;
/* Ok, look up the inode for our journal */
inode = ocfs_iget(osb, lock_id, NULL);
Modified: branches/s_blocksize/src/osb.c
===================================================================
--- branches/s_blocksize/src/osb.c 2004-06-14 01:52:45 UTC (rev 1085)
+++ branches/s_blocksize/src/osb.c 2004-06-14 02:14:41 UTC (rev 1086)
@@ -38,17 +38,11 @@
int ocfs_initialize_osb (ocfs_super * osb, ocfs_vol_disk_hdr * vdh, ocfs_vol_label * vol_label, __u32 sect_size)
{
int status = 0;
- ocfs_publish *publish = NULL;
- __u32 bitmap_bits, length;
- __u64 offset;
ocfs_vol_layout *vol_layout;
- struct buffer_head *publish_bh = NULL; /* our own publish sector */
- struct buffer_head *publish_bhs[OCFS_MAXIMUM_NODES]; /* all the publish sectors */
int i;
LOG_ENTRY ();
- memset(publish_bhs, 0, OCFS_MAXIMUM_NODES * sizeof (struct buffer_head *));
if (osb == NULL) {
LOG_ERROR_STATUS(status = -EFAIL);
goto finally;
@@ -56,9 +50,6 @@
OCFS_CLEAR_FLAG (osb->osb_flags, OCFS_OSB_FLAGS_SHUTDOWN);
- vol_layout = &(osb->vol_layout);
-
- vol_layout->cluster_size = (__u32) (vdh->cluster_size);
osb->obj_id.type = OCFS_TYPE_OSB;
osb->obj_id.size = sizeof (ocfs_super);
INIT_LIST_HEAD (&(osb->osb_next));
@@ -106,6 +97,8 @@
osb->node_num = OCFS_INVALID_NODE_NUM;
+ vol_layout = &(osb->vol_layout);
+
memcpy (vol_layout->mount_point, vdh->mount_point, strlen (vdh->mount_point));
vol_layout->serial_num = vdh->serial_num;
vol_layout->size = (__u64) (vdh->device_size);
@@ -118,6 +111,7 @@
vol_layout->root_int_off = vdh->internal_off;
vol_layout->root_size = vdh->root_size;
vol_layout->cluster_size = (__u32) vdh->cluster_size;
+ vol_layout->blocksize_bits = le32_to_cpu(vdh->blocksize_bits);
vol_layout->num_nodes = (__u32) vdh->num_nodes;
vol_layout->data_start_off = vdh->data_start_off;
vol_layout->root_bitmap_size = vdh->root_bitmap_size;
@@ -131,10 +125,9 @@
vol_layout->uid = vdh->uid;
vol_layout->gid = vdh->gid;
+ memcpy(vol_layout->vol_id, vol_label->vol_id,
+ MAX_VOL_ID_LENGTH);
-
- memcpy (vol_layout->vol_id, vol_label->vol_id, MAX_VOL_ID_LENGTH);
-
if (vol_layout->dir_node_size == 0)
vol_layout->dir_node_size = OCFS_DEFAULT_DIR_NODE_SIZE;
@@ -146,37 +139,71 @@
osb->cluster_size_bits = ocfs_get_right_shift_bits(vol_layout->cluster_size);
osb->dir_alloc_bits = ocfs_get_right_shift_bits(vol_layout->dir_node_size);
osb->file_alloc_bits = ocfs_get_right_shift_bits(vol_layout->file_node_size);
- printk("sectbits=%d, clusterbits=%d, dirbits=%d, filebits=%d\n",
- osb->sect_size_bits, osb->cluster_size_bits,
- osb->dir_alloc_bits, osb->file_alloc_bits);
+ printk("sectbits=%d, blockbits=%d, clusterbits=%d, dirbits=%d, filebits=%d\n",
+ osb->sect_size_bits, vol_layout->blocksize_bits,
+ osb->cluster_size_bits, osb->dir_alloc_bits,
+ osb->file_alloc_bits);
OCFS_ASSERT(osb->sect_size_bits);
+ OCFS_ASSERT(vol_layout->blocksize_bits);
OCFS_ASSERT(osb->cluster_size_bits);
OCFS_ASSERT(osb->dir_alloc_bits);
OCFS_ASSERT(osb->file_alloc_bits);
- osb->max_dir_node_ent = (__u32) (vol_layout->dir_node_size >> osb->sect_size_bits) - 2;
+ osb->prealloc_lock = 0;
+
+finally:
+ LOG_EXIT_STATUS (status);
+ return status;
+} /* ocfs_initialize_osb */
+
+
+int ocfs_start_global_bitmap(ocfs_super *osb)
+{
+ int status;
+ __u32 bitmap_bits;
+ ocfs_vol_layout *vol_layout = &osb->vol_layout;
+
+ LOG_ENTRY_ARGS("(0x%p)", osb);
+
+ osb->max_dir_node_ent = (__u32) (vol_layout->dir_node_size >> osb->sb->s_blocksize_bits) - 2;
bitmap_bits = (__u32) vol_layout->num_clusters;
- ocfs_initialize_bitmap (&osb->cluster_bitmap, bitmap_bits, ONE_MEGA_BYTE * 8);
+ ocfs_initialize_bitmap(osb, &osb->cluster_bitmap,
+ bitmap_bits, ONE_MEGA_BYTE * 8);
+
/* read the whole cluster bitmap off disk, even though we only
* need the beginning of it. */
- status = ocfs_read_bhs(osb, vol_layout->bitmap_off, ONE_MEGA_BYTE, osb->cluster_bitmap.chunk, 0, NULL);
- if (status < 0) {
+ status = ocfs_read_bhs(osb, vol_layout->bitmap_off,
+ ONE_MEGA_BYTE, osb->cluster_bitmap.chunk,
+ 0, NULL);
+ if (status < 0)
LOG_ERROR_STATUS (status);
- goto bail;
- }
- osb->prealloc_lock = 0;
+ LOG_EXIT_STATUS (status);
+ return status;
+} /* ocfs_start_global_bitmap */
- osb->cfg_numblocks = OCFS_MAXIMUM_NODES + OCFS_VOLCFG_NEWCFG_SECTORS;
- osb->cfg_len = osb->cfg_numblocks * osb->sect_size;
- osb->cfg_bhs = ocfs_malloc (osb->cfg_numblocks
- * sizeof(struct buffer_head *));
+
+int ocfs_start_publish(ocfs_super *osb)
+{
+ int status, i;
+ __u32 length;
+ __u64 offset;
+ ocfs_vol_layout *vol_layout = &osb->vol_layout;
+ ocfs_publish *publish;
+ struct buffer_head *publish_bh = NULL;
+ struct buffer_head *publish_bhs[OCFS_MAXIMUM_NODES]; /* all the publish sectors */
+
+ osb->cfg_numblocks = OCFS_MAXIMUM_NODES +
+ OCFS_VOLCFG_NEWCFG_SECTORS;
+ osb->cfg_len = osb->cfg_numblocks << osb->sb->s_blocksize_bits;
+ osb->cfg_bhs = ocfs_malloc(osb->cfg_numblocks
+ * sizeof(struct buffer_head *));
if (!osb->cfg_bhs) {
- LOG_ERROR_STATUS (status = -ENOMEM);
- goto bail;
+ LOG_ERROR_STATUS(status = -ENOMEM);
+ goto out;
}
memset(osb->cfg_bhs, 0,
osb->cfg_numblocks * sizeof(struct buffer_head *));
@@ -184,37 +211,40 @@
status = ocfs_get_config (osb);
if (status < 0) {
LOG_ERROR_STATUS (status);
- goto finally;
+ goto out;
}
+ memset(publish_bhs, 0, OCFS_MAXIMUM_NODES * sizeof (struct buffer_head *));
+
/* Read the Publish Sector of local Node */
- offset = vol_layout->publ_sect_off + (osb->node_num * osb->sect_size);
+ offset = vol_layout->publ_sect_off +
+ (osb->node_num << osb->sb->s_blocksize_bits);
status = ocfs_read_bh(osb, offset, &publish_bh, 0, NULL);
if (status < 0) {
LOG_ERROR_STATUS (status);
- goto finally;
+ goto out_publish;
}
publish = (ocfs_publish *) OCFS_BH_GET_DATA_WRITE(publish_bh); /* write */
publish->time = ocfs_get_publish_time();
OCFS_BH_PUT_DATA(publish_bh);
- publish = NULL;
status = ocfs_write_bh (osb, publish_bh, 0, NULL);
if (status < 0) {
LOG_ERROR_STATUS (status);
- goto finally;
+ goto out_publish;
}
brelse(publish_bh);
+ publish_bh = NULL;
/* Read disk for all Publish Sectors */
- length = OCFS_MAXIMUM_NODES * osb->sect_size;
+ length = OCFS_MAXIMUM_NODES * osb->sb->s_blocksize;
status = ocfs_read_bhs(osb, vol_layout->publ_sect_off, length,
publish_bhs, 0, NULL);
if (status < 0) {
LOG_ERROR_STATUS (status);
- goto finally;
+ goto out_publish;
}
ocfs_update_publish_map (osb, publish_bhs, 1);
@@ -222,13 +252,28 @@
for(i = 0; i < OCFS_MAXIMUM_NODES; i++)
osb->last_publ_seq_num[i] = (__u64) (-1);
- /* init the inode hash */
- status = ocfs_inode_hash_init(osb);
- if (status < 0) {
- LOG_ERROR_STATUS (status);
- goto finally;
+out_publish:
+ if (publish_bh) {
+ OCFS_BH_PUT_DATA(publish_bh);
+ brelse(publish_bh);
}
+ if (publish_bhs[0]) {
+ int i;
+ for(i = 0; i < OCFS_MAXIMUM_NODES; i++)
+ if (publish_bhs[i])
+ brelse(publish_bhs[i]);
+ }
+out:
+ LOG_EXIT_STATUS (status);
+ return status;
+} /* ocfs_start_publish() */
+
+
+int ocfs_insert_osb(ocfs_super *osb)
+{
+ int status = 0;
+
/* We might need to add a variable in Global List of osb to */
/* delay any creation, if any other node is already creating a file */
@@ -246,34 +291,11 @@
if (osb_id < OCFS_MAX_OSB_ID)
osb_id++;
else {
- spin_unlock (&osb_id_lock);
LOG_ERROR_STR ("Too many volumes mounted");
status = -ENOMEM;
- goto bail;
}
spin_unlock (&osb_id_lock);
-
- /* skip the frees which happen on error only */
- goto finally;
-
-bail:
- ocfs_safefree (osb->cfg_bhs);
-
-finally:
- if (publish) {
- if (publish_bh) {
- OCFS_BH_PUT_DATA(publish_bh);
- brelse(publish_bh);
- }
- }
- if (publish_bhs[0]) {
- int i;
- for(i = 0; i < OCFS_MAXIMUM_NODES; i++)
- if (publish_bhs[i])
- brelse(publish_bhs[i]);
- }
-
LOG_EXIT_STATUS (status);
return status;
} /* ocfs_initialize_osb */
Modified: branches/s_blocksize/src/super.c
===================================================================
--- branches/s_blocksize/src/super.c 2004-06-14 01:52:45 UTC (rev 1085)
+++ branches/s_blocksize/src/super.c 2004-06-14 02:14:41 UTC (rev 1086)
@@ -26,6 +26,7 @@
#include "inc/ocfs.h"
#include <linux/utsname.h>
+#include <linux/blkdev.h>
#define OCFS_DEBUG_CONTEXT OCFS_DEBUG_CONTEXT_SUPER
@@ -158,7 +159,7 @@
};
static inline int ocfs_set_blocksize(struct super_block *sb,
- int blksize, int blksize_bits)
+ int blksize)
{
int status = 0;
@@ -168,7 +169,7 @@
#else
/* TODO: fix this */
sb->s_blocksize = blksize;
- sb->s_blocksize_bits = blksize_bits;
+ sb->s_blocksize_bits = ocfs_get_right_shift_bits(blksize);
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,18)
status = set_blocksize (sb->s_dev, blksize);
#else
@@ -179,6 +180,19 @@
return status;
}
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
+static inline int ocfs_hardsect_size(struct block_device *bdev)
+{
+ return bdev_hardsect_size(bdev);
+}
+#else
+static inline int ocfs_hardsect_size(dev_t dev)
+{
+ return get_hardsect_size(dev);
+}
+#endif /* 2.6.0 */
+
+
/*
* ocfs_init_system_inodes()
*/
@@ -849,8 +863,9 @@
LOG_ENTRY ();
- /* Force 512B sector size for vol_header reads */
- status = ocfs_set_blocksize(sb, 512, 9);
+ sect_size = ocfs_hardsect_size(OCFS_GET_BLOCKDEV(sb));
+ printk("hardsect_size = %d\n", sect_size);
+ status = ocfs_set_blocksize(sb, sect_size);
if (status < 0) {
LOG_ERROR_STR("unable to set vol_header blocksize");
goto leave;
@@ -858,7 +873,7 @@
/* get first two blocks */
for (i=0; i<2; i++) {
- bhs[i] = getblk (OCFS_GET_BLOCKDEV(sb), i, 512);
+ bhs[i] = getblk (OCFS_GET_BLOCKDEV(sb), i, sect_size);
if (bhs[i] == NULL) {
LOG_ERROR_STATUS(status = -EIO);
goto leave;
@@ -893,11 +908,8 @@
OCFS_GENERIC_SB_MEMBER(sb) = osb;
osb->sb = sb;
-
osb->reclaim_id = reclaim_id;
- /* FIXME: here it should use the actual blocksize */
- sect_size = OCFS_SECTOR_SIZE;
status = ocfs_initialize_osb (osb, vol_header, vol_label,
sect_size);
if (status < 0) {
@@ -906,18 +918,42 @@
}
/* Now set real blocksize */
- status = ocfs_set_blocksize(sb, osb->sect_size,
- osb->sect_size_bits);
+ status = ocfs_set_blocksize(sb, 1 << osb->vol_layout.blocksize_bits);
if (status < 0) {
LOG_ERROR_STR("unable to set final blocksize");
goto leave;
}
+ printk("Blocksize %lu\n", sb->s_blocksize);
OCFS_BH_PUT_DATA(bhs[0]);
vol_header = NULL;
OCFS_BH_PUT_DATA(bhs[1]);
vol_label = NULL;
+ status = ocfs_start_global_bitmap(osb);
+ if (status < 0) {
+ LOG_ERROR_STR("unable to start the global bitmap");
+ goto leave;
+ }
+
+ status = ocfs_start_publish(osb);
+ if (status < 0) {
+ LOG_ERROR_STR("unable to initialize publish structurs");
+ goto leave;
+ }
+
+ status = ocfs_inode_hash_init(osb);
+ if (status < 0) {
+ LOG_ERROR_STR("unable to init the inode hash");
+ goto leave;
+ }
+
+ status = ocfs_insert_osb(osb);
+ if (status < 0) {
+ LOG_ERROR_STR("unable to insert osb");
+ goto leave;
+ }
+
down(&(osb->osb_res));
/* Launch the NM thread for the mounted volume */
Modified: branches/s_blocksize/src/sysfile.c
===================================================================
--- branches/s_blocksize/src/sysfile.c 2004-06-14 01:52:45 UTC (rev 1085)
+++ branches/s_blocksize/src/sysfile.c 2004-06-14 02:14:41 UTC (rev 1086)
@@ -425,7 +425,7 @@
}
size *= sizeof (ocfs_io_runs);
}
- size = OCFS_SECTOR_ALIGN (size);
+ size = OCFS_ALIGN(size, osb->sect_size);
IoRuns = vmalloc(size);
if (IoRuns == NULL) {
More information about the Ocfs2-commits
mailing list