From: Martin K. Petersen Date: Wed, 22 Apr 2015 13:35:26 +0000 (-0400) Subject: oracleasm: Various code and whitespace cleanups. X-Git-Tag: v4.1.12-92~323^2~5 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=4abed3a202b4d61090db223ce3b8c3d7e21eea4f;p=users%2Fjedix%2Flinux-maple.git oracleasm: Various code and whitespace cleanups. No functional changes. Signed-off-by: Martin K. Petersen --- diff --git a/drivers/block/oracleasm/Makefile b/drivers/block/oracleasm/Makefile index edac43fe191c..f37ee5978f20 100644 --- a/drivers/block/oracleasm/Makefile +++ b/drivers/block/oracleasm/Makefile @@ -1,5 +1,5 @@ obj-$(CONFIG_ORACLEASM) := oracleasm.o -oracleasm-y += driver.o masklog.o proc.o transaction_file.o +oracleasm-y += driver.o masklog.o transaction_file.o oracleasm-$(CONFIG_BLK_DEV_INTEGRITY) += integrity.o diff --git a/drivers/block/oracleasm/compat.h b/drivers/block/oracleasm/compat.h deleted file mode 100644 index 1c3a2a4e07eb..000000000000 --- a/drivers/block/oracleasm/compat.h +++ /dev/null @@ -1,21 +0,0 @@ -/* -*- mode: c; c-basic-offset: 8; -*- - * vim: noexpandtab sw=8 ts=8 sts=0: - * - * compat.h - * - * Copyright (c) 2004-2009 Oracle Corporation. All rights reserved. - */ - - -#ifndef _COMPAT_H -#define _COMPAT_H - -/* - * Modern kernels don't need this. Older kernels will have it defined - * by the compat code. - */ -#ifndef set_i_blksize -# define set_i_blksize(i, bs) do { /* Nothing */ } while (0) -#endif - -#endif /* _COMPAT_H */ diff --git a/drivers/block/oracleasm/driver.c b/drivers/block/oracleasm/driver.c index af26fbb2eafe..f12b9c93d7b4 100644 --- a/drivers/block/oracleasm/driver.c +++ b/drivers/block/oracleasm/driver.c @@ -83,9 +83,7 @@ #include "linux/oracleasm/module_version.h" -#include "compat.h" #include "masklog.h" -#include "proc.h" #include "transaction_file.h" #include "request.h" #include "integrity.h" @@ -127,6 +125,7 @@ static struct inode_operations asmfs_iid_dir_inode_operations; static struct kmem_cache *asm_request_cachep; static struct kmem_cache *asmfs_inode_cachep; static struct kmem_cache *asmdisk_cachep; +static struct proc_dir_entry *asm_proc; static bool use_logical_block_size = false; module_param(use_logical_block_size, bool, 0644); @@ -516,7 +515,6 @@ static int asmfs_mknod(struct inode *dir, struct dentry *dentry, umode_t mode, d inode->i_mode = mode; inode->i_uid = current_fsuid(); inode->i_gid = current_fsgid(); - set_i_blksize(inode, PAGE_CACHE_SIZE); inode->i_blocks = 0; inode->i_rdev = 0; inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME; @@ -550,7 +548,6 @@ static int asmfs_create(struct inode *dir, struct dentry *dentry, umode_t mode, inode->i_mode = mode; inode->i_uid = current_fsuid(); inode->i_gid = current_fsgid(); - set_i_blksize(inode, PAGE_CACHE_SIZE); inode->i_blocks = 0; inode->i_rdev = 0; inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME; @@ -656,11 +653,9 @@ static int asmfs_remount(struct super_block * sb, int * flags, char * data) reset_limits(asb, ¶ms); - printk(KERN_DEBUG - "ASM: oracleasmfs remounted with options: %s\n", - data ? (char *)data : "" ); - printk(KERN_DEBUG "ASM: maxinstances=%ld\n", - asb->max_inodes); + pr_debug("ASM: oracleasmfs remounted with options: %s\n", + data ? (char *)data : "" ); + pr_debug("ASM: maxinstances=%ld\n", asb->max_inodes); return 0; } @@ -2746,7 +2741,6 @@ static int asmfs_fill_super(struct super_block *sb, inode->i_mode = S_IFDIR | 0755; inode->i_uid = GLOBAL_ROOT_UID; inode->i_gid = GLOBAL_ROOT_GID; - set_i_blksize(inode, PAGE_CACHE_SIZE); inode->i_blocks = 0; inode->i_rdev = 0; inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME; @@ -2849,9 +2843,9 @@ static int asmfs_fill_super(struct super_block *sb, sb->s_root = root; - printk(KERN_DEBUG "ASM: oracleasmfs mounted with options: %s\n", - data ? (char *)data : "" ); - printk(KERN_DEBUG "ASM: maxinstances=%ld\n", asb->max_inodes); + pr_debug("ASM: oracleasmfs mounted with options: %s\n", + data ? (char *)data : "" ); + pr_debug("ASM: maxinstances=%ld\n", asb->max_inodes); return 0; out_genocide: @@ -2899,39 +2893,48 @@ static int __init init_asmfs_fs(void) ret = init_inodecache(); if (ret) { - printk("oracleasmfs: Unable to create asmfs_inode_cache\n"); + pr_err("oracleasmfs: Unable to create asmfs_inode_cache\n"); goto out_inodecache; } ret = init_requestcache(); if (ret) { - printk("oracleasmfs: Unable to create asm_request cache\n"); + pr_err("oracleasmfs: Unable to create asm_request cache\n"); goto out_requestcache; } ret = init_asmdiskcache(); if (ret) { - printk("oracleasmfs: Unable to initialize the disk cache\n"); + pr_err("oracleasmfs: Unable to initialize the disk cache\n"); goto out_diskcache; } - ret = init_oracleasm_proc(); - if (ret) { - printk("oracleasmfs: Unable to register proc entries\n"); + asm_proc = proc_mkdir(ASM_PROC_PATH, NULL); + if (asm_proc == NULL) { + pr_err("oracleasmfs: Unable to register proc directory\n"); goto out_proc; } + ret = mlog_init_proc(asm_proc); + if (ret) { + pr_err("oracleasmfs: Unable to register proc mlog\n"); + goto out_mlog; + } + init_asmfs_dir_operations(); ret = register_filesystem(&asmfs_fs_type); if (ret) { - printk("oracleasmfs: Unable to register filesystem\n"); + pr_err("oracleasmfs: Unable to register filesystem\n"); goto out_register; } return 0; out_register: - exit_oracleasm_proc(); + mlog_remove_proc(asm_proc); + +out_mlog: + remove_proc_entry(ASM_PROC_PATH, NULL); out_proc: destroy_asmdiskcache(); @@ -2949,7 +2952,8 @@ out_inodecache: static void __exit exit_asmfs_fs(void) { unregister_filesystem(&asmfs_fs_type); - exit_oracleasm_proc(); + mlog_remove_proc(asm_proc); + remove_proc_entry(ASM_PROC_PATH, NULL); destroy_asmdiskcache(); destroy_requestcache(); destroy_inodecache(); diff --git a/drivers/block/oracleasm/integrity.c b/drivers/block/oracleasm/integrity.c index 059f5ad237ee..c92b96104ed8 100644 --- a/drivers/block/oracleasm/integrity.c +++ b/drivers/block/oracleasm/integrity.c @@ -23,7 +23,7 @@ * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public * License, version 2 as published by the Free Software Foundation. - * + * * This library 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 diff --git a/drivers/block/oracleasm/proc.c b/drivers/block/oracleasm/proc.c deleted file mode 100644 index d79e0c6e943f..000000000000 --- a/drivers/block/oracleasm/proc.c +++ /dev/null @@ -1,52 +0,0 @@ -/* -*- mode: c; c-basic-offset: 8; -*- - * vim: noexpandtab sw=8 ts=8 sts=0: - * - * Copyright (C) 2006 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, version 2. - * - * 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 -#include - -#include "proc.h" -#include "masklog.h" - -static struct proc_dir_entry *asm_proc; -#define ASM_PROC_PATH "fs/oracleasm" - -int init_oracleasm_proc(void) -{ - int rc; - - asm_proc = proc_mkdir(ASM_PROC_PATH, NULL); - if (asm_proc == NULL) { - rc = -ENOMEM; /* shrug */ - goto out; - } - - rc = mlog_init_proc(asm_proc); - if (rc) - remove_proc_entry(ASM_PROC_PATH, NULL); - -out: - return rc; -} - -void exit_oracleasm_proc(void) -{ - mlog_remove_proc(asm_proc); - remove_proc_entry(ASM_PROC_PATH, NULL); -} diff --git a/drivers/block/oracleasm/proc.h b/drivers/block/oracleasm/proc.h deleted file mode 100644 index 38aedfddd08b..000000000000 --- a/drivers/block/oracleasm/proc.h +++ /dev/null @@ -1,27 +0,0 @@ -/* -*- mode: c; c-basic-offset: 8; -*- - * vim: noexpandtab sw=8 ts=8 sts=0: - * - * Copyright (C) 2006 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, version 2. - * - * 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 __ASM_PROC_H -#define __ASM_PROC_H - -int init_oracleasm_proc(void); -void exit_oracleasm_proc(void); - -#endif /* _ASM_PROC_H */ diff --git a/drivers/block/oracleasm/transaction_file.c b/drivers/block/oracleasm/transaction_file.c index dd368f369b2d..bdb809d4bfd3 100644 --- a/drivers/block/oracleasm/transaction_file.c +++ b/drivers/block/oracleasm/transaction_file.c @@ -19,11 +19,10 @@ #include #include "transaction_file.h" -#include "compat.h" #define TRANSACTION_CONTEXT(i) ((i)->i_private) -/* an argresp is stored in an allocated page and holds the +/* an argresp is stored in an allocated page and holds the * size of the argument or response, along with its content */ struct argresp { @@ -34,7 +33,7 @@ struct argresp { /* * transaction based IO methods. * The file expects a single write which triggers the transaction, and then - * possibly a read which collects the result - which is stored in a + * possibly a read which collects the result - which is stored in a * file-local buffer. */ static ssize_t TA_write(struct file *file, const char *buf, size_t size, loff_t *pos) @@ -46,7 +45,7 @@ static ssize_t TA_write(struct file *file, const char *buf, size_t size, loff_t if (!tctxt || !tctxt->write_op) return -EINVAL; - if (file->private_data) + if (file->private_data) return -EINVAL; /* only one write allowed per open */ if (size > PAGE_SIZE - sizeof(struct argresp)) return -EFBIG; @@ -67,7 +66,7 @@ static ssize_t TA_write(struct file *file, const char *buf, size_t size, loff_t } if (copy_from_user(ar->data, buf, size)) return -EFAULT; - + rv = tctxt->write_op(file, ar->data, size); if (rv>0) { ar->size = rv; @@ -81,7 +80,7 @@ static ssize_t TA_read(struct file *file, char *buf, size_t size, loff_t *pos) { struct argresp *ar; ssize_t rv = 0; - + if (file->private_data == NULL) rv = TA_write(file, buf, 0, pos); if (rv < 0) @@ -153,7 +152,6 @@ struct inode *new_transaction_inode(struct super_block *sb, int mode, struct tra inode->i_mode = S_IFREG | mode; inode->i_uid = current_fsuid(); inode->i_gid = current_fsgid(); - set_i_blksize(inode, PAGE_CACHE_SIZE); inode->i_blocks = 0; inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME; inode->i_fop = &transaction_ops; diff --git a/include/linux/oracleasm/manager.h b/include/linux/oracleasm/manager.h index b83807f5ca1b..0e0d63c7b251 100644 --- a/include/linux/oracleasm/manager.h +++ b/include/linux/oracleasm/manager.h @@ -77,6 +77,7 @@ * oracleasmfs is mounted. Default is ASM_MANAGER_DEFAULT */ #define ASM_MANAGER_DEFAULT "/dev/oracleasm" +#define ASM_PROC_PATH "fs/oracleasm" /* Subdirectories of the manager device */ #define ASM_MANAGER_DISKS "disks"