[Ocfs2-commits] mfasheh commits r1138 - in trunk: . src
svn-commits at oss.oracle.com
svn-commits at oss.oracle.com
Thu Jun 17 21:51:17 CDT 2004
Author: mfasheh
Date: 2004-06-17 20:51:16 -0500 (Thu, 17 Jun 2004)
New Revision: 1138
Modified:
trunk/TODO
trunk/src/alloc.c
trunk/src/journal.c
trunk/src/ocfs.h
trunk/src/ocfs_journal.h
trunk/src/super.c
Log:
* use inode locking primitives for the local alloc.
* update to the extend credits to take local alloc syncing into
account.
* check for invalid local alloc sizes.
Modified: trunk/TODO
===================================================================
--- trunk/TODO 2004-06-18 01:35:15 UTC (rev 1137)
+++ trunk/TODO 2004-06-18 01:51:16 UTC (rev 1138)
@@ -27,12 +27,6 @@
values when the inode is passed in too (example: make acquire_lock not take
an offset, as you get that off the inode which is passed in).
-* Local alloc structure needs to be turned into a file entry so creating an
- inode for it is trivial. This way we can use the inodes locking primitives
- instead of special casing stuff and using osb->local_alloc_sem.
- - It's an inode now, but we need to finish making it use inode
- locking primatives.
-
* We need to be able to delete stuff from the inode alloc system file(s).
* Investigate whether we need a seperate sysfile for truncate orphans (in
Modified: trunk/src/alloc.c
===================================================================
--- trunk/src/alloc.c 2004-06-18 01:35:15 UTC (rev 1137)
+++ trunk/src/alloc.c 2004-06-18 01:51:16 UTC (rev 1138)
@@ -3867,6 +3867,7 @@
int status = 0;
__u32 bitswanted;
int use_global = 1;
+ struct inode *local_alloc_inode = NULL;
LOG_ENTRY_ARGS("(file_size = (%llu), handle = 0x%p, sysfile = %s)\n",
file_size, handle, sysfile ? "true" : "false");
@@ -3888,17 +3889,24 @@
&& (file_size <= OCFS_LOCAL_ALLOC_MAX_ALLOC) )
use_global = 0;
- /* TODO: let's find a way to use local alloc for system files someday ;-) */
+ /* TODO: let's find a way to use local alloc for system files
+ * someday ;-) */
if (sysfile)
use_global = 1;
if (!use_global) {
- if (handle->flags & OCFS_HANDLE_LOCAL_ALLOC) {
- printk("whoa, I already have local alloc sem!?!\n");
- BUG();
+ local_alloc_inode =
+ ocfs_get_system_file_inode(osb,
+ LOCAL_ALLOC_SYSTEM_INODE,
+ osb->node_num);
+
+ if (!local_alloc_inode) {
+ status = -EFAIL;
+ LOG_ERROR_STATUS(status);
+ goto bail;
}
- down(&osb->local_alloc_sem);
- handle->flags |= OCFS_HANDLE_LOCAL_ALLOC;
+ ocfs_handle_add_inode(handle, local_alloc_inode);
+
status = ocfs_find_space_from_local(osb, bitswanted,
cluster_off, cluster_count,
handle);
@@ -3931,6 +3939,8 @@
LOG_TRACE_ARGS("Returning *cluster_off = %llu, *cluster_count"
"= %llu\n", *cluster_off, *cluster_count);
bail:
+ if (local_alloc_inode)
+ iput(local_alloc_inode);
LOG_EXIT_STATUS(status);
return(status);
@@ -3974,6 +3984,14 @@
goto bail;
}
+ if (!LOCAL_ALLOC(alloc)->la_size ||
+ (LOCAL_ALLOC(alloc)->la_size > OCFS2_LOCAL_BITMAP_DEFAULT_SIZE)) {
+ LOG_ERROR_ARGS("Local alloc size is invalid (la_size = %u)\n",
+ LOCAL_ALLOC(alloc)->la_size);
+ status = -EINVAL;
+ goto bail;
+ }
+
osb->local_alloc_bh = alloc_bh;
osb->have_local_alloc = 1;
Modified: trunk/src/journal.c
===================================================================
--- trunk/src/journal.c 2004-06-18 01:35:15 UTC (rev 1137)
+++ trunk/src/journal.c 2004-06-18 01:51:16 UTC (rev 1138)
@@ -408,8 +408,6 @@
/* release inode semaphores we took during this transaction */
ocfs_handle_unlock_inodes(handle);
- if (handle->flags & OCFS_HANDLE_LOCAL_ALLOC)
- up(&osb->local_alloc_sem);
/* actually stop the transaction. if we've set h_sync,
* it'll have been commited when we return */
@@ -578,8 +576,6 @@
/* release inode semaphores we took during this transaction */
ocfs_handle_unlock_inodes(handle);
- if (handle->flags & OCFS_HANDLE_LOCAL_ALLOC)
- up(&osb->local_alloc_sem);
/* done copying them, free it now. */
ocfs_handle_free_all_copyout(handle);
Modified: trunk/src/ocfs.h
===================================================================
--- trunk/src/ocfs.h 2004-06-18 01:35:15 UTC (rev 1137)
+++ trunk/src/ocfs.h 2004-06-18 01:51:16 UTC (rev 1138)
@@ -811,8 +811,6 @@
__u64 *last_publ_seq_num;
int have_local_alloc;
struct buffer_head *local_alloc_bh;
- /* Protects local alloc */
- struct semaphore local_alloc_sem;
ocfs_inode_hash inode_hash;
struct semaphore extend_sem;
__u8 check_mounted; /* tell nm to check mounted flag, protected by publish_lock*/
Modified: trunk/src/ocfs_journal.h
===================================================================
--- trunk/src/ocfs_journal.h 2004-06-18 01:35:15 UTC (rev 1137)
+++ trunk/src/ocfs_journal.h 2004-06-18 01:51:16 UTC (rev 1138)
@@ -154,8 +154,6 @@
#define OCFS_HANDLE_CHECKPOINT 1
/* should we sync-commit this handle? */
#define OCFS_HANDLE_SYNC 2
-/* was local alloc used (should we release the sem?) */
-#define OCFS_HANDLE_LOCAL_ALLOC 4
static inline void ocfs_handle_free_all_copyout(ocfs_journal_handle *handle)
{
@@ -330,9 +328,9 @@
/* single file metadata updates * 3 because we might have to extend
* the file alloc and file alloc bitmap files + possible update to
* local bitmap. + 2 blocks for bits to set in the metadata alloc
- * bitmap file */
+ * bitmap file + 8 blocks for local alloc shift(s) */
#define OCFS_FILE_EXTEND_CREDITS (OCFS_SINGLE_FILE_EXTEND_CREDITS * 3 \
- + 1 + 2 + OCFS_JOURNAL_FUZZ_CREDITS)
+ + 1 + 2 + 8 + OCFS_JOURNAL_FUZZ_CREDITS)
/* Now that we journal bitmap writes, this might get a bit more
Modified: trunk/src/super.c
===================================================================
--- trunk/src/super.c 2004-06-18 01:35:15 UTC (rev 1137)
+++ trunk/src/super.c 2004-06-18 01:51:16 UTC (rev 1138)
@@ -1464,7 +1464,6 @@
init_MUTEX (&(osb->extend_sem));
init_MUTEX (&(osb->cfg_lock));
init_MUTEX (&(osb->vote_sem));
- init_MUTEX (&(osb->local_alloc_sem));
spin_lock_init(&osb->recovery_map_lock);
ocfs_node_map_init(osb, &osb->recovery_map);
More information about the Ocfs2-commits
mailing list