All previous patches have been pushed to the git repo. With this set, we can start building the fs on el5 u4. More importantly, the testing can begin. Yes, this set disables few features. But that is only temporary. Details are provided in the specific patches. Sunil
Sunil Mushran
2009-Nov-21 01:12 UTC
[Ocfs2-devel] [PATCH 01/10] ocfs2: Reduce stack usage in the vectorized io kapi patch
This patch improves changes in commit 1c87a8619515dba3a5a040daa272088b2cb90dc2 by reducing the stack footprint of the vectorized io kapi code. Signed-off-by: Sunil Mushran <sunil.mushran at oracle.com> --- fs/ocfs2/kapi-default.h | 2 +- kapi-compat/include/aiovec.h | 11 +++++------ 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/fs/ocfs2/kapi-default.h b/fs/ocfs2/kapi-default.h index b1afdcf..80f04ff 100644 --- a/fs/ocfs2/kapi-default.h +++ b/fs/ocfs2/kapi-default.h @@ -39,7 +39,7 @@ typedef struct work_struct kapi_work_struct_t; typedef u64 f_version_t; #endif -#ifndef kapi_generic_file_aio_read +#ifndef NO_VECTORIZED_AIO # define kapi_generic_file_aio_read(a, b, c, d) \ generic_file_aio_read(a, b, c, d) # define ocfs2_file_aio_read __ocfs2_file_aio_read diff --git a/kapi-compat/include/aiovec.h b/kapi-compat/include/aiovec.h index 0c4c312..a10d5b5 100644 --- a/kapi-compat/include/aiovec.h +++ b/kapi-compat/include/aiovec.h @@ -11,8 +11,9 @@ static ssize_t kapi_generic_file_aio_read(struct kiocb *iocb, unsigned long nr_segs, loff_t pos) { - BUG_ON(nr_segs != 1); - return generic_file_aio_read(iocb, iov->iov_base, iov->iov_len, pos); + BUG_ON(iocb->ki_pos != pos); + + return __generic_file_aio_read(iocb, iov, nr_segs, &pos); } static ssize_t __ocfs2_file_aio_read(struct kiocb *iocb, @@ -28,9 +29,8 @@ static ssize_t ocfs2_file_aio_read(struct kiocb *iocb, struct iovec iov_local = { .iov_base = (void __user *)buf, .iov_len = buflen }; const struct iovec *iov = &iov_local; - unsigned long nr_segs = 1; - return __ocfs2_file_aio_read(iocb, iov, nr_segs, pos); + return __ocfs2_file_aio_read(iocb, iov, 1, pos); } static ssize_t __ocfs2_file_aio_write(struct kiocb *iocb, @@ -46,10 +46,9 @@ static ssize_t ocfs2_file_aio_write(struct kiocb *iocb, struct iovec iov_local = { .iov_base = (void __user *)buf, .iov_len = buflen }; const struct iovec *iov = &iov_local; - unsigned long nr_segs = 1; iocb->ki_left = buflen; - return __ocfs2_file_aio_write(iocb, iov, nr_segs, pos); + return __ocfs2_file_aio_write(iocb, iov, 1, pos); } #endif -- 1.5.6.5
Sunil Mushran
2009-Nov-21 01:12 UTC
[Ocfs2-devel] [PATCH 02/10] ocfs2: Temporarily disable splice i/o
This patch disables splice i/o temporarily. It will be enabled later. TODO: Enable splice. Signed-off-by: Sunil Mushran <sunil.mushran at oracle.com> --- Config.make.in | 1 + configure.in | 5 +++++ fs/ocfs2/Makefile | 4 ++++ fs/ocfs2/file.c | 8 ++++++++ fs/ocfs2/xattr.c | 2 ++ 5 files changed, 20 insertions(+), 0 deletions(-) diff --git a/Config.make.in b/Config.make.in index 02b8c9c..a2365e4 100644 --- a/Config.make.in +++ b/Config.make.in @@ -78,6 +78,7 @@ NO_FAULT_IN_VMOPS = @NO_FAULT_IN_VMOPS@ GET_RETURNS_U64_IN_SIMPLE_ATTR_OPEN = @GET_RETURNS_U64_IN_SIMPLE_ATTR_OPEN@ NO_SHOULD_REMOVE_SUID = @NO_SHOULD_REMOVE_SUID@ HAS_FOPS_SENDFILE = @HAS_FOPS_SENDFILE@ +SKIP_SPLICE = @SKIP_SPLICE@ OCFS_DEBUG = @OCFS_DEBUG@ diff --git a/configure.in b/configure.in index 5bc9d42..f028444 100644 --- a/configure.in +++ b/configure.in @@ -414,6 +414,11 @@ OCFS2_CHECK_KERNEL([ fops->sendfile() in fs.h], fs.h, HAS_FOPS_SENDFILE=yes, , [^.*ssize_t (\*sendfile)]) AC_SUBST(HAS_FOPS_SENDFILE) +SKIP_SPLICE+OCFS2_CHECK_KERNEL([splice.h], splice.h, + , SKIP_SPLICE=yes, [struct splice_desc {]) +AC_SUBST(SKIP_SPLICE) + # End kapi_compat checks # using -include has two advantages: diff --git a/fs/ocfs2/Makefile b/fs/ocfs2/Makefile index 2e85623..ba2a3ea 100644 --- a/fs/ocfs2/Makefile +++ b/fs/ocfs2/Makefile @@ -114,6 +114,10 @@ ifdef HAS_FOPS_SENDFILE EXTRA_CFLAGS += -DHAS_FOPS_SENDFILE endif +ifdef SKIP_SPLICE +EXTRA_CFLAGS += -DSKIP_SPLICE +endif + # # Since SUBDIRS means something to kbuild, define them safely. Do not # include trailing slashes. diff --git a/fs/ocfs2/file.c b/fs/ocfs2/file.c index de75f5a..81bd622 100644 --- a/fs/ocfs2/file.c +++ b/fs/ocfs2/file.c @@ -31,7 +31,9 @@ #include <linux/pagemap.h> #include <linux/uio.h> #include <linux/sched.h> +#ifndef SKIP_SPLICE #include <linux/splice.h> +#endif #include <linux/mount.h> #include <linux/writeback.h> #include <linux/falloc.h> @@ -2058,6 +2060,7 @@ out_sems: return ret; } +#ifndef SKIP_SPLICE static int ocfs2_splice_to_file(struct pipe_inode_info *pipe, struct file *out, struct splice_desc *sd) @@ -2171,6 +2174,7 @@ bail: mlog_exit(ret); return ret; } +#endif /* SKIP SPLICE */ static ssize_t __ocfs2_file_aio_read(struct kiocb *iocb, const struct iovec *iov, @@ -2334,8 +2338,10 @@ const struct file_operations ocfs2_fops = { #endif .lock = ocfs2_lock, .flock = ocfs2_flock, +#ifndef SKIP_SPLICE .splice_read = ocfs2_file_splice_read, .splice_write = ocfs2_file_splice_write, +#endif #ifdef HAS_FOPS_SENDFILE .sendfile = ocfs2_file_sendfile, #endif @@ -2383,8 +2389,10 @@ const struct file_operations ocfs2_fops_no_plocks = { .compat_ioctl = ocfs2_compat_ioctl, #endif .flock = ocfs2_flock, +#ifndef SKIP_SPLICE .splice_read = ocfs2_file_splice_read, .splice_write = ocfs2_file_splice_write, +#endif #ifdef HAS_FOPS_SENDFILE .sendfile = ocfs2_file_sendfile, #endif diff --git a/fs/ocfs2/xattr.c b/fs/ocfs2/xattr.c index fe34190..9a03d9b 100644 --- a/fs/ocfs2/xattr.c +++ b/fs/ocfs2/xattr.c @@ -27,7 +27,9 @@ #include <linux/pagemap.h> #include <linux/uio.h> #include <linux/sched.h> +#ifndef SKIP_SPLICE #include <linux/splice.h> +#endif #include <linux/mount.h> #include <linux/writeback.h> #include <linux/falloc.h> -- 1.5.6.5
Sunil Mushran
2009-Nov-21 01:12 UTC
[Ocfs2-devel] [PATCH 03/10] ocfs2: Handle missing mnt_want_write() and mnt_drop_write()
Mainline commit 8366025eb80dfa0d8d94b286d53027081c280ef1 added mnt_want_write() and mnt_drop_write() to protect writes to a filesystem. This patch disables this functionality when built on older EL5 kernels. TODO: We should look into enabling this functionality for EL5. Signed-off-by: Sunil Mushran <sunil.mushran at oracle.com> --- Makefile | 3 ++- configure.in | 5 +++++ kapi-compat/include/mnt_want_write.h | 7 +++++++ 3 files changed, 14 insertions(+), 1 deletions(-) create mode 100644 kapi-compat/include/mnt_want_write.h diff --git a/Makefile b/Makefile index 7d9e0a9..a642c13 100644 --- a/Makefile +++ b/Makefile @@ -35,7 +35,8 @@ KAPI_COMPAT_FILES = \ kapi-compat/include/inode_permission.h \ kapi-compat/include/should_remove_suid.h \ kapi-compat/include/user_path_at.h \ - kapi-compat/include/filemap_fdatawait_range.h + kapi-compat/include/filemap_fdatawait_range.h \ + kapi-compat/include/mnt_want_write.h PATCH_FILES diff --git a/configure.in b/configure.in index f028444..c9ddf88 100644 --- a/configure.in +++ b/configure.in @@ -419,6 +419,11 @@ OCFS2_CHECK_KERNEL([splice.h], splice.h, , SKIP_SPLICE=yes, [struct splice_desc {]) AC_SUBST(SKIP_SPLICE) +mnt_want_write+OCFS2_CHECK_KERNEL([mnt_want_write.h() and mnt_drop_write() in mount.h], mount.h, + , mnt_want_write=mnt_want_write.h, [^extern int mnt_want_write(]) +KAPI_COMPAT_HEADERS="$KAPI_COMPAT_HEADERS $mnt_want_write" + # End kapi_compat checks # using -include has two advantages: diff --git a/kapi-compat/include/mnt_want_write.h b/kapi-compat/include/mnt_want_write.h new file mode 100644 index 0000000..2f234a8 --- /dev/null +++ b/kapi-compat/include/mnt_want_write.h @@ -0,0 +1,7 @@ +#ifndef KAPI_MNT_WANT_WRITE_H +#define KAPI_MNT_WANT_WRITE_H + +#define mnt_want_write(a) 0 +#define mnt_drop_write(a) + +#endif -- 1.5.6.5
Sunil Mushran
2009-Nov-21 01:12 UTC
[Ocfs2-devel] [PATCH 04/10] ocfs2: Handle missing bdev_logical_block_size()
Mainline commit e1defc4ff0cf57aca6c5e3ff99fa503f5943c1f1 does away with the notion of hardsect_size and replaces it with physical and logical block sizes. This patch adds a macro to plumb the new bdev_logical_block_size() to the old bdev_hardsect_size() when building on EL5. Signed-off-by: Sunil Mushran <sunil.mushran at oracle.com> --- Makefile | 3 ++- configure.in | 5 +++++ kapi-compat/include/hardsect.h | 6 ++++++ 3 files changed, 13 insertions(+), 1 deletions(-) create mode 100644 kapi-compat/include/hardsect.h diff --git a/Makefile b/Makefile index a642c13..8e8b63f 100644 --- a/Makefile +++ b/Makefile @@ -36,7 +36,8 @@ KAPI_COMPAT_FILES = \ kapi-compat/include/should_remove_suid.h \ kapi-compat/include/user_path_at.h \ kapi-compat/include/filemap_fdatawait_range.h \ - kapi-compat/include/mnt_want_write.h + kapi-compat/include/mnt_want_write.h \ + kapi-compat/include/hardsect.h PATCH_FILES diff --git a/configure.in b/configure.in index c9ddf88..2826cec 100644 --- a/configure.in +++ b/configure.in @@ -424,6 +424,11 @@ OCFS2_CHECK_KERNEL([mnt_want_write.h() and mnt_drop_write() in mount.h], mount.h , mnt_want_write=mnt_want_write.h, [^extern int mnt_want_write(]) KAPI_COMPAT_HEADERS="$KAPI_COMPAT_HEADERS $mnt_want_write" +bdev_hardsect_header+OCFS2_CHECK_KERNEL([ bdev_hardsect_size() in blkdev.h], blkdev.h, + bdev_hardsect_header=hardsect.h, , [static inline int bdev_hardsect_size(struct block_device \*bdev)]) +KAPI_COMPAT_HEADERS="$KAPI_COMPAT_HEADERS $bdev_hardsect_header" + # End kapi_compat checks # using -include has two advantages: diff --git a/kapi-compat/include/hardsect.h b/kapi-compat/include/hardsect.h new file mode 100644 index 0000000..7c59c00 --- /dev/null +++ b/kapi-compat/include/hardsect.h @@ -0,0 +1,6 @@ +#ifndef KAPI_HARDSECT_H +#define KAPI_HARDSECT_H + +#define bdev_logical_block_size(a) bdev_hardsect_size(a) + +#endif -- 1.5.6.5
Sunil Mushran
2009-Nov-21 01:12 UTC
[Ocfs2-devel] [PATCH 05/10] ocfs2: Handle missing struct jbd2_buffer_trigger_type
Mainline commit e06c8227fd94ec181849ba206bf032be31c4295c added buffer commit triggers in JBD2. OCFS2 uses these triggers to calculate the metadata checksums. Patch disables the MetaECC feature temporarily. TODO: Pull JBD2 source in OCFS2 1.6 repo and re-enable the MetaECC feature. Signed-off-by: Sunil Mushran <sunil.mushran at oracle.com> --- Config.make.in | 1 + Makefile | 3 +- configure.in | 6 +++ fs/ocfs2/Makefile | 4 ++ fs/ocfs2/journal.c | 2 + fs/ocfs2/super.c | 9 +++++ kapi-compat/include/triggers.h | 72 ++++++++++++++++++++++++++++++++++++++++ 7 files changed, 96 insertions(+), 1 deletions(-) create mode 100644 kapi-compat/include/triggers.h diff --git a/Config.make.in b/Config.make.in index a2365e4..5a81e44 100644 --- a/Config.make.in +++ b/Config.make.in @@ -79,6 +79,7 @@ GET_RETURNS_U64_IN_SIMPLE_ATTR_OPEN = @GET_RETURNS_U64_IN_SIMPLE_ATTR_OPEN@ NO_SHOULD_REMOVE_SUID = @NO_SHOULD_REMOVE_SUID@ HAS_FOPS_SENDFILE = @HAS_FOPS_SENDFILE@ SKIP_SPLICE = @SKIP_SPLICE@ +SKIP_BUFFER_TRIGGERS = @SKIP_BUFFER_TRIGGERS@ OCFS_DEBUG = @OCFS_DEBUG@ diff --git a/Makefile b/Makefile index 8e8b63f..fd34d67 100644 --- a/Makefile +++ b/Makefile @@ -37,7 +37,8 @@ KAPI_COMPAT_FILES = \ kapi-compat/include/user_path_at.h \ kapi-compat/include/filemap_fdatawait_range.h \ kapi-compat/include/mnt_want_write.h \ - kapi-compat/include/hardsect.h + kapi-compat/include/hardsect.h \ + kapi-compat/include/triggers.h PATCH_FILES diff --git a/configure.in b/configure.in index 2826cec..d042f9c 100644 --- a/configure.in +++ b/configure.in @@ -429,6 +429,12 @@ OCFS2_CHECK_KERNEL([ bdev_hardsect_size() in blkdev.h], blkdev.h, bdev_hardsect_header=hardsect.h, , [static inline int bdev_hardsect_size(struct block_device \*bdev)]) KAPI_COMPAT_HEADERS="$KAPI_COMPAT_HEADERS $bdev_hardsect_header" +SKIP_BUFFER_TRIGGERS+OCFS2_CHECK_KERNEL([struct jbd2_buffer_trigger_type in jbd2.h], jbd2.h, + , SKIP_BUFFER_TRIGGERS=triggers.h, [^struct jbd2_buffer_trigger_type {]) +AC_SUBST(SKIP_BUFFER_TRIGGERS) +KAPI_COMPAT_HEADERS="$KAPI_COMPAT_HEADERS $SKIP_BUFFER_TRIGGERS" + # End kapi_compat checks # using -include has two advantages: diff --git a/fs/ocfs2/Makefile b/fs/ocfs2/Makefile index ba2a3ea..1e8fed6 100644 --- a/fs/ocfs2/Makefile +++ b/fs/ocfs2/Makefile @@ -118,6 +118,10 @@ ifdef SKIP_SPLICE EXTRA_CFLAGS += -DSKIP_SPLICE endif +ifdef SKIP_BUFFER_TRIGGERS +CFLAGS_journal.o += -DSKIP_BUFFER_TRIGGERS +endif + # # Since SUBDIRS means something to kbuild, define them safely. Do not # include trailing slashes. diff --git a/fs/ocfs2/journal.c b/fs/ocfs2/journal.c index 67cc5a7..217f30a 100644 --- a/fs/ocfs2/journal.c +++ b/fs/ocfs2/journal.c @@ -459,6 +459,7 @@ bail: return status; } +#ifndef SKIP_BUFFER_TRIGGERS struct ocfs2_triggers { struct jbd2_buffer_trigger_type ot_triggers; int ot_offset; @@ -608,6 +609,7 @@ static struct ocfs2_triggers dl_triggers = { }, .ot_offset = offsetof(struct ocfs2_dx_leaf, dl_check), }; +#endif /* SKIP_BUFFER_TRIGGERS */ static int __ocfs2_journal_access(handle_t *handle, struct ocfs2_caching_info *ci, diff --git a/fs/ocfs2/super.c b/fs/ocfs2/super.c index e36bec2..0a7a621 100644 --- a/fs/ocfs2/super.c +++ b/fs/ocfs2/super.c @@ -1017,6 +1017,15 @@ static int ocfs2_fill_super(struct super_block *sb, void *data, int silent) brelse(bh); bh = NULL; +#ifdef SKIP_BUFFER_TRIGGERS + if(ocfs2_meta_ecc(osb)) { + status = -EINVAL; + mlog(ML_ERROR, "File system cannot mount volume with the " + "MetaECC feature enabled.\n"); + goto read_super_error; + } +#endif + if (!(osb->s_feature_incompat & OCFS2_FEATURE_INCOMPAT_XATTR)) parsed_options.mount_opt &= ~OCFS2_MOUNT_POSIX_ACL; diff --git a/kapi-compat/include/triggers.h b/kapi-compat/include/triggers.h new file mode 100644 index 0000000..d9f3f3f --- /dev/null +++ b/kapi-compat/include/triggers.h @@ -0,0 +1,72 @@ +#ifndef KAPI_TRIGGERS_H +#define KAPI_TRIGGERS_H + +#ifdef SKIP_BUFFER_TRIGGERS + +#include <linux/fs.h> +#include <linux/buffer_head.h> + +struct jbd2_buffer_trigger_type { + /* + * Fired just before a buffer is written to the journal. + * mapped_data is a mapped buffer that is the frozen data for + * commit. + */ + void (*t_commit)(struct jbd2_buffer_trigger_type *type, + struct buffer_head *bh, void *mapped_data, + size_t size); + + /* + * Fired during journal abort for dirty buffers that will not be + * committed. + */ + void (*t_abort)(struct jbd2_buffer_trigger_type *type, + struct buffer_head *bh); +}; + +struct ocfs2_triggers { + struct jbd2_buffer_trigger_type ot_triggers; + int ot_offset; +}; + +#define jbd2_journal_set_triggers(a, b) do { } while (0) + +static struct ocfs2_triggers di_triggers = { + .ot_triggers = { .t_commit = NULL, .t_abort = NULL, }, .ot_offset = 0, +}; + +static struct ocfs2_triggers eb_triggers = { + .ot_triggers = { .t_commit = NULL, .t_abort = NULL, }, .ot_offset = 0, +}; + +static struct ocfs2_triggers rb_triggers = { + .ot_triggers = { .t_commit = NULL, .t_abort = NULL, }, .ot_offset = 0, +}; + +static struct ocfs2_triggers gd_triggers = { + .ot_triggers = { .t_commit = NULL, .t_abort = NULL, }, .ot_offset = 0, +}; + +static struct ocfs2_triggers db_triggers = { + .ot_triggers = { .t_commit = NULL, .t_abort = NULL, }, .ot_offset = 0, +}; + +static struct ocfs2_triggers xb_triggers = { + .ot_triggers = { .t_commit = NULL, .t_abort = NULL, }, .ot_offset = 0, +}; + +static struct ocfs2_triggers dq_triggers = { + .ot_triggers = { .t_commit = NULL, .t_abort = NULL, }, .ot_offset = 0, +}; + +static struct ocfs2_triggers dr_triggers = { + .ot_triggers = { .t_commit = NULL, .t_abort = NULL, }, .ot_offset = 0, +}; + +static struct ocfs2_triggers dl_triggers = { + .ot_triggers = { .t_commit = NULL, .t_abort = NULL, }, .ot_offset = 0, +}; + +#endif + +#endif -- 1.5.6.5
Sunil Mushran
2009-Nov-21 01:12 UTC
[Ocfs2-devel] [PATCH 06/10] ocfs2/dlm: Handle missing name in backing_dev_info
Mainline commit d993831fa7ffeb89e994f046f93eeb09ec91df08 added name in struct backing_dev_info. When built on older kernels, patch ifdefs out the name in the structure. Signed-off-by: Sunil Mushran <sunil.mushran at oracle.com> --- Config.make.in | 1 + configure.in | 5 +++++ fs/ocfs2/dlm/Makefile | 4 ++++ fs/ocfs2/dlm/dlmfs.c | 2 ++ 4 files changed, 12 insertions(+), 0 deletions(-) diff --git a/Config.make.in b/Config.make.in index 5a81e44..0107e2e 100644 --- a/Config.make.in +++ b/Config.make.in @@ -80,6 +80,7 @@ NO_SHOULD_REMOVE_SUID = @NO_SHOULD_REMOVE_SUID@ HAS_FOPS_SENDFILE = @HAS_FOPS_SENDFILE@ SKIP_SPLICE = @SKIP_SPLICE@ SKIP_BUFFER_TRIGGERS = @SKIP_BUFFER_TRIGGERS@ +NO_NAME_IN_BACKING_DEV_INFO=@NO_NAME_IN_BACKING_DEV_INFO@ OCFS_DEBUG = @OCFS_DEBUG@ diff --git a/configure.in b/configure.in index d042f9c..0a3a356 100644 --- a/configure.in +++ b/configure.in @@ -435,6 +435,11 @@ OCFS2_CHECK_KERNEL([struct jbd2_buffer_trigger_type in jbd2.h], jbd2.h, AC_SUBST(SKIP_BUFFER_TRIGGERS) KAPI_COMPAT_HEADERS="$KAPI_COMPAT_HEADERS $SKIP_BUFFER_TRIGGERS" +NO_NAME_IN_BACKING_DEV_INFO+OCFS2_CHECK_KERNEL([name in backing-dev.h], backing-dev.h, + , NO_NAME_IN_BACKING_DEV_INFO=yes, [char.*\*name;$]) +AC_SUBST(NO_NAME_IN_BACKING_DEV_INFO) + # End kapi_compat checks # using -include has two advantages: diff --git a/fs/ocfs2/dlm/Makefile b/fs/ocfs2/dlm/Makefile index 907e390..f868c0e 100644 --- a/fs/ocfs2/dlm/Makefile +++ b/fs/ocfs2/dlm/Makefile @@ -46,6 +46,10 @@ ifdef KMEM_CACHE_CREATE_DTOR EXTRA_CFLAGS += -DKMEM_CACHE_CREATE_DTOR endif +ifdef NO_NAME_IN_BACKING_DEV_INFO +EXTRA_CFLAGS += -DNO_NAME_IN_BACKING_DEV_INFO +endif + DLM_SOURCES += \ dlmast.c \ dlmconvert.c \ diff --git a/fs/ocfs2/dlm/dlmfs.c b/fs/ocfs2/dlm/dlmfs.c index 6d97173..576d3ec 100644 --- a/fs/ocfs2/dlm/dlmfs.c +++ b/fs/ocfs2/dlm/dlmfs.c @@ -340,7 +340,9 @@ clear_fields: } static struct backing_dev_info dlmfs_backing_dev_info = { +#ifndef NO_NAME_IN_BACKING_DEV_INFO .name = "ocfs2-dlmfs", +#endif .ra_pages = 0, /* No readahead */ .capabilities = BDI_CAP_NO_ACCT_AND_WRITEBACK, }; -- 1.5.6.5
Sunil Mushran
2009-Nov-21 01:12 UTC
[Ocfs2-devel] [PATCH 07/10] ocfs2: Handle missing kobj_attribute
Mainline commit 23b5212cc7422f475b82124334b64277b5b43013 added kobj_attribute. This patch adds compat code to allow the fs to build on older EL5 kernels. Signed-off-by: Sunil Mushran <sunil.mushran at oracle.com> --- Config.make.in | 1 + Makefile | 3 +- configure.in | 6 ++ fs/ocfs2/Makefile | 8 +++- fs/ocfs2/cluster/Makefile | 6 ++- fs/ocfs2/cluster/kapi-default.h | 10 ++++ fs/ocfs2/cluster/sys.c | 16 +++--- fs/ocfs2/compat_kobject.c | 90 ++++++++++++++++++++++++++++++++++ fs/ocfs2/kapi-default.h | 10 ++++ fs/ocfs2/stackglue.c | 10 ++-- kapi-compat/include/compat_kobject.h | 29 +++++++++++ 11 files changed, 173 insertions(+), 16 deletions(-) create mode 100644 fs/ocfs2/compat_kobject.c create mode 100644 kapi-compat/include/compat_kobject.h diff --git a/Config.make.in b/Config.make.in index 0107e2e..dd2e406 100644 --- a/Config.make.in +++ b/Config.make.in @@ -81,6 +81,7 @@ HAS_FOPS_SENDFILE = @HAS_FOPS_SENDFILE@ SKIP_SPLICE = @SKIP_SPLICE@ SKIP_BUFFER_TRIGGERS = @SKIP_BUFFER_TRIGGERS@ NO_NAME_IN_BACKING_DEV_INFO=@NO_NAME_IN_BACKING_DEV_INFO@ +NO_KOBJ_ATTRIBUTE = @NO_KOBJ_ATTRIBUTE@ OCFS_DEBUG = @OCFS_DEBUG@ diff --git a/Makefile b/Makefile index fd34d67..7c48788 100644 --- a/Makefile +++ b/Makefile @@ -38,7 +38,8 @@ KAPI_COMPAT_FILES = \ kapi-compat/include/filemap_fdatawait_range.h \ kapi-compat/include/mnt_want_write.h \ kapi-compat/include/hardsect.h \ - kapi-compat/include/triggers.h + kapi-compat/include/triggers.h \ + kapi-compat/include/compat_kobject.h PATCH_FILES diff --git a/configure.in b/configure.in index 0a3a356..22245ec 100644 --- a/configure.in +++ b/configure.in @@ -440,6 +440,12 @@ OCFS2_CHECK_KERNEL([name in backing-dev.h], backing-dev.h, , NO_NAME_IN_BACKING_DEV_INFO=yes, [char.*\*name;$]) AC_SUBST(NO_NAME_IN_BACKING_DEV_INFO) +NO_KOBJ_ATTRIBUTE+OCFS2_CHECK_KERNEL([struct kobj_attribute in kobject.h], kobject.h, + , NO_KOBJ_ATTRIBUTE=compat_kobject.h, [^struct kobj_attribute {]) +AC_SUBST(NO_KOBJ_ATTRIBUTE) +KAPI_COMPAT_HEADERS="$KAPI_COMPAT_HEADERS $NO_KOBJ_ATTRIBUTE" + # End kapi_compat checks # using -include has two advantages: diff --git a/fs/ocfs2/Makefile b/fs/ocfs2/Makefile index 1e8fed6..c02cbee 100644 --- a/fs/ocfs2/Makefile +++ b/fs/ocfs2/Makefile @@ -122,6 +122,12 @@ ifdef SKIP_BUFFER_TRIGGERS CFLAGS_journal.o += -DSKIP_BUFFER_TRIGGERS endif +COMPAT_SOURCES += compat_kobject.c +ifdef NO_KOBJ_ATTRIBUTE +FS_SOURCES += compat_kobject.c +EXTRA_CFLAGS += -DNO_KOBJ_ATTRIBUTE +endif + # # Since SUBDIRS means something to kbuild, define them safely. Do not # include trailing slashes. @@ -156,7 +162,7 @@ INSTALL_MOD_DIR := fs/ocfs2 obj-m := ocfs2.o ocfs2_stackglue.o ocfs2_stack_o2cb.o ocfs2_stack_user.o ocfs2-objs := $(FS_OBJECTS) -ocfs2_stackglue-objs := stackglue.o +ocfs2_stackglue-objs := stackglue.o compat_kobject.o ocfs2_stack_o2cb-objs := stack_o2cb.o ocfs2_stack_user-objs := stack_user.o diff --git a/fs/ocfs2/cluster/Makefile b/fs/ocfs2/cluster/Makefile index d107cca..7336217 100644 --- a/fs/ocfs2/cluster/Makefile +++ b/fs/ocfs2/cluster/Makefile @@ -30,6 +30,10 @@ ifdef OLD_BIO_END_IO_T EXTRA_CFLAGS += -DOLD_BIO_END_IO_T endif +ifdef NO_KOBJ_ATTRIBUTE +EXTRA_CFLAGS += -DNO_KOBJ_ATTRIBUTE +endif + SOURCES += \ heartbeat.c \ masklog.c \ @@ -52,7 +56,7 @@ HEADERS += \ tcp_internal.h \ ver.h -OBJECTS = $(subst .c,.o,$(SOURCES)) +OBJECTS = $(subst .c,.o,$(SOURCES)) ../compat_kobject.o VERSION_FILES = $(SOURCES) $(HEADERS) $(COMPAT_SOURCES) $(COMPAT_HEADERS) VERSION_SRC = ver.c VERSION_PREFIX = CLUSTER diff --git a/fs/ocfs2/cluster/kapi-default.h b/fs/ocfs2/cluster/kapi-default.h index 81dce2f..36976f1 100644 --- a/fs/ocfs2/cluster/kapi-default.h +++ b/fs/ocfs2/cluster/kapi-default.h @@ -42,4 +42,14 @@ typedef struct work_struct kapi_work_struct_t; # define su_mutex su_mutex #endif +#ifndef kapi_kset +# define kapi_kset kset +# define kapi_kset_create_and_add(a, b, c) kset_create_and_add(a, b, c) +# define kapi_kset_unregister(a) kset_unregister(a) +# define kapi_to_kobj(a) (&((a)->kobj)) +# define kapi_to_kset(a) (a) +# define kapi_sysfs_create_link(a, b, c) sysfs_create_link(a, b, c) +# define kapi_sysfs_remove_link(a, b) sysfs_remove_link(a, b) +#endif + #endif diff --git a/fs/ocfs2/cluster/sys.c b/fs/ocfs2/cluster/sys.c index bc702da..46d32c6 100644 --- a/fs/ocfs2/cluster/sys.c +++ b/fs/ocfs2/cluster/sys.c @@ -52,20 +52,20 @@ static struct attribute_group o2cb_attr_group = { .attrs = o2cb_attrs, }; -static struct kset *o2cb_kset; +static struct kapi_kset *o2cb_kset; void o2cb_sys_shutdown(void) { mlog_sys_shutdown(); - sysfs_remove_link(NULL, "o2cb"); - kset_unregister(o2cb_kset); + kapi_sysfs_remove_link(NULL, "o2cb"); + kapi_kset_unregister(o2cb_kset); } int o2cb_sys_init(void) { int ret; - o2cb_kset = kset_create_and_add("o2cb", NULL, fs_kobj); + o2cb_kset = kapi_kset_create_and_add("o2cb", NULL, fs_kobj); if (!o2cb_kset) return -ENOMEM; @@ -73,19 +73,19 @@ int o2cb_sys_init(void) * Create this symlink for backwards compatibility with old * versions of ocfs2-tools which look for things in /sys/o2cb. */ - ret = sysfs_create_link(NULL, &o2cb_kset->kobj, "o2cb"); + ret = kapi_sysfs_create_link(NULL, &o2cb_kset->kobj, "o2cb"); if (ret) goto error; - ret = sysfs_create_group(&o2cb_kset->kobj, &o2cb_attr_group); + ret = sysfs_create_group(kapi_to_kobj(o2cb_kset), &o2cb_attr_group); if (ret) goto error; - ret = mlog_sys_init(o2cb_kset); + ret = mlog_sys_init(kapi_to_kset(o2cb_kset)); if (ret) goto error; return 0; error: - kset_unregister(o2cb_kset); + kapi_kset_unregister(o2cb_kset); return ret; } diff --git a/fs/ocfs2/compat_kobject.c b/fs/ocfs2/compat_kobject.c new file mode 100644 index 0000000..fef1fd9 --- /dev/null +++ b/fs/ocfs2/compat_kobject.c @@ -0,0 +1,90 @@ +#include <linux/slab.h> +#include <linux/kobject.h> + +/* default kobject attribute operations */ +static ssize_t kobj_attr_show(struct kobject *kobj, struct attribute *attr, + char *buf) +{ + struct kobj_attribute *kattr; + ssize_t ret = -EIO; + + kattr = container_of(attr, struct kobj_attribute, attr); + if (kattr->show) + ret = kattr->show(kobj, kattr, buf); + return ret; +} + +static ssize_t kobj_attr_store(struct kobject *kobj, struct attribute *attr, + const char *buf, size_t count) +{ + struct kobj_attribute *kattr; + ssize_t ret = -EIO; + + kattr = container_of(attr, struct kobj_attribute, attr); + if (kattr->store) + ret = kattr->store(kobj, kattr, buf, count); + return ret; +} + +static struct sysfs_ops kobj_sysfs_ops = { + .show = kobj_attr_show, + .store = kobj_attr_store, +}; + +static void dynamic_kobj_release(struct kobject *kobj) +{ + pr_debug("kobject: (%p): %s\n", kobj, __FUNCTION__); + kfree(kobj); +} + +static struct kobj_type dynamic_kobj_ktype = { + .release = dynamic_kobj_release, + .sysfs_ops = &kobj_sysfs_ops, +}; + +/** + * kobject_create_and_add - create a struct kobject dynamically and register it with sysfs + * + * @name: the name for the kset + * @parent: the parent kobject of this kobject, if any. + * + * This function creates a kobject structure dynamically and registers it + * with sysfs. When you are finished with this structure, call + * kobject_put() and the structure will be dynamically freed when + * it is no longer being used. + * + * If the kobject was not able to be created, NULL will be returned. + */ +struct kobject *kobject_create_and_add(const char *name, struct kobject *parent) +{ + struct kobject *kobj; + int retval; + + kobj = kzalloc(sizeof(*kobj), GFP_KERNEL); + if (!kobj) + return NULL; + + kobject_init(kobj); + kobj->ktype = &dynamic_kobj_ktype; + kobj->parent = parent; + + retval = kobject_set_name(kobj, "%s", name); + if (retval) { + printk(KERN_WARNING "%s: kobject_set_name error: %d\n", + __FUNCTION__, retval); + goto err; + } + + retval = kobject_add(kobj); + if (retval) { + printk(KERN_WARNING "%s: kobject_add error: %d\n", + __FUNCTION__, retval); + goto err; + } + + return kobj; + +err: + kobject_put(kobj); + return NULL; +} diff --git a/fs/ocfs2/kapi-default.h b/fs/ocfs2/kapi-default.h index 80f04ff..68e5746 100644 --- a/fs/ocfs2/kapi-default.h +++ b/fs/ocfs2/kapi-default.h @@ -69,4 +69,14 @@ typedef u64 f_version_t; # define kapi_filemap_fdatawait_range filemap_fdatawait_range #endif +#ifndef kapi_kset +# define kapi_kset kset +# define kapi_kset_create_and_add(a, b, c) kset_create_and_add(a, b, c) +# define kapi_kset_unregister(a) kset_unregister(a) +# define kapi_to_kobj(a) (&((a)->kobj)) +# define kapi_to_kset(a) (a) +# define kapi_sysfs_create_link(a, b, c) sysfs_create_link(a, b, c) +# define kapi_sysfs_remove_link(a, b) sysfs_remove_link(a, b) +#endif + #endif diff --git a/fs/ocfs2/stackglue.c b/fs/ocfs2/stackglue.c index b4c85be..02ba5b5 100644 --- a/fs/ocfs2/stackglue.c +++ b/fs/ocfs2/stackglue.c @@ -582,29 +582,29 @@ static struct attribute_group ocfs2_attr_group = { .attrs = ocfs2_attrs, }; -static struct kset *ocfs2_kset; +static struct kapi_kset *ocfs2_kset; static void ocfs2_sysfs_exit(void) { - kset_unregister(ocfs2_kset); + kapi_kset_unregister(ocfs2_kset); } static int ocfs2_sysfs_init(void) { int ret; - ocfs2_kset = kset_create_and_add("ocfs2", NULL, fs_kobj); + ocfs2_kset = kapi_kset_create_and_add("ocfs2", NULL, fs_kobj); if (!ocfs2_kset) return -ENOMEM; - ret = sysfs_create_group(&ocfs2_kset->kobj, &ocfs2_attr_group); + ret = sysfs_create_group(kapi_to_kobj(ocfs2_kset), &ocfs2_attr_group); if (ret) goto error; return 0; error: - kset_unregister(ocfs2_kset); + kapi_kset_unregister(ocfs2_kset); return ret; } diff --git a/kapi-compat/include/compat_kobject.h b/kapi-compat/include/compat_kobject.h new file mode 100644 index 0000000..441b3c6 --- /dev/null +++ b/kapi-compat/include/compat_kobject.h @@ -0,0 +1,29 @@ +#ifndef KAPI_COMPAT_KOBJECT_H +#define KAPI_COMPAT_KOBJECT_H + +#ifdef NO_KOBJ_ATTRIBUTE + +#include <linux/slab.h> +#include <linux/kobject.h> + +#define kapi_kset kobject +#define kapi_kset_create_and_add(a, b, c) kobject_create_and_add(a, b) +#define kapi_kset_unregister(a) kobject_unregister(a) +#define kapi_to_kobj(a) (a) +#define kapi_to_kset(a) ((a)->kset) +#define kapi_sysfs_create_link(a, b, c) 0 +#define kapi_sysfs_remove_link(a, b) + +struct kobj_attribute { + struct attribute attr; + ssize_t (*show)(struct kobject *kobj, struct kobj_attribute *attr, + char *buf); + ssize_t (*store)(struct kobject *kobj, struct kobj_attribute *attr, + const char *buf, size_t count); +}; + +struct kobject *kobject_create_and_add(const char *name, struct kobject *parent); + +#endif + +#endif -- 1.5.6.5
Sunil Mushran
2009-Nov-21 01:12 UTC
[Ocfs2-devel] [PATCH 08/10] ocfs2: Handle missing new quota format
Mainline commit 1ccd14b9c271c1ac6eec5c5ec5def433100e7248 changed the quota format. This patch disables enabling the quotas feature when built on the older EL5 kernel. Changes introduced by mainline commits b85f4b87a511bea86dac68c4f0fabaee2cac6c4c and e3d4d56b9715e40ded2a84d0d4fa7f3b6c58983c were also handled in this patch. Signed-off-by: Sunil Mushran <sunil.mushran at oracle.com> --- Config.make.in | 1 + Makefile | 3 ++- configure.in | 6 ++++++ fs/ocfs2/Makefile | 4 ++++ fs/ocfs2/dlmglue.c | 15 ++++++++++++--- fs/ocfs2/file.c | 10 ++++++++-- fs/ocfs2/journal.c | 17 +++++++++++++++++ fs/ocfs2/quota.h | 25 +++++++++++++++++++++++++ fs/ocfs2/quota_global.c | 3 +++ fs/ocfs2/quota_local.c | 3 +++ fs/ocfs2/super.c | 22 ++++++++++++++++++++++ kapi-compat/include/quotas.h | 19 +++++++++++++++++++ 12 files changed, 122 insertions(+), 6 deletions(-) create mode 100644 kapi-compat/include/quotas.h diff --git a/Config.make.in b/Config.make.in index dd2e406..8675982 100644 --- a/Config.make.in +++ b/Config.make.in @@ -82,6 +82,7 @@ SKIP_SPLICE = @SKIP_SPLICE@ SKIP_BUFFER_TRIGGERS = @SKIP_BUFFER_TRIGGERS@ NO_NAME_IN_BACKING_DEV_INFO=@NO_NAME_IN_BACKING_DEV_INFO@ NO_KOBJ_ATTRIBUTE = @NO_KOBJ_ATTRIBUTE@ +SKIP_QUOTAS= @SKIP_QUOTAS@ OCFS_DEBUG = @OCFS_DEBUG@ diff --git a/Makefile b/Makefile index 7c48788..07adc70 100644 --- a/Makefile +++ b/Makefile @@ -39,7 +39,8 @@ KAPI_COMPAT_FILES = \ kapi-compat/include/mnt_want_write.h \ kapi-compat/include/hardsect.h \ kapi-compat/include/triggers.h \ - kapi-compat/include/compat_kobject.h + kapi-compat/include/compat_kobject.h \ + kapi-compat/include/quotas.h PATCH_FILES diff --git a/configure.in b/configure.in index 22245ec..3dfe596 100644 --- a/configure.in +++ b/configure.in @@ -446,6 +446,12 @@ OCFS2_CHECK_KERNEL([struct kobj_attribute in kobject.h], kobject.h, AC_SUBST(NO_KOBJ_ATTRIBUTE) KAPI_COMPAT_HEADERS="$KAPI_COMPAT_HEADERS $NO_KOBJ_ATTRIBUTE" +SKIP_QUOTAS+OCFS2_CHECK_KERNEL([new quota format in dqblk_qtree.h], dqblk_qtree.h, + , SKIP_QUOTAS=quotas.h, [#define QTREE_INIT_ALLOC]) +AC_SUBST(SKIP_QUOTAS) +KAPI_COMPAT_HEADERS="$KAPI_COMPAT_HEADERS $SKIP_QUOTAS" + # End kapi_compat checks # using -include has two advantages: diff --git a/fs/ocfs2/Makefile b/fs/ocfs2/Makefile index c02cbee..7a03c94 100644 --- a/fs/ocfs2/Makefile +++ b/fs/ocfs2/Makefile @@ -128,6 +128,10 @@ FS_SOURCES += compat_kobject.c EXTRA_CFLAGS += -DNO_KOBJ_ATTRIBUTE endif +ifdef SKIP_QUOTAS +EXTRA_CFLAGS += -DSKIP_QUOTAS +endif + # # Since SUBDIRS means something to kbuild, define them safely. Do not # include trailing slashes. diff --git a/fs/ocfs2/dlmglue.c b/fs/ocfs2/dlmglue.c index 0b73382..dab6b8e 100644 --- a/fs/ocfs2/dlmglue.c +++ b/fs/ocfs2/dlmglue.c @@ -71,7 +71,9 @@ struct ocfs2_mask_waiter { static struct ocfs2_super *ocfs2_get_dentry_osb(struct ocfs2_lock_res *lockres); static struct ocfs2_super *ocfs2_get_inode_osb(struct ocfs2_lock_res *lockres); static struct ocfs2_super *ocfs2_get_file_osb(struct ocfs2_lock_res *lockres); +#ifndef SKIP_QUOTAS static struct ocfs2_super *ocfs2_get_qinfo_osb(struct ocfs2_lock_res *lockres); +#endif /* * Return value from ->downconvert_worker functions. @@ -108,8 +110,9 @@ static int ocfs2_dentry_convert_worker(struct ocfs2_lock_res *lockres, static void ocfs2_dentry_post_unlock(struct ocfs2_super *osb, struct ocfs2_lock_res *lockres); - +#ifndef SKIP_QUOTAS static void ocfs2_set_qinfo_lvb(struct ocfs2_lock_res *lockres); +#endif static int ocfs2_check_refcount_downconvert(struct ocfs2_lock_res *lockres, int new_level); @@ -277,13 +280,13 @@ static struct ocfs2_lock_res_ops ocfs2_flock_lops = { .get_osb = ocfs2_get_file_osb, .flags = 0, }; - +#ifndef SKIP_QUOTAS static struct ocfs2_lock_res_ops ocfs2_qinfo_lops = { .set_lvb = ocfs2_set_qinfo_lvb, .get_osb = ocfs2_get_qinfo_osb, .flags = LOCK_TYPE_REQUIRES_REFRESH | LOCK_TYPE_USES_LVB, }; - +#endif static struct ocfs2_lock_res_ops ocfs2_refcount_block_lops = { .check_downconvert = ocfs2_check_refcount_downconvert, .downconvert_worker = ocfs2_refcount_convert_worker, @@ -571,12 +574,14 @@ static struct ocfs2_super *ocfs2_get_inode_osb(struct ocfs2_lock_res *lockres) return OCFS2_SB(inode->i_sb); } +#ifndef SKIP_QUOTAS static struct ocfs2_super *ocfs2_get_qinfo_osb(struct ocfs2_lock_res *lockres) { struct ocfs2_mem_dqinfo *info = lockres->l_priv; return OCFS2_SB(info->dqi_gi.dqi_sb); } +#endif static struct ocfs2_super *ocfs2_get_file_osb(struct ocfs2_lock_res *lockres) { @@ -700,6 +705,7 @@ void ocfs2_file_lock_res_init(struct ocfs2_lock_res *lockres, lockres->l_flags |= OCFS2_LOCK_NOCACHE; } +#ifndef SKIP_QUOTAS void ocfs2_qinfo_lock_res_init(struct ocfs2_lock_res *lockres, struct ocfs2_mem_dqinfo *info) { @@ -710,6 +716,7 @@ void ocfs2_qinfo_lock_res_init(struct ocfs2_lock_res *lockres, OCFS2_LOCK_TYPE_QINFO, &ocfs2_qinfo_lops, info); } +#endif void ocfs2_refcount_lock_res_init(struct ocfs2_lock_res *lockres, struct ocfs2_super *osb, u64 ref_blkno, @@ -3704,6 +3711,7 @@ static int ocfs2_refcount_convert_worker(struct ocfs2_lock_res *lockres, return UNBLOCK_CONTINUE; } +#ifndef SKIP_QUOTAS static void ocfs2_set_qinfo_lvb(struct ocfs2_lock_res *lockres) { struct ocfs2_qinfo_lvb *lvb; @@ -3815,6 +3823,7 @@ bail: mlog_exit(status); return status; } +#endif /* SKIP_QUOTAS */ int ocfs2_refcount_lock(struct ocfs2_refcount_tree *ref_tree, int ex) { diff --git a/fs/ocfs2/file.c b/fs/ocfs2/file.c index 81bd622..c729d7c 100644 --- a/fs/ocfs2/file.c +++ b/fs/ocfs2/file.c @@ -945,9 +945,11 @@ int ocfs2_setattr(struct dentry *dentry, struct iattr *attr) struct ocfs2_super *osb = OCFS2_SB(sb); struct buffer_head *bh = NULL; handle_t *handle = NULL; +#ifndef SKIP_QUOTAS int qtype; struct dquot *transfer_from[MAXQUOTAS] = { }; struct dquot *transfer_to[MAXQUOTAS] = { }; +#endif mlog_entry("(0x%p, '%.*s')\n", dentry, dentry->d_name.len, dentry->d_name.name); @@ -1017,7 +1019,7 @@ int ocfs2_setattr(struct dentry *dentry, struct iattr *attr) goto bail_unlock; } } - +#ifndef SKIP_QUOTAS if ((attr->ia_valid & ATTR_UID && attr->ia_uid != inode->i_uid) || (attr->ia_valid & ATTR_GID && attr->ia_gid != inode->i_gid)) { /* @@ -1060,6 +1062,9 @@ int ocfs2_setattr(struct dentry *dentry, struct iattr *attr) if (status < 0) goto bail_commit; } else { +#else + { +#endif /* SKIP_QUOTAS */ handle = ocfs2_start_trans(osb, OCFS2_INODE_UPDATE_CREDITS); if (IS_ERR(handle)) { status = PTR_ERR(handle); @@ -1095,12 +1100,13 @@ bail_unlock_rw: bail: brelse(bh); +#ifndef SKIP_QUOTAS /* Release quota pointers in case we acquired them */ for (qtype = 0; qtype < MAXQUOTAS; qtype++) { dqput(transfer_to[qtype]); dqput(transfer_from[qtype]); } - +#endif if (!status && attr->ia_valid & ATTR_MODE) { status = ocfs2_acl_chmod(inode); if (status < 0) diff --git a/fs/ocfs2/journal.c b/fs/ocfs2/journal.c index 217f30a..ab69048 100644 --- a/fs/ocfs2/journal.c +++ b/fs/ocfs2/journal.c @@ -1199,7 +1199,9 @@ void ocfs2_complete_recovery(kapi_work_struct_t *work) struct ocfs2_super *osb = journal->j_osb; struct ocfs2_dinode *la_dinode, *tl_dinode; struct ocfs2_la_recovery_item *item, *n; +#ifndef SKIP_QUOTAS struct ocfs2_quota_recovery *qrec; +#endif LIST_HEAD(tmp_la_list); mlog_entry_void(); @@ -1247,6 +1249,7 @@ void ocfs2_complete_recovery(kapi_work_struct_t *work) if (ret < 0) mlog_errno(ret); +#ifndef SKIP_QUOTAS qrec = item->lri_qrec; if (qrec) { mlog(0, "Recovering quota files"); @@ -1256,6 +1259,7 @@ void ocfs2_complete_recovery(kapi_work_struct_t *work) mlog_errno(ret); /* Recovery info is already freed now */ } +#endif kfree(item); } @@ -1286,8 +1290,10 @@ static void ocfs2_queue_recovery_completion(struct ocfs2_journal *journal, if (tl_dinode) kfree(tl_dinode); +#ifndef SKIP_QUOTAS if (qrec) ocfs2_free_quota_recovery(qrec); +#endif mlog_errno(-ENOMEM); return; @@ -1343,9 +1349,11 @@ static int __ocfs2_recovery_thread(void *arg) int status, node_num, slot_num; struct ocfs2_super *osb = arg; struct ocfs2_recovery_map *rm = osb->recovery_map; +#ifndef SKIP_QUOTAS int *rm_quota = NULL; int rm_quota_used = 0, i; struct ocfs2_quota_recovery *qrec; +#endif mlog_entry_void(); @@ -1354,11 +1362,14 @@ static int __ocfs2_recovery_thread(void *arg) goto bail; } +#ifndef SKIP_QUOTAS rm_quota = kzalloc(osb->max_slots * sizeof(int), GFP_NOFS); if (!rm_quota) { status = -ENOMEM; goto bail; } +#endif + restart: status = ocfs2_super_lock(osb, 1); if (status < 0) { @@ -1390,6 +1401,7 @@ restart: } mlog(0, "node %d was using slot %d\n", node_num, slot_num); +#ifndef SKIP_QUOTAS /* It is a bit subtle with quota recovery. We cannot do it * immediately because we have to obtain cluster locks from * quota files and we also don't want to just skip it because @@ -1399,6 +1411,7 @@ restart: for (i = 0; i < rm_quota_used && rm_quota[i] != slot_num; i++); if (i == rm_quota_used) rm_quota[rm_quota_used++] = slot_num; +#endif status = ocfs2_recover_node(osb, node_num, slot_num); skip_recovery: @@ -1423,6 +1436,7 @@ skip_recovery: if (status < 0) mlog_errno(status); +#ifndef SKIP_QUOTAS /* Now it is right time to recover quotas... We have to do this under * superblock lock so that noone can start using the slot (and crash) * before we recover it */ @@ -1436,6 +1450,7 @@ skip_recovery: ocfs2_queue_recovery_completion(osb->journal, rm_quota[i], NULL, NULL, qrec); } +#endif ocfs2_super_unlock(osb, 1); @@ -1456,8 +1471,10 @@ bail: mutex_unlock(&osb->recovery_lock); +#ifndef SKIP_QUOTAS if (rm_quota) kfree(rm_quota); +#endif mlog_exit(status); /* no one is callint kthread_stop() for us so the kthread() api diff --git a/fs/ocfs2/quota.h b/fs/ocfs2/quota.h index e5df9d1..a6c99de 100644 --- a/fs/ocfs2/quota.h +++ b/fs/ocfs2/quota.h @@ -9,6 +9,8 @@ #ifndef _OCFS2_QUOTA_H #define _OCFS2_QUOTA_H +#ifndef SKIP_QUOTAS + #include <linux/types.h> #include <linux/slab.h> #include <linux/quota.h> @@ -115,4 +117,27 @@ extern struct quota_format_type ocfs2_quota_format; int ocfs2_quota_setup(void); void ocfs2_quota_shutdown(void); +#else /* SKIP_QUOTAS */ + +struct ocfs2_dquot { + unsigned long dummy; +}; + +struct ocfs2_quota_recovery { + struct list_head r_list[MAXQUOTAS]; /* List of chunks to recover */ +}; + +struct ocfs2_quota_chunk { + unsigned long dummy; +}; + +struct ocfs2_quota_recovery *ocfs2_begin_quota_recovery( + struct ocfs2_super *osb, int slot_num); +int ocfs2_finish_quota_recovery(struct ocfs2_super *osb, + struct ocfs2_quota_recovery *rec, + int slot_num); +void ocfs2_free_quota_recovery(struct ocfs2_quota_recovery *rec); + +#endif /* SKIP_QUOTAS */ + #endif /* _OCFS2_QUOTA_H */ diff --git a/fs/ocfs2/quota_global.c b/fs/ocfs2/quota_global.c index 0f319fb..24e127a 100644 --- a/fs/ocfs2/quota_global.c +++ b/fs/ocfs2/quota_global.c @@ -1,6 +1,8 @@ /* * Implementation of operations over global quota file */ + +#ifndef SKIP_QUOTAS #include <linux/spinlock.h> #include <linux/fs.h> #include <linux/quota.h> @@ -883,3 +885,4 @@ void ocfs2_quota_shutdown(void) ocfs2_quota_wq = NULL; } } +#endif /* SKIP_QUOTAS */ diff --git a/fs/ocfs2/quota_local.c b/fs/ocfs2/quota_local.c index 1a2c50a..65399f8 100644 --- a/fs/ocfs2/quota_local.c +++ b/fs/ocfs2/quota_local.c @@ -2,6 +2,8 @@ * Implementation of operations over local quota file */ +#ifndef SKIP_QUOTAS + #include <linux/fs.h> #include <linux/quota.h> #include <linux/quotaops.h> @@ -1340,3 +1342,4 @@ struct quota_format_type ocfs2_quota_format = { .qf_ops = &ocfs2_format_ops, .qf_owner = THIS_MODULE }; +#endif /* SKIP_QUOTAS */ diff --git a/fs/ocfs2/super.c b/fs/ocfs2/super.c index 0a7a621..5092558 100644 --- a/fs/ocfs2/super.c +++ b/fs/ocfs2/super.c @@ -131,9 +131,11 @@ static int ocfs2_get_sector(struct super_block *sb, int sect_size); static struct inode *ocfs2_alloc_inode(struct super_block *sb); static void ocfs2_destroy_inode(struct inode *inode); +#ifndef SKIP_QUOTAS static int ocfs2_susp_quotas(struct ocfs2_super *osb, int unsuspend); static int ocfs2_enable_quotas(struct ocfs2_super *osb); static void ocfs2_disable_quotas(struct ocfs2_super *osb); +#endif #ifdef SOP_IS_NOT_CONST static struct super_operations ocfs2_sops = { @@ -150,8 +152,10 @@ static const struct super_operations ocfs2_sops = { .put_super = ocfs2_put_super, .remount_fs = ocfs2_remount, .show_options = ocfs2_show_options, +#ifndef SKIP_QUOTAS .quota_read = ocfs2_quota_read, .quota_write = ocfs2_quota_write, +#endif }; enum { @@ -679,6 +683,7 @@ static int ocfs2_remount(struct super_block *sb, int *flags, char *data) } unlock_osb: spin_unlock(&osb->osb_lock); +#ifndef SKIP_QUOTAS /* Enable quota accounting after remounting RW */ if (!ret && !(*flags & MS_RDONLY)) { if (sb_any_quota_suspended(sb)) @@ -694,6 +699,7 @@ unlock_osb: goto out; } } +#endif } if (!ret) { @@ -858,6 +864,7 @@ static int ocfs2_verify_userspace_stack(struct ocfs2_super *osb, return 0; } +#ifndef SKIP_QUOTAS static int ocfs2_susp_quotas(struct ocfs2_super *osb, int unsuspend) { int type; @@ -982,6 +989,7 @@ static const struct quotactl_ops ocfs2_quotactl_ops = { .get_dqblk = vfs_get_dqblk, .set_dqblk = vfs_set_dqblk, }; +#endif /* SKIP_QUOTAS */ static int ocfs2_fill_super(struct super_block *sb, void *data, int silent) { @@ -1026,6 +1034,16 @@ static int ocfs2_fill_super(struct super_block *sb, void *data, int silent) } #endif +#ifdef SKIP_QUOTAS + if (OCFS2_HAS_RO_COMPAT_FEATURE(sb, OCFS2_FEATURE_RO_COMPAT_USRQUOTA) || + OCFS2_HAS_RO_COMPAT_FEATURE(sb, OCFS2_FEATURE_RO_COMPAT_GRPQUOTA)) { + status = -EINVAL; + mlog(ML_ERROR, "File system cannot mount volume with the Quotas" + "feature enabled.\n"); + goto read_super_error; + } +#endif + if (!(osb->s_feature_incompat & OCFS2_FEATURE_INCOMPAT_XATTR)) parsed_options.mount_opt &= ~OCFS2_MOUNT_POSIX_ACL; @@ -1181,6 +1199,7 @@ static int ocfs2_fill_super(struct super_block *sb, void *data, int silent) atomic_set(&osb->vol_state, VOLUME_MOUNTED); wake_up(&osb->osb_mount_event); +#ifndef SKIP_QUOTAS /* Now we can initialize quotas because we can afford to wait * for cluster locks recovery now. That also means that truncation * log recovery can happen but that waits for proper quota setup */ @@ -1196,6 +1215,7 @@ static int ocfs2_fill_super(struct super_block *sb, void *data, int silent) return status; } } +#endif ocfs2_complete_quota_recovery(osb); @@ -1987,8 +2007,10 @@ static int ocfs2_initialize_super(struct super_block *sb, sb->s_fs_info = osb; sb->s_op = &ocfs2_sops; sb->s_export_op = &ocfs2_export_ops; +#ifndef SKIP_QUOTAS sb->s_qcop = &ocfs2_quotactl_ops; sb->dq_op = &ocfs2_quota_operations; +#endif sb->s_xattr = ocfs2_xattr_handlers; sb->s_time_gran = 1; sb->s_flags |= MS_NOATIME; diff --git a/kapi-compat/include/quotas.h b/kapi-compat/include/quotas.h new file mode 100644 index 0000000..0f03805 --- /dev/null +++ b/kapi-compat/include/quotas.h @@ -0,0 +1,19 @@ +#ifndef KAPI_QUOTAS_H +#define KAPI_QUOTAS_H + +#define vfs_dq_alloc_space_nodirty DQUOT_ALLOC_SPACE_NODIRTY +#define vfs_dq_free_space_nodirty DQUOT_FREE_SPACE_NODIRTY +#define vfs_dq_transfer DQUOT_TRANSFER +#define vfs_dq_free_space DQUOT_FREE_SPACE +#define vfs_dq_free_inode DQUOT_FREE_INODE +#define vfs_dq_init DQUOT_INIT +#define register_quota_format(a) 0 +#define unregister_quota_format(a) +#define sb_any_quota_active(a) 0 +#define ocfs2_quota_shutdown() +#define ocfs2_quota_setup() 0 +#define ocfs2_disable_quotas(a) +#define ocfs2_susp_quotas(a, b) 0 + +#endif + -- 1.5.6.5
Sunil Mushran
2009-Nov-21 01:12 UTC
[Ocfs2-devel] [PATCH 09/10] ocfs2: Temporarily disable NFS exports
We have no intention of disabling NFS exports in OCFS2 1.6. However, writing a clean patch to enable it in EL5 will take sometime. This is being done only because we want to start testing the fs now. TODO: Enable NFS exports Signed-off-by: Sunil Mushran <sunil.mushran at oracle.com> --- Config.make.in | 1 + configure.in | 2 ++ fs/ocfs2/Makefile | 4 ++++ fs/ocfs2/export.c | 4 ++++ fs/ocfs2/export.h | 3 +++ fs/ocfs2/super.c | 2 ++ 6 files changed, 16 insertions(+), 0 deletions(-) diff --git a/Config.make.in b/Config.make.in index 8675982..acbe8fd 100644 --- a/Config.make.in +++ b/Config.make.in @@ -83,6 +83,7 @@ SKIP_BUFFER_TRIGGERS = @SKIP_BUFFER_TRIGGERS@ NO_NAME_IN_BACKING_DEV_INFO=@NO_NAME_IN_BACKING_DEV_INFO@ NO_KOBJ_ATTRIBUTE = @NO_KOBJ_ATTRIBUTE@ SKIP_QUOTAS= @SKIP_QUOTAS@ +SKIP_EXPORTS= @SKIP_EXPORTS@ OCFS_DEBUG = @OCFS_DEBUG@ diff --git a/configure.in b/configure.in index 3dfe596..9913820 100644 --- a/configure.in +++ b/configure.in @@ -452,6 +452,8 @@ OCFS2_CHECK_KERNEL([new quota format in dqblk_qtree.h], dqblk_qtree.h, AC_SUBST(SKIP_QUOTAS) KAPI_COMPAT_HEADERS="$KAPI_COMPAT_HEADERS $SKIP_QUOTAS" +SKIP_EXPORTS=yes + # End kapi_compat checks # using -include has two advantages: diff --git a/fs/ocfs2/Makefile b/fs/ocfs2/Makefile index 7a03c94..848c121 100644 --- a/fs/ocfs2/Makefile +++ b/fs/ocfs2/Makefile @@ -132,6 +132,10 @@ ifdef SKIP_QUOTAS EXTRA_CFLAGS += -DSKIP_QUOTAS endif +ifdef SKIP_EXPORTS +EXTRA_CFLAGS += -DSKIP_EXPORTS +endif + # # Since SUBDIRS means something to kbuild, define them safely. Do not # include trailing slashes. diff --git a/fs/ocfs2/export.c b/fs/ocfs2/export.c index fce7d23..e2a584f 100644 --- a/fs/ocfs2/export.c +++ b/fs/ocfs2/export.c @@ -23,6 +23,8 @@ * Boston, MA 021110-1307, USA. */ +#ifndef SKIP_EXPORTS + #include <linux/fs.h> #include <linux/types.h> @@ -285,3 +287,5 @@ const struct export_operations ocfs2_export_ops = { .fh_to_parent = ocfs2_fh_to_parent, .get_parent = ocfs2_get_parent, }; + +#endif /* SKIP_EXPORTS */ diff --git a/fs/ocfs2/export.h b/fs/ocfs2/export.h index 0707bf3..1f93127 100644 --- a/fs/ocfs2/export.h +++ b/fs/ocfs2/export.h @@ -26,6 +26,8 @@ #ifndef OCFS2_EXPORT_H #define OCFS2_EXPORT_H +#ifndef SKIP_EXPORTS + #include <linux/exportfs.h> #ifdef EXPORTOP_IS_NOT_CONST @@ -34,4 +36,5 @@ extern struct export_operations ocfs2_export_ops; extern const struct export_operations ocfs2_export_ops; #endif +#endif #endif /* OCFS2_EXPORT_H */ diff --git a/fs/ocfs2/super.c b/fs/ocfs2/super.c index 5092558..f6e2c69 100644 --- a/fs/ocfs2/super.c +++ b/fs/ocfs2/super.c @@ -2006,7 +2006,9 @@ static int ocfs2_initialize_super(struct super_block *sb, sb->s_fs_info = osb; sb->s_op = &ocfs2_sops; +#ifndef SKIP_EXPORTS sb->s_export_op = &ocfs2_export_ops; +#endif #ifndef SKIP_QUOTAS sb->s_qcop = &ocfs2_quotactl_ops; sb->dq_op = &ocfs2_quota_operations; -- 1.5.6.5
Sunil Mushran
2009-Nov-21 01:12 UTC
[Ocfs2-devel] [PATCH 10/10] ocfs2: Handle missing cancel_work_sync()
Mainline commit 28e53bddf814485699a4142bc056fd37d4e11dd4 added helper cancel_work_sync(). The patch adds a helper with the same name that cancels pending work and flushes the workqueues. Signed-off-by: Sunil Mushran <sunil.mushran at oracle.com> --- Makefile | 3 ++- configure.in | 5 +++++ kapi-compat/include/cancel_work_sync.h | 14 ++++++++++++++ 3 files changed, 21 insertions(+), 1 deletions(-) create mode 100644 kapi-compat/include/cancel_work_sync.h diff --git a/Makefile b/Makefile index 07adc70..f285238 100644 --- a/Makefile +++ b/Makefile @@ -40,7 +40,8 @@ KAPI_COMPAT_FILES = \ kapi-compat/include/hardsect.h \ kapi-compat/include/triggers.h \ kapi-compat/include/compat_kobject.h \ - kapi-compat/include/quotas.h + kapi-compat/include/quotas.h \ + kapi-compat/include/cancel_work_sync.h PATCH_FILES diff --git a/configure.in b/configure.in index 9913820..405e1a5 100644 --- a/configure.in +++ b/configure.in @@ -454,6 +454,11 @@ KAPI_COMPAT_HEADERS="$KAPI_COMPAT_HEADERS $SKIP_QUOTAS" SKIP_EXPORTS=yes +cancel_work_sync_header+OCFS2_CHECK_KERNEL([cancel_work_sync() in workqueue.h], workqueue.h, + , cancel_work_sync_header=cancel_work_sync.h, [extern int cancel_work_sync(struct work_struct]) +KAPI_COMPAT_HEADERS="$KAPI_COMPAT_HEADERS $cancel_work_sync_header" + # End kapi_compat checks # using -include has two advantages: diff --git a/kapi-compat/include/cancel_work_sync.h b/kapi-compat/include/cancel_work_sync.h new file mode 100644 index 0000000..226362e --- /dev/null +++ b/kapi-compat/include/cancel_work_sync.h @@ -0,0 +1,14 @@ +#ifndef KAPI_CANCEL_WORK_SYNC_H +#define KAPI_CANCEL_WORK_SYNC_H + +static inline int cancel_work_sync(struct work_struct *work) +{ + int ret; + + ret = cancel_delayed_work(work); + if (!ret) + flush_scheduled_work(); + return ret; +} + +#endif -- 1.5.6.5
On Fri, Nov 20, 2009 at 05:12:47PM -0800, Sunil Mushran wrote:> All previous patches have been pushed to the git repo. With this set, we > can start building the fs on el5 u4. More importantly, the testing can begin. > > Yes, this set disables few features. But that is only temporary. Details are > provided in the specific patches.It's yucky, but I know what you're doing. I hope we're going to be able to re-enable quotas? Acked Joel -- "What do you take me for, an idiot?" - General Charles de Gaulle, when a journalist asked him if he was happy. Joel Becker Principal Software Developer Oracle E-mail: joel.becker at oracle.com Phone: (650) 506-8127