[Ocfs2-commits] jlbec commits r1036 - in trunk/src: . inc
svn-commits at oss.oracle.com
svn-commits at oss.oracle.com
Wed Jun 9 06:40:12 CDT 2004
Author: jlbec
Date: 2004-06-09 05:40:10 -0500 (Wed, 09 Jun 2004)
New Revision: 1036
Modified:
trunk/src/alloc.c
trunk/src/dlm.c
trunk/src/inc/ocfs.h
trunk/src/journal.c
trunk/src/nm.c
trunk/src/proc.c
trunk/src/super.c
trunk/src/volcfg.c
trunk/src/vote.c
Log:
o Merged 1035 from format-changes branch:
- [1035] ocfs_safefree is pining for the fjords
Modified: trunk/src/alloc.c
===================================================================
--- trunk/src/alloc.c 2004-06-09 10:24:49 UTC (rev 1035)
+++ trunk/src/alloc.c 2004-06-09 10:40:10 UTC (rev 1036)
@@ -131,7 +131,7 @@
if (tmpstat)
status = tmpstat;
list_del(&(log->log_list));
- ocfs_safefree(log);
+ kfree(log);
f->num_logs--;
}
@@ -409,6 +409,7 @@
ocfs_commit_trans(handle);
handle = NULL;
+
abort:
if (handle)
ocfs_abort_trans(handle);
@@ -442,12 +443,16 @@
finally:
- for (i = 0; i < OCFS_MAXIMUM_NODES; i++) {
- if (extnode_inode[i]) {
- up(&OCFS_I(extnode_inode[i])->ip_io_sem);
- iput(extnode_inode[i]);
+ if (extnode_inode) {
+ for (i = 0; i < OCFS_MAXIMUM_NODES; i++) {
+ if (extnode_inode[i]) {
+ up(&OCFS_I(extnode_inode[i])->ip_io_sem);
+ iput(extnode_inode[i]);
+ }
}
+ kfree(extnode_inode);
}
+
if (vol_inode) {
up(&OCFS_I(vol_inode)->ip_io_sem);
iput(vol_inode);
@@ -456,16 +461,17 @@
if (globalbh)
brelse(globalbh);
- for (i = 0; i < OCFS_MAXIMUM_NODES; i++) {
- ocfs_safefree (free_ext_node[i]);
+ if (free_ext_node) {
+ for (i = 0; i < OCFS_MAXIMUM_NODES; i++) {
+ if (free_ext_node[i])
+ kfree(free_ext_node[i]);
+ }
+ kfree(free_ext_node);
}
- ocfs_safefree (free_ext_node);
-
- ocfs_safefree (extnode_inode);
+ if (free_vol_bits)
+ kfree(free_vol_bits);
- ocfs_safefree (free_vol_bits);
-
LOG_EXIT_STATUS (status);
return status;
} /* ocfs_free_disk_bitmap */
Modified: trunk/src/dlm.c
===================================================================
--- trunk/src/dlm.c 2004-06-09 10:24:49 UTC (rev 1035)
+++ trunk/src/dlm.c 2004-06-09 10:40:10 UTC (rev 1036)
@@ -159,7 +159,7 @@
if (bhs != NULL) {
for (i = 0; i < numnodes; i++)
brelse(bhs[i]);
- ocfs_safefree(bhs);
+ kfree(bhs);
}
if (status >= 0) {
@@ -406,7 +406,7 @@
if (bhs != NULL) {
for (i=0; i < numnodes; i++)
brelse(bhs[i]);
- ocfs_safefree(bhs);
+ kfree(bhs);
}
LOG_EXIT_STATUS (status);
return (status);
Modified: trunk/src/inc/ocfs.h
===================================================================
--- trunk/src/inc/ocfs.h 2004-06-09 10:24:49 UTC (rev 1035)
+++ trunk/src/inc/ocfs.h 2004-06-09 10:40:10 UTC (rev 1036)
@@ -187,20 +187,7 @@
/* convenience macro */
-#define ocfs_safefree(x) \
-do { \
- if (x) \
- ocfs_free(x); \
- (x) = NULL; \
-} while (0)
-#define ocfs_safevfree(x) \
-do { \
- if (x) \
- vfree(x); \
- (x) = NULL; \
-} while (0)
-
#define OCFS_ASSERT(x) do { if (!(x)) BUG(); } while (0)
@@ -1868,15 +1855,14 @@
ocfs_free_rec *log;
struct list_head *p, *n;
- if ((f) && ((f)->num_logs)) {
- list_for_each_safe(p, n, &((f)->free_logs)) {
+ if (f && (f->num_logs)) {
+ list_for_each_safe(p, n, &(f->free_logs)) {
log = list_entry(p, ocfs_free_rec, log_list);
list_del(&(log->log_list));
ocfs_free(log);
}
+ kfree(f);
}
- ocfs_safefree((f));
- return;
}
static inline unsigned int ocfs_clusters_for_bytes(struct super_block *sb,
Modified: trunk/src/journal.c
===================================================================
--- trunk/src/journal.c 2004-06-09 10:24:49 UTC (rev 1035)
+++ trunk/src/journal.c 2004-06-09 10:40:10 UTC (rev 1036)
@@ -166,8 +166,8 @@
if (retval) {
if (retval->buffs)
- ocfs_safefree(retval->buffs);
- ocfs_safefree(retval);
+ kfree(retval->buffs);
+ kfree(retval);
}
LOG_EXIT_PTR(NULL);
return(NULL);
Modified: trunk/src/nm.c
===================================================================
--- trunk/src/nm.c 2004-06-09 10:24:49 UTC (rev 1035)
+++ trunk/src/nm.c 2004-06-09 10:40:10 UTC (rev 1036)
@@ -99,7 +99,7 @@
status = ocfs_recv_udp_msg (recv_ctxt);
if (status < 0) {
- ocfs_safefree (recv_ctxt);
+ kfree(recv_ctxt);
if (status != -EBADF) {
LOG_ERROR_STATUS (status);
} else {
Modified: trunk/src/proc.c
===================================================================
--- trunk/src/proc.c 2004-06-09 10:24:49 UTC (rev 1035)
+++ trunk/src/proc.c 2004-06-09 10:40:10 UTC (rev 1036)
@@ -213,7 +213,8 @@
ret = ocfs_proc_calc_metrics (page, start, off, count, eof, len);
bail:
- ocfs_safefree (tmpstr);
+ if (tmpstr)
+ kfree(tmpstr);
LOG_EXIT_LONG (ret);
return ret;
} /* ocfs_proc_memallocs */
@@ -488,8 +489,10 @@
}
bail:
- ocfs_safefree (tmp);
- ocfs_safefree (newdir);
+ if (tmp)
+ kfree(tmp);
+ if (newdir)
+ kfree(newdir);
LOG_EXIT ();
return;
} /* ocfs_proc_add_volume */
@@ -520,7 +523,8 @@
remove_proc_entry (tmp, NULL);
bail:
- ocfs_safefree (tmp);
+ if (tmp)
+ kfree(tmp);
LOG_EXIT ();
return;
} /* ocfs_proc_remove_volume */
@@ -602,7 +606,8 @@
ret = ocfs_proc_calc_metrics (page, start, off, count, eof, len);
bail:
- ocfs_safefree (pubmap);
+ if (pubmap)
+ kfree(pubmap);
LOG_EXIT_INT (ret);
return ret;
} /* ocfs_proc_statistics */
Modified: trunk/src/super.c
===================================================================
--- trunk/src/super.c 2004-06-09 10:24:49 UTC (rev 1035)
+++ trunk/src/super.c 2004-06-09 10:40:10 UTC (rev 1036)
@@ -1185,13 +1185,14 @@
BARF_BARF_BARF *p;
p = osb->node_cfg_info[i];
- ocfs_safefree (p);
+ if (p)
+ kfree(p);
}
ocfs_release_system_inodes(osb);
ocfs_delete_osb (osb);
- ocfs_safefree (osb);
+ kfree(osb);
sb->s_dev = 0;
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0)
@@ -1352,13 +1353,13 @@
LOG_ENTRY ();
- /* FIXME
- * This should be done in ocfs_journal_init(), but unknown
- * ordering issues will cause the filesystem to crash.
- * If anyone wants to figure out what part of the code
- * refers to osb->journal before ocfs_journal_init() is run,
- * be my guest.
- */
+ /* FIXME
+ * This should be done in ocfs_journal_init(), but unknown
+ * ordering issues will cause the filesystem to crash.
+ * If anyone wants to figure out what part of the code
+ * refers to osb->journal before ocfs_journal_init() is run,
+ * be my guest.
+ */
/* initialize our journal structure */
osb->journal = kmalloc(sizeof(ocfs_journal), GFP_KERNEL);
if (!osb->journal) {
@@ -1572,7 +1573,8 @@
goto finally;
bail:
- ocfs_safefree (osb->cfg_bhs);
+ if (osb->cfg_bhs)
+ kfree(osb->cfg_bhs);
finally:
if (publish) {
@@ -1757,17 +1759,19 @@
for (i=0; i<32; i++)
ocfs_recover_oin_locks(osb, i);
- for(i = 0; i < osb->cfg_numblocks; i++)
- if (osb->cfg_bhs[i])
- brelse(osb->cfg_bhs[i]);
- ocfs_safefree(osb->cfg_bhs);
+ if (osb->cfg_bhs) {
+ for(i = 0; i < osb->cfg_numblocks; i++)
+ if (osb->cfg_bhs[i])
+ brelse(osb->cfg_bhs[i]);
+ kfree(osb->cfg_bhs);
+ }
- /* FIXME
- * This belongs in journal shutdown, but because we have to
- * allocate osb->journal at the start of ocfs_initalize_osb(),
- * we free it here.
- */
- kfree(osb->journal);
+ /* FIXME
+ * This belongs in journal shutdown, but because we have to
+ * allocate osb->journal at the start of ocfs_initalize_osb(),
+ * we free it here.
+ */
+ kfree(osb->journal);
memset (osb, 0, sizeof (ocfs_super));
Modified: trunk/src/volcfg.c
===================================================================
--- trunk/src/volcfg.c 2004-06-09 10:24:49 UTC (rev 1035)
+++ trunk/src/volcfg.c 2004-06-09 10:40:10 UTC (rev 1036)
@@ -447,7 +447,8 @@
finito:
ocfs_release_disk_lock (osb, lock_off);
- ocfs_safefree (cfg_task);
+ if (cfg_task)
+ kfree(cfg_task);
if (bh)
brelse(bh);
@@ -571,7 +572,8 @@
}
bail:
- ocfs_safefree (buffer);
+ if (buffer)
+ kfree(buffer);
LOG_EXIT_STATUS (status);
return status;
@@ -865,7 +867,7 @@
for (i = 0; i < numblocks; i++)
if (cfg_bhs[i])
brelse(cfg_bhs[i]);
- ocfs_safefree(cfg_bhs);
+ kfree(cfg_bhs);
}
LOG_EXIT_STATUS (status);
@@ -997,7 +999,8 @@
}
bail:
- ocfs_safefree(buffer);
+ if (buffer)
+ kfree(buffer);
LOG_EXIT_STATUS (status);
return status;
} /* ocfs_refresh_node_config */
Modified: trunk/src/vote.c
===================================================================
--- trunk/src/vote.c 2004-06-09 10:24:49 UTC (rev 1035)
+++ trunk/src/vote.c 2004-06-09 10:40:10 UTC (rev 1036)
@@ -53,7 +53,7 @@
{
spin_lock(&vote_obj_lock);
if (atomic_dec_and_test(&obj->refcount))
- ocfs_safefree (obj);
+ kfree(obj);
spin_unlock(&vote_obj_lock);
}
@@ -608,7 +608,7 @@
ocfs_comm_process_msg (dlm_packet);
}
- ocfs_safefree (recv_ctxt);
+ kfree(recv_ctxt);
LOG_EXIT ();
return;
More information about the Ocfs2-commits
mailing list