[Ocfs2-commits] manish commits r1055 - branches/format-changes/src
svn-commits at oss.oracle.com
svn-commits at oss.oracle.com
Fri Jun 11 17:24:51 CDT 2004
Author: manish
Date: 2004-06-11 16:24:49 -0500 (Fri, 11 Jun 2004)
New Revision: 1055
Modified:
branches/format-changes/src/inode.c
branches/format-changes/src/super.c
branches/format-changes/src/sysfile.c
Log:
Removed many unnecessary initializations. Also some cosmetic cleanups
Modified: branches/format-changes/src/inode.c
===================================================================
--- branches/format-changes/src/inode.c 2004-06-11 21:22:09 UTC (rev 1054)
+++ branches/format-changes/src/inode.c 2004-06-11 21:24:49 UTC (rev 1055)
@@ -331,7 +331,7 @@
*/
int ocfs_inode_init_private(struct inode *inode)
{
- ocfs_inode_private *i = NULL;
+ ocfs_inode_private *i;
if (!inode)
BUG();
@@ -865,9 +865,9 @@
int block, int create, int *err, int reada)
{
struct buffer_head * bh = NULL;
- int fatal = 0, tmperr = 0, new = 0;
- ocfs_super *osb = NULL;
- __s64 vbo = 0LL, lbo = 0LL;
+ int fatal = 0, tmperr, new = 0;
+ ocfs_super *osb;
+ __s64 vbo, lbo;
int readflags = OCFS_BH_CACHED;
osb = OCFS_SB(inode->i_sb);
Modified: branches/format-changes/src/super.c
===================================================================
--- branches/format-changes/src/super.c 2004-06-11 21:22:09 UTC (rev 1054)
+++ branches/format-changes/src/super.c 2004-06-11 21:24:49 UTC (rev 1055)
@@ -244,7 +244,7 @@
new = ocfs_get_system_file_inode(osb, i, osb->node_num);
if (!new) {
ocfs_release_system_inodes(osb);
- LOG_ERROR_STATUS(status=-EINVAL);
+ LOG_ERROR_STATUS(status = -EINVAL);
goto bail;
}
osb->system_inodes[i] = new;
@@ -265,16 +265,18 @@
LOG_ENTRY();
- for (i=0; i<NUM_SYSTEM_INODES; i++) {
+ for (i = 0; i < NUM_SYSTEM_INODES; i++) {
if (osb->system_inodes[i]) {
iput(osb->system_inodes[i]);
osb->system_inodes[i] = NULL;
}
}
+
if (osb->sys_root_inode) {
iput(osb->sys_root_inode);
osb->sys_root_inode = NULL;
}
+
LOG_EXIT_STATUS(status);
return(status);
} /* ocfs_release_system_inodes */
@@ -466,15 +468,16 @@
*/
static int __init ocfs_driver_entry (void)
{
- int status = 0;
+ int status;
LOG_ENTRY ();
ocfs_version_print();
ocfs_hostname = kmalloc(strlen(system_utsname.nodename) + 1, GFP_KERNEL);
- if (ocfs_hostname==NULL)
+ if (ocfs_hostname == NULL)
return -EINVAL;
+
strcpy(ocfs_hostname, system_utsname.nodename);
printk("ocfs2: hostname is %s\n", ocfs_hostname);
@@ -694,12 +697,12 @@
static int ocfs_statfs (struct super_block *sb, struct statfs *buf)
#endif
{
- ocfs_super *osb = NULL;
+ ocfs_super *osb;
__u32 numbits, freebits;
unsigned int reserved_bits;
- int status = 0;
- ocfs2_dinode *bm_lock = NULL;
- struct buffer_head *bh = NULL;
+ int status;
+ ocfs2_dinode *bm_lock;
+ struct buffer_head *bh;
LOG_ENTRY_ARGS ("(%p, %p)\n", sb, buf);
@@ -714,6 +717,7 @@
bm_lock = OCFS_BH_GET_DATA_READ(bh);
freebits = numbits = osb->cluster_bitmap.validbits;
+
if (numbits >= bm_lock->u.i_bitinfo.b_used)
freebits -= bm_lock->u.i_bitinfo.b_used;
@@ -800,13 +804,13 @@
*/
static int ocfs_mount_volume (struct super_block *sb, int reclaim_id, struct inode *root)
{
- int status = 0;
- ocfs_super *osb = NULL;
+ int status;
+ ocfs_super *osb;
ocfs_vol_disk_hdr *vol_header = NULL;
ocfs_vol_label *vol_label = NULL;
int child_pid, i, sect_size;
struct buffer_head *bhs[] = { NULL, NULL };
- struct inode *inode = NULL;
+ struct inode *inode;
LOG_ENTRY ();
@@ -818,7 +822,7 @@
}
/* get first two blocks */
- for (i=0; i<2; i++) {
+ for (i = 0; i < 2; i++) {
bhs[i] = getblk (OCFS_GET_BLOCKDEV(sb), i, 512);
if (bhs[i] == NULL) {
LOG_ERROR_STATUS(status = -EIO);
@@ -832,7 +836,7 @@
}
ll_rw_block(READ, 2, bhs);
- for (i=0; i<2; i++)
+ for (i = 0; i < 2; i++)
wait_on_buffer(bhs[i]);
vol_header = OCFS_BH_GET_DATA_READ(bhs[0]);
@@ -1018,7 +1022,7 @@
*/
int ocfs_dismount_volume (struct super_block *sb)
{
- int status = 0;
+ int status;
int AcquiredOSB = 0;
ocfs_super *osb = NULL;
int i;
@@ -1032,7 +1036,7 @@
osb = OCFS_SB(sb);
- if ( osb == NULL) {
+ if (osb == NULL) {
LOG_ERROR_STATUS (status = -EFAIL);
goto leave;
}
@@ -1163,10 +1167,10 @@
/* true if mounted, false otherwise */
int ocfs_publish_get_mount_state(ocfs_super *osb, int node_num)
{
- int status = 0;
- ocfs_publish *publish = NULL;
- struct buffer_head *publish_bh = NULL;
- __u64 offset = 0;
+ int status;
+ ocfs_publish *publish;
+ struct buffer_head *publish_bh;
+ __u64 offset;
int retval = 0;
int flags = 0;
@@ -1200,10 +1204,10 @@
static int ocfs_publish_toggle_mounted(ocfs_super *osb, int node_num, int value)
{
- int status = 0;
- ocfs_publish *publish = NULL;
+ int status;
+ ocfs_publish *publish;
struct buffer_head * publish_bh = NULL;
- __u64 offset = 0;
+ __u64 offset;
LOG_ENTRY_ARGS("(node_num=%d, value=%d)\n", node_num, value);
Modified: branches/format-changes/src/sysfile.c
===================================================================
--- branches/format-changes/src/sysfile.c 2004-06-11 21:22:09 UTC (rev 1054)
+++ branches/format-changes/src/sysfile.c 2004-06-11 21:24:49 UTC (rev 1055)
@@ -70,10 +70,11 @@
struct inode * ocfs_get_system_file_inode(ocfs_super *osb, int file_type, __u32 node)
{
- struct inode *inode = NULL;
+ struct inode *inode;
// avoid the lookup if cached in local system file array
- if ((node == osb->node_num || file_type==GLOBAL_BITMAP_SYSTEM_INODE) &&
+ if ((node == osb->node_num ||
+ file_type == GLOBAL_BITMAP_SYSTEM_INODE) &&
(inode = osb->system_inodes[file_type]) != NULL) {
// get a ref in addition to the array ref
igrab(inode);
@@ -88,8 +89,8 @@
struct inode *inode = NULL;
__u64 fe_off = 0;
struct buffer_head *dirent_bh = NULL;
- struct ocfs2_dir_entry *de = NULL;
- int status = 0;
+ struct ocfs2_dir_entry *de;
+ int status;
if (file_type == GLOBAL_BITMAP_SYSTEM_INODE)
/* "There Can Be Only One!" */
@@ -126,13 +127,12 @@
*/
int ocfs_read_system_file (ocfs_super * osb, __u32 FileId, struct buffer_head *bhs[], __u64 Length, __u64 Offset)
{
- int status = 0;
+ int status;
ocfs2_dinode *fe = NULL;
void *extentBuffer = NULL;
__u32 numExts = 0, i, j, numblocks;
- ocfs_io_runs *IoRuns = NULL;
- __u64 tmplen;
- __u64 tmpoff = 0;
+ ocfs_io_runs *IoRuns;
+ __u64 tmplen, tmpoff;
struct buffer_head * fe_bh = NULL;
LOG_ENTRY_ARGS ("(FileId = %u, offset = (%llu), "
@@ -208,7 +208,7 @@
*/
__u64 ocfs_file_to_disk_off (ocfs_super * osb, __u32 FileId, __u64 Offset)
{
- int status = 0;
+ int status;
__u64 StartOffset = 0;
void *Buffer = NULL;
ocfs2_dinode *fe = NULL;
@@ -266,7 +266,7 @@
*/
int ocfs_get_system_file_size (ocfs_super * osb, __u32 FileId, __u64 * Length, __u64 * AllocSize)
{
- int status = 0;
+ int status;
ocfs2_dinode *fe = NULL;
__u64 offset;
struct buffer_head *fe_bh = NULL;
More information about the Ocfs2-commits
mailing list