Hi Folks,
Attached is a patch to bring the entire STABLE branch of cluster
suite up to date so that it compiles against newer upstream kernels.
I used Linus' upstream kernel, 2.6.20-rc7. I'm posting it here rather
than just committing it to CVS to give everyone a chance to eyeball
it first. Here's what changed:
1. It compiles against the new kernel.
2. It should no longer cause a kernel panic in do_add_mount.
3. Included are the recent AIO changes to GFS.
The code hasn't seen much testing, so beware. I've done some general
I/O testing but it probably should NOT be considered production ready.
As stated before, there are basically two separate cluster worlds now:
The cman-kernel way of doing things (e.g. RHEL4, STABLE) and
the openais way of doing things (e.g. RHEL5, HEAD). They can't be
mixed and matched. The place where those world collide is in clvmd,
the clustered lvm2. In RHEL5, the clvmd works with the openais-based
cluster code (obviously). To get clvmd to work properly with the
STABLE branch on a RHEL5 system, I had to do some minimal
patching and compile it from source. I didn't try it with the RHEL4
version of clvmd because I wanted to compare GFS performance of the
two infrastructures, so I did my testing on the same RHEL5 cluster.
The performance test was also why I integrated the aio changes.
(BTW, performance was the same between the two infrastructures,
but this wasn't a very good performance test).
This is NOT meant to catch STABLE up with RHEL4, so there might be
other little changes between RHEL4 and STABLE. I'll go
through and try to clean that up sometime after this is committed.
If some of you want to try it out and let me know I'd appreciate it.
Regards,
Bob Peterson
Red Hat Cluster Suite
Index: cman/lib/libcman.c
===================================================================
RCS file: /cvs/cluster/cluster/cman/lib/libcman.c,v
retrieving revision 1.3.6.1.2.5
diff -w -u -p -p -u -r1.3.6.1.2.5 libcman.c
--- cman/lib/libcman.c 26 Apr 2006 08:55:26 -0000 1.3.6.1.2.5
+++ cman/lib/libcman.c 2 Feb 2007 22:28:40 -0000
@@ -501,3 +501,7 @@ int cman_set_votes(cman_handle_t handle,
return ioctl(h->fd, SIOCCLUSTER_SET_VOTES, nodeid, sizeof(int));
}
+int cman_replyto_shutdown(cman_handle_t handle, int yesno)
+{
+ return 0;
+}
Index: cman/lib/libcman.h
===================================================================
RCS file: /cvs/cluster/cluster/cman/lib/libcman.h,v
retrieving revision 1.2.6.1.2.6
diff -w -u -p -p -u -r1.2.6.1.2.6 libcman.h
--- cman/lib/libcman.h 1 Sep 2006 08:37:10 -0000 1.2.6.1.2.6
+++ cman/lib/libcman.h 2 Feb 2007 22:28:40 -0000
@@ -162,4 +162,5 @@ int cman_register_quorum_device(cman_han
int cman_unregister_quorum_device(cman_handle_t handle);
int cman_poll_quorum_device(cman_handle_t handle, int isavailable);
+int cman_replyto_shutdown(cman_handle_t handle, int yesno);
#endif
Index: cman-kernel/src/cnxman.c
===================================================================
RCS file: /cvs/cluster/cluster/cman-kernel/src/Attic/cnxman.c,v
retrieving revision 1.42.2.12.4.1.2.14
diff -w -u -p -p -u -r1.42.2.12.4.1.2.14 cnxman.c
--- cman-kernel/src/cnxman.c 19 Jan 2007 10:24:46 -0000 1.42.2.12.4.1.2.14
+++ cman-kernel/src/cnxman.c 2 Feb 2007 22:28:40 -0000
@@ -1760,7 +1760,7 @@ static int do_ioctl_join_cluster(unsigne
/* Make sure we have a node name */
if (nodename[0] == '\0')
- strcpy(nodename, system_utsname.nodename);
+ strcpy(nodename, init_utsname()->nodename);
membership_pid = start_membership_services(kcluster_pid);
if (membership_pid < 0) {
Index: dlm-kernel/src/lowcomms.c
===================================================================
RCS file: /cvs/cluster/cluster/dlm-kernel/src/Attic/lowcomms.c,v
retrieving revision 1.22.2.8.4.2.2.2
diff -w -u -p -p -u -r1.22.2.8.4.2.2.2 lowcomms.c
--- dlm-kernel/src/lowcomms.c 20 Dec 2005 09:22:04 -0000 1.22.2.8.4.2.2.2
+++ dlm-kernel/src/lowcomms.c 2 Feb 2007 22:28:41 -0000
@@ -133,7 +133,7 @@ static wait_queue_head_t lowcomms_recv_w
/* An array of pointers to connections, indexed by NODEID */
static struct connection **connections;
static struct semaphore connections_lock;
-static kmem_cache_t *con_cache;
+static struct kmem_cache *con_cache;
static int conn_array_size;
static atomic_t accepting;
Index: dlm-kernel/src/memory.c
===================================================================
RCS file: /cvs/cluster/cluster/dlm-kernel/src/Attic/memory.c,v
retrieving revision 1.3
diff -w -u -p -p -u -r1.3 memory.c
--- dlm-kernel/src/memory.c 15 Jul 2004 07:45:57 -0000 1.3
+++ dlm-kernel/src/memory.c 2 Feb 2007 22:28:41 -0000
@@ -24,12 +24,12 @@
/* as the man says...Shouldn't this be in a header file somewhere? */
#define BYTES_PER_WORD sizeof(void *)
-static kmem_cache_t *rsb_cache_small;
-static kmem_cache_t *rsb_cache_large;
-static kmem_cache_t *lkb_cache;
-static kmem_cache_t *lvb_cache;
-static kmem_cache_t *resdir_cache_large;
-static kmem_cache_t *resdir_cache_small;
+static struct kmem_cache *rsb_cache_small;
+static struct kmem_cache *rsb_cache_large;
+static struct kmem_cache *lkb_cache;
+static struct kmem_cache *lvb_cache;
+static struct kmem_cache *resdir_cache_large;
+static struct kmem_cache *resdir_cache_small;
/* The thresholds above which we allocate large RSBs/direntry rather than small
* ones. This must make the resultant structure end on a word boundary */
Index: gfs-kernel/src/dlm/lock_dlm.h
===================================================================
RCS file: /cvs/cluster/cluster/gfs-kernel/src/dlm/Attic/lock_dlm.h,v
retrieving revision 1.18.2.3.6.3
diff -w -u -p -p -u -r1.18.2.3.6.3 lock_dlm.h
--- gfs-kernel/src/dlm/lock_dlm.h 8 Dec 2006 17:27:44 -0000 1.18.2.3.6.3
+++ gfs-kernel/src/dlm/lock_dlm.h 2 Feb 2007 22:28:41 -0000
@@ -24,10 +24,11 @@
#include <linux/socket.h>
#include <linux/kthread.h>
#include <net/sock.h>
-#include <linux/lm_interface.h>
-#include <cluster/cnxman.h>
-#include <cluster/service.h>
-#include <cluster/dlm.h>
+
+#include "lm_interface.h"
+#include "cluster/cnxman.h"
+#include "cluster/service.h"
+#include "cluster/dlm.h"
/* We take a shortcut and use lm_lockname structs for internal locks. This
means we must be careful to keep these types different from those used in
Index: gfs-kernel/src/gfs/diaper.c
===================================================================
RCS file: /cvs/cluster/cluster/gfs-kernel/src/gfs/Attic/diaper.c,v
retrieving revision 1.1.2.1.4.1.2.1
diff -w -u -p -p -u -r1.1.2.1.4.1.2.1 diaper.c
--- gfs-kernel/src/gfs/diaper.c 26 Jun 2006 21:53:51 -0000 1.1.2.1.4.1.2.1
+++ gfs-kernel/src/gfs/diaper.c 2 Feb 2007 22:28:41 -0000
@@ -50,7 +50,7 @@ static int diaper_major = 0;
static LIST_HEAD(diaper_list);
static spinlock_t diaper_lock;
static DEFINE_IDR(diaper_idr);
-kmem_cache_t *diaper_slab;
+struct kmem_cache *diaper_slab;
/**
* diaper_open -
@@ -232,9 +232,9 @@ get_dummy_sb(struct diaper_holder *dh)
struct inode *inode;
int error;
- mutex_lock(&real->bd_mount_mutex);
+ down(&real->bd_mount_sem);
sb = sget(&gfs_fs_type, gfs_test_bdev_super, gfs_set_bdev_super, real);
- mutex_unlock(&real->bd_mount_mutex);
+ up(&real->bd_mount_sem);
if (IS_ERR(sb))
return PTR_ERR(sb);
@@ -252,7 +252,6 @@ get_dummy_sb(struct diaper_holder *dh)
sb->s_op = &gfs_dummy_sops;
sb->s_fs_info = dh;
- up_write(&sb->s_umount);
module_put(gfs_fs_type.owner);
dh->dh_dummy_sb = sb;
@@ -263,7 +262,6 @@ get_dummy_sb(struct diaper_holder *dh)
iput(inode);
fail:
- up_write(&sb->s_umount);
deactivate_super(sb);
return error;
}
Index: gfs-kernel/src/gfs/dir.c
===================================================================
RCS file: /cvs/cluster/cluster/gfs-kernel/src/gfs/dir.c,v
retrieving revision 1.8.6.1.2.3
diff -w -u -p -p -u -r1.8.6.1.2.3 dir.c
--- gfs-kernel/src/gfs/dir.c 29 Jun 2006 16:50:41 -0000 1.8.6.1.2.3
+++ gfs-kernel/src/gfs/dir.c 2 Feb 2007 22:28:41 -0000
@@ -2213,7 +2213,7 @@ leaf_free(struct gfs_inode *dip,
dip->i_di.di_blocks--;
}
- error = gfs_writei(dip, ht, index * sizeof (uint64_t), size, gfs_zero_blocks);
+ error = gfs_writei(dip, ht, index * sizeof (uint64_t), size, gfs_zero_blocks, NULL);
if (error != size) {
if (error >= 0)
Index: gfs-kernel/src/gfs/file.c
===================================================================
RCS file: /cvs/cluster/cluster/gfs-kernel/src/gfs/file.c,v
retrieving revision 1.4.6.1.2.1
diff -w -u -p -p -u -r1.4.6.1.2.1 file.c
--- gfs-kernel/src/gfs/file.c 20 Feb 2006 03:55:31 -0000 1.4.6.1.2.1
+++ gfs-kernel/src/gfs/file.c 2 Feb 2007 22:28:41 -0000
@@ -306,7 +306,8 @@ gfs_copy_from_user(struct gfs_inode *ip,
int
gfs_writei(struct gfs_inode *ip, void *buf,
uint64_t offset, unsigned int size,
- write_copy_fn_t copy_fn)
+ write_copy_fn_t copy_fn,
+ struct kiocb *iocb)
{
struct gfs_sbd *sdp = ip->i_sbd;
struct buffer_head *dibh, *bh;
Index: gfs-kernel/src/gfs/file.h
===================================================================
RCS file: /cvs/cluster/cluster/gfs-kernel/src/gfs/file.h,v
retrieving revision 1.2.8.1
diff -w -u -p -p -u -r1.2.8.1 file.h
--- gfs-kernel/src/gfs/file.h 20 Feb 2006 03:55:31 -0000 1.2.8.1
+++ gfs-kernel/src/gfs/file.h 2 Feb 2007 22:28:41 -0000
@@ -32,7 +32,8 @@ int gfs_copy_from_mem(struct gfs_inode *
int gfs_copy_from_user(struct gfs_inode *ip, struct buffer_head *bh, void **buf,
unsigned int offset, unsigned int size, int new);
int gfs_writei(struct gfs_inode *ip, void *buf, uint64_t offset,
- unsigned int size, write_copy_fn_t copy_fn);
+ unsigned int size, write_copy_fn_t copy_fn,
+ struct kiocb *iocb);
int gfs_zero_blocks(struct gfs_inode *ip, struct buffer_head *bh, void **buf,
unsigned int offset, unsigned int size, int new);
@@ -48,7 +49,7 @@ static __inline__ int
gfs_internal_write(struct gfs_inode *ip, char *buf, uint64_t offset,
unsigned int size)
{
- return gfs_writei(ip, buf, offset, size, gfs_copy_from_mem);
+ return gfs_writei(ip, buf, offset, size, gfs_copy_from_mem, NULL);
}
#endif /* __FILE_DOT_H__ */
Index: gfs-kernel/src/gfs/gfs.h
===================================================================
RCS file: /cvs/cluster/cluster/gfs-kernel/src/gfs/gfs.h,v
retrieving revision 1.5.6.1
diff -w -u -p -p -u -r1.5.6.1 gfs.h
--- gfs-kernel/src/gfs/gfs.h 26 Apr 2005 18:33:10 -0000 1.5.6.1
+++ gfs-kernel/src/gfs/gfs.h 2 Feb 2007 22:28:41 -0000
@@ -16,9 +16,9 @@
#define GFS_RELEASE_NAME "<CVS>"
-#include <linux/lm_interface.h>
#include <linux/gfs_ondisk.h>
+#include "lm_interface.h"
#include "fixed_div64.h"
#include "lvb.h"
#include "incore.h"
@@ -67,8 +67,8 @@
#define get_v2sdp(sb) ((struct gfs_sbd *)(sb)->s_fs_info)
#define set_v2sdp(sb, sdp) (sb)->s_fs_info = (sdp)
-#define get_v2ip(inode) ((struct gfs_inode *)(inode)->u.generic_ip)
-#define set_v2ip(inode, ip) (inode)->u.generic_ip = (ip)
+#define get_v2ip(inode) ((struct gfs_inode *)(inode)->i_private)
+#define set_v2ip(inode, ip) (inode)->i_private = (ip)
#define get_v2fp(file) ((struct gfs_file *)(file)->private_data)
#define set_v2fp(file, fp) (file)->private_data = (fp)
#define get_v2bd(bh) ((struct gfs_bufdata *)(bh)->b_private)
Index: gfs-kernel/src/gfs/glock.c
===================================================================
RCS file: /cvs/cluster/cluster/gfs-kernel/src/gfs/glock.c,v
retrieving revision 1.20.2.1.4.1.2.2
diff -w -u -p -p -u -r1.20.2.1.4.1.2.2 glock.c
--- gfs-kernel/src/gfs/glock.c 17 May 2006 15:28:24 -0000 1.20.2.1.4.1.2.2
+++ gfs-kernel/src/gfs/glock.c 2 Feb 2007 22:28:42 -0000
@@ -38,7 +38,7 @@ struct glock_plug {
struct greedy {
struct gfs_holder gr_gh;
- struct work_struct gr_work;
+ struct delayed_work gr_work;
};
typedef void (*glock_examiner) (struct gfs_glock * gl);
@@ -1747,9 +1747,9 @@ gfs_glock_force_drop(struct gfs_glock *g
*/
static void
-greedy_work(void *data)
+greedy_work(struct work_struct *work)
{
- struct greedy *gr = (struct greedy *)data;
+ struct greedy *gr = container_of(work, struct greedy, gr_work.work);
struct gfs_holder *gh = &gr->gr_gh;
struct gfs_glock *gl = gh->gh_gl;
struct gfs_glock_operations *glops = gl->gl_ops;
@@ -1804,7 +1804,7 @@ gfs_glock_be_greedy(struct gfs_glock *gl
gfs_holder_init(gl, 0, 0, gh);
set_bit(HIF_GREEDY, &gh->gh_iflags);
gh->gh_owner = NULL;
- INIT_WORK(&gr->gr_work, greedy_work, gr);
+ INIT_DELAYED_WORK(&gr->gr_work, greedy_work);
set_bit(GLF_SKIP_WAITERS2, &gl->gl_flags);
schedule_delayed_work(&gr->gr_work, time);
Index: gfs-kernel/src/gfs/inode.c
===================================================================
RCS file: /cvs/cluster/cluster/gfs-kernel/src/gfs/inode.c,v
retrieving revision 1.20.6.2.2.2
diff -w -u -p -p -u -r1.20.6.2.2.2 inode.c
--- gfs-kernel/src/gfs/inode.c 18 Sep 2005 03:01:24 -0000 1.20.6.2.2.2
+++ gfs-kernel/src/gfs/inode.c 2 Feb 2007 22:28:42 -0000
@@ -97,7 +97,6 @@ inode_attr_in(struct gfs_inode *ip, stru
inode->i_mtime.tv_sec = ip->i_di.di_mtime;
inode->i_ctime.tv_sec = ip->i_di.di_ctime;
inode->i_atime.tv_nsec = inode->i_mtime.tv_nsec = inode->i_ctime.tv_nsec = 0;
- inode->i_blksize = PAGE_SIZE;
inode->i_blocks = ip->i_di.di_blocks <<
(ip->i_sbd->sd_sb.sb_bsize_shift - GFS_BASIC_BLOCK_SHIFT);
inode->i_generation = ip->i_di.di_header.mh_incarn;
Index: gfs-kernel/src/gfs/ioctl.c
===================================================================
RCS file: /cvs/cluster/cluster/gfs-kernel/src/gfs/ioctl.c,v
retrieving revision 1.7.6.1.2.2
diff -w -u -p -p -u -r1.7.6.1.2.2 ioctl.c
--- gfs-kernel/src/gfs/ioctl.c 13 Nov 2006 22:48:06 -0000 1.7.6.1.2.2
+++ gfs-kernel/src/gfs/ioctl.c 2 Feb 2007 22:28:42 -0000
@@ -1231,7 +1231,7 @@ gi_do_hfile_write(struct gfs_sbd *sdp, s
}
error = gfs_writei(ip, gi->gi_data, gi->gi_offset, gi->gi_size,
- gfs_copy_from_user);
+ gfs_copy_from_user, NULL);
gfs_trans_end(sdp);
Index: gfs-kernel/src/gfs/ops_file.c
===================================================================
RCS file: /cvs/cluster/cluster/gfs-kernel/src/gfs/ops_file.c,v
retrieving revision 1.16.6.2.2.7
diff -w -u -p -p -u -r1.16.6.2.2.7 ops_file.c
--- gfs-kernel/src/gfs/ops_file.c 17 Jan 2007 22:30:12 -0000 1.16.6.2.2.7
+++ gfs-kernel/src/gfs/ops_file.c 2 Feb 2007 22:28:42 -0000
@@ -76,6 +76,7 @@ struct filldir_reg {
typedef ssize_t(*do_rw_t) (struct file * file,
char *buf,
size_t size, loff_t * offset,
+ struct kiocb *iocb,
unsigned int num_gh, struct gfs_holder * ghs);
/**
@@ -129,7 +130,7 @@ gfs_llseek(struct file *file, loff_t off
static ssize_t
walk_vm_hard(struct file *file, char *buf, size_t size, loff_t *offset,
- do_rw_t operation)
+ struct kiocb *iocb, do_rw_t operation)
{
struct gfs_holder *ghs;
unsigned int num_gh = 0;
@@ -178,7 +179,7 @@ walk_vm_hard(struct file *file, char *bu
gfs_assert(get_v2sdp(sb), x == num_gh,);
}
- count = operation(file, buf, size, offset, num_gh, ghs);
+ count = operation(file, buf, size, offset, iocb, num_gh, ghs);
while (num_gh--)
gfs_holder_uninit(&ghs[num_gh]);
@@ -204,7 +205,7 @@ walk_vm_hard(struct file *file, char *bu
static ssize_t
walk_vm(struct file *file, char *buf, size_t size, loff_t *offset,
- do_rw_t operation)
+ struct kiocb *iocb, do_rw_t operation)
{
if (current->mm) {
struct super_block *sb = file->f_dentry->d_inode->i_sb;
@@ -231,11 +232,11 @@ walk_vm(struct file *file, char *buf, si
{
struct gfs_holder gh;
- return operation(file, buf, size, offset, 0, &gh);
+ return operation(file, buf, size, offset, iocb, 0, &gh);
}
do_locks:
- return walk_vm_hard(file, buf, size, offset, operation);
+ return walk_vm_hard(file, buf, size, offset, iocb, operation);
}
/**
@@ -250,7 +251,8 @@ walk_vm(struct file *file, char *buf, si
*/
static ssize_t
-do_read_readi(struct file *file, char *buf, size_t size, loff_t *offset)
+do_read_readi(struct file *file, char *buf, size_t size, loff_t *offset,
+ struct kiocb *iocb)
{
struct gfs_inode *ip = get_v2ip(file->f_mapping->host);
ssize_t count = 0;
@@ -291,6 +293,7 @@ do_read_readi(struct file *file, char *b
static ssize_t
do_read_direct(struct file *file, char *buf, size_t size, loff_t *offset,
+ struct kiocb *iocb,
unsigned int num_gh, struct gfs_holder *ghs)
{
struct inode *inode = file->f_mapping->host;
@@ -324,10 +327,18 @@ do_read_direct(struct file *file, char *
if (((*offset) & mask) || (((unsigned long)buf) & mask))
goto out_gunlock;
- count = do_read_readi(file, buf, size & ~mask, offset);
+ count = do_read_readi(file, buf, size & ~mask, offset, iocb);
+ }
+ else {
+ if (!iocb)
+ count = do_sync_read(file, buf, size, offset);
+ else {
+ struct iovec local_iov = { .iov_base = buf, .iov_len = size};
+
+ count = generic_file_aio_read(iocb, &local_iov, 1, *offset);
+ iocb->ki_pos = *offset;
+ }
}
- else
- count = generic_file_read(file, buf, size, offset);
error = 0;
@@ -356,6 +367,7 @@ do_read_direct(struct file *file, char *
static ssize_t
do_read_buf(struct file *file, char *buf, size_t size, loff_t *offset,
+ struct kiocb *iocb,
unsigned int num_gh, struct gfs_holder *ghs)
{
struct gfs_inode *ip = get_v2ip(file->f_mapping->host);
@@ -370,9 +382,17 @@ do_read_buf(struct file *file, char *buf
if (gfs_is_jdata(ip) ||
(gfs_is_stuffed(ip) && !test_bit(GIF_PAGED, &ip->i_flags)))
- count = do_read_readi(file, buf, size, offset);
- else
- count = generic_file_read(file, buf, size, offset);
+ count = do_read_readi(file, buf, size, offset, iocb);
+ else {
+ if (!iocb) {
+ count = do_sync_read(file, buf, size, offset);
+ } else {
+ struct iovec local_iov = { .iov_base = buf, .iov_len = size};
+
+ count = generic_file_aio_read(iocb, &local_iov, 1, *offset);
+ iocb->ki_pos = *offset;
+ }
+ }
gfs_glock_dq_m(num_gh + 1, ghs);
@@ -382,6 +402,18 @@ do_read_buf(struct file *file, char *buf
return (count) ? count : error;
}
+static ssize_t
+__gfs_read(struct file *file, char *buf, size_t size, loff_t *offset,
+ struct kiocb *iocb)
+{
+ atomic_inc(&get_v2sdp(file->f_mapping->host->i_sb)->sd_ops_file);
+
+ if (file->f_flags & O_DIRECT)
+ return walk_vm(file, buf, size, offset, iocb, do_read_direct);
+ else
+ return walk_vm(file, buf, size, offset, iocb, do_read_buf);
+}
+
/**
* gfs_read - Read bytes from a file
* @file: The file to read from
@@ -397,12 +429,21 @@ do_read_buf(struct file *file, char *buf
static ssize_t
gfs_read(struct file *file, char *buf, size_t size, loff_t *offset)
{
- atomic_inc(&get_v2sdp(file->f_mapping->host->i_sb)->sd_ops_file);
+ return(__gfs_read(file, buf, size, offset, NULL));
+}
- if (file->f_flags & O_DIRECT)
- return walk_vm(file, buf, size, offset, do_read_direct);
- else
- return walk_vm(file, buf, size, offset, do_read_buf);
+/*
+ * gfs_aio_read: match with vfs generic_file_aio_read as:
+ * (struct kiocb *iocb, char __user *buf, size_t count, loff_t pos)
+ */
+static ssize_t
+gfs_aio_read(struct kiocb *iocb, const struct iovec *iov, unsigned long count,
+ loff_t pos)
+{
+ struct file *filp = iocb->ki_filp;
+
+ BUG_ON(iocb->ki_pos != pos);
+ return(__gfs_read(filp, iov->iov_base, iov->iov_len, &iocb->ki_pos, iocb));
}
/**
@@ -437,6 +478,41 @@ grope_mapping(char *buf, size_t size)
}
/**
+ * gfs_file_aio_write_nolock - Call vfs aio layer to write bytes to a file
+ * @file: The file to write to
+ * @buf: The buffer to copy from
+ * @size: The amount of data requested
+ * @offset: The offset in the file to write
+ * @iocb: The io control block. If NULL, a temporary one will be used.
+ *
+ * Returns: The number of bytes written, errno on failure
+ */
+static ssize_t
+gfs_file_aio_write_nolock(struct file *file, char *buf, size_t size,
+ loff_t *offset, struct kiocb *iocb)
+{
+ struct iovec local_iov = { .iov_base = buf, .iov_len = size };
+ struct kiocb local_iocb, *kiocb = NULL;
+ ssize_t count;
+
+ if (!iocb) {
+ init_sync_kiocb(&local_iocb, file);
+ local_iocb.ki_nr_segs = 1;
+ kiocb = &local_iocb;
+ }
+ else
+ kiocb = iocb;
+
+ kiocb->ki_pos = *offset;
+ count = generic_file_aio_write_nolock(kiocb, &local_iov, kiocb->ki_nr_segs,
+ kiocb->ki_pos);
+ *offset = kiocb->ki_pos;
+ if (kiocb == &local_iocb && count == -EIOCBQUEUED)
+ count = wait_on_sync_kiocb(kiocb);
+ return count;
+}
+
+/**
* do_write_direct_alloc - Write bytes to a file
* @file: The file to write to
* @buf: The buffer to copy from
@@ -449,13 +525,13 @@ grope_mapping(char *buf, size_t size)
*/
static ssize_t
-do_write_direct_alloc(struct file *file, char *buf, size_t size, loff_t *offset)
+do_write_direct_alloc(struct file *file, char *buf, size_t size, loff_t *offset,
+ struct kiocb *iocb)
{
struct inode *inode = file->f_mapping->host;
struct gfs_inode *ip = get_v2ip(inode);
struct gfs_sbd *sdp = ip->i_sbd;
struct gfs_alloc *al = NULL;
- struct iovec local_iov = { .iov_base = buf, .iov_len = size };
struct buffer_head *dibh;
unsigned int data_blocks, ind_blocks;
ssize_t count;
@@ -508,7 +584,7 @@ do_write_direct_alloc(struct file *file,
goto fail_end_trans;
}
- count = generic_file_write_nolock(file, &local_iov, 1, offset);
+ count = gfs_file_aio_write_nolock(file, buf, size, offset, iocb);
if (count < 0) {
error = count;
goto fail_end_trans;
@@ -576,6 +652,7 @@ do_write_direct_alloc(struct file *file,
static ssize_t
do_write_direct(struct file *file, char *buf, size_t size, loff_t *offset,
+ struct kiocb *iocb,
unsigned int num_gh, struct gfs_holder *ghs)
{
struct gfs_inode *ip = get_v2ip(file->f_mapping->host);
@@ -646,13 +723,19 @@ do_write_direct(struct file *file, char
if (alloc_required) {
set_bit(GFF_DID_DIRECT_ALLOC, &fp->f_flags);
+ /* for asynchronous IO, the buffer can not be splitted */
+ if (iocb) {
+ count = do_write_direct_alloc(file, buf, size, offset, iocb);
+ goto out_iocb_write;
+ }
+
/* split large writes into smaller atomic transactions */
while (size) {
s = gfs_tune_get(sdp, gt_max_atomic_write);
if (s > size)
s = size;
- error = do_write_direct_alloc(file, buf, s, offset);
+ error = do_write_direct_alloc(file, buf, s, offset, iocb);
if (error < 0)
goto out_gunlock;
@@ -661,7 +744,6 @@ do_write_direct(struct file *file, char
count += error;
}
} else {
- struct iovec local_iov = { .iov_base = buf, .iov_len = size };
struct gfs_holder t_gh;
clear_bit(GFF_DID_DIRECT_ALLOC, &fp->f_flags);
@@ -670,11 +752,11 @@ do_write_direct(struct file *file, char
if (error)
goto out_gunlock;
- count = generic_file_write_nolock(file, &local_iov, 1, offset);
-
+ count = gfs_file_aio_write_nolock(file, buf, size, offset, iocb);
gfs_glock_dq_uninit(&t_gh);
}
+out_iocb_write:
error = 0;
out_gunlock:
@@ -699,7 +781,8 @@ do_write_direct(struct file *file, char
*/
static ssize_t
-do_do_write_buf(struct file *file, char *buf, size_t size, loff_t *offset)
+do_do_write_buf(struct file *file, char *buf, size_t size, loff_t *offset,
+ struct kiocb *iocb)
{
struct inode *inode = file->f_mapping->host;
struct gfs_inode *ip = get_v2ip(inode);
@@ -777,7 +860,7 @@ do_do_write_buf(struct file *file, char
(gfs_is_stuffed(ip) && !test_bit(GIF_PAGED, &ip->i_flags) &&
*offset + size <= sdp->sd_sb.sb_bsize - sizeof(struct gfs_dinode))) {
- count = gfs_writei(ip, buf, *offset, size, gfs_copy_from_user);
+ count = gfs_writei(ip, buf, *offset, size, gfs_copy_from_user, iocb);
if (count < 0) {
error = count;
goto fail_end_trans;
@@ -792,9 +875,7 @@ do_do_write_buf(struct file *file, char
}
*offset += count;
} else {
- struct iovec local_iov = { .iov_base = buf, .iov_len = size };
-
- count = generic_file_write_nolock(file, &local_iov, 1, offset);
+ count = gfs_file_aio_write_nolock(file, buf, size, offset, iocb);
if (count < 0) {
error = count;
goto fail_end_trans;
@@ -870,6 +951,7 @@ do_do_write_buf(struct file *file, char
static ssize_t
do_write_buf(struct file *file,
char *buf, size_t size, loff_t *offset,
+ struct kiocb *iocb,
unsigned int num_gh, struct gfs_holder *ghs)
{
struct gfs_inode *ip = get_v2ip(file->f_mapping->host);
@@ -907,7 +989,7 @@ do_write_buf(struct file *file,
if (s > size)
s = size;
- error = do_do_write_buf(file, buf, s, offset);
+ error = do_do_write_buf(file, buf, s, offset, iocb);
if (error < 0)
goto out_gunlock;
@@ -940,7 +1022,7 @@ do_write_buf(struct file *file,
*/
static ssize_t
-gfs_write(struct file *file, const char *buf, size_t size, loff_t *offset)
+__gfs_write(struct file *file, const char *buf, size_t size, loff_t *offset, struct kiocb *iocb)
{
struct inode *inode = file->f_mapping->host;
ssize_t count;
@@ -954,14 +1036,32 @@ gfs_write(struct file *file, const char
mutex_lock(&inode->i_mutex);
if (file->f_flags & O_DIRECT)
- count = walk_vm(file, (char *)buf, size, offset, do_write_direct);
+ count = walk_vm(file, (char *)buf, size, offset, iocb, do_write_direct);
else
- count = walk_vm(file, (char *)buf, size, offset, do_write_buf);
+ count = walk_vm(file, (char *)buf, size, offset, iocb, do_write_buf);
mutex_unlock(&inode->i_mutex);
return count;
}
+static ssize_t
+gfs_write(struct file *file, const char *buf, size_t size, loff_t *offset)
+{
+ return(__gfs_write(file, buf, size, offset, NULL));
+}
+
+static ssize_t
+gfs_aio_write(struct kiocb *iocb, const struct iovec *iov, unsigned long segs,
+ loff_t pos)
+{
+ struct file *file = iocb->ki_filp;
+
+ BUG_ON(iocb->ki_pos != pos);
+
+ return(__gfs_write(file, iov->iov_base, iov->iov_len, &iocb->ki_pos,
+ iocb));
+}
+
/**
* filldir_reg_func - Report a directory entry to the caller of gfs_dir_read()
* @opaque: opaque data used by the function
@@ -1647,6 +1747,8 @@ struct file_operations gfs_file_fops = {
.llseek = gfs_llseek,
.read = gfs_read,
.write = gfs_write,
+ .aio_read = gfs_aio_read,
+ .aio_write = gfs_aio_write,
.ioctl = gfs_ioctl,
.mmap = gfs_mmap,
.open = gfs_open,
Index: gfs-kernel/src/gfs/ops_fstype.c
===================================================================
RCS file: /cvs/cluster/cluster/gfs-kernel/src/gfs/ops_fstype.c,v
retrieving revision 1.13.2.1.4.2.2.3
diff -w -u -p -p -u -r1.13.2.1.4.2.2.3 ops_fstype.c
--- gfs-kernel/src/gfs/ops_fstype.c 29 Jun 2006 16:50:41 -0000 1.13.2.1.4.2.2.3
+++ gfs-kernel/src/gfs/ops_fstype.c 2 Feb 2007 22:28:43 -0000
@@ -2,7 +2,7 @@
*******************************************************************************
**
** Copyright (C) Sistina Software, Inc. 1997-2003 All rights reserved.
-** Copyright (C) 2004 Red Hat, Inc. All rights reserved.
+** Copyright (C) 2004-2007 Red Hat, Inc. All rights reserved.
**
** This copyrighted material is made available to anyone wishing to use,
** modify, copy, or redistribute it subject to the terms and conditions
@@ -29,6 +29,7 @@
#include "inode.h"
#include "lm.h"
#include "mount.h"
+#include "ops_dentry.h"
#include "ops_export.h"
#include "ops_fstype.h"
#include "ops_super.h"
@@ -492,6 +493,7 @@ fill_super(struct super_block *sb, void
error = -ENOMEM;
goto fail_li_free;
}
+ sb->s_root->d_op = &gfs_dops;
/* Start up the logd thread */
@@ -679,9 +681,8 @@ gfs_set_bdev_super(struct super_block *s
* Returns: the new superblock
*/
-struct super_block *
-gfs_get_sb(struct file_system_type *fs_type, int flags,
- const char *dev_name, void *data)
+static int gfs_get_sb(struct file_system_type *fs_type, int flags,
+ const char *dev_name, void *data, struct vfsmount *mnt)
{
struct block_device *real, *diaper;
struct super_block *sb;
@@ -689,17 +690,17 @@ gfs_get_sb(struct file_system_type *fs_t
real = open_bdev_excl(dev_name, flags, fs_type);
if (IS_ERR(real))
- return (struct super_block *)real;
+ return PTR_ERR(real);
diaper = gfs_diaper_get(real, flags);
if (IS_ERR(diaper)) {
close_bdev_excl(real);
- return (struct super_block *)diaper;
+ return PTR_ERR(diaper);
}
- mutex_lock(&diaper->bd_mount_mutex);
+ down(&diaper->bd_mount_sem);
sb = sget(fs_type, gfs_test_bdev_super, gfs_set_bdev_super, diaper);
- mutex_unlock(&diaper->bd_mount_mutex);
+ up(&diaper->bd_mount_sem);
if (IS_ERR(sb))
goto out;
@@ -723,14 +724,20 @@ gfs_get_sb(struct file_system_type *fs_t
sb = ERR_PTR(error);
} else
sb->s_flags |= MS_ACTIVE;
+ if (real->bd_disk) {
+ if (real->bd_part)
+ kobject_uevent(&real->bd_part->kobj, KOBJ_MOUNT);
+ else
+ kobject_uevent(&real->bd_disk->kobj, KOBJ_MOUNT);
+ }
}
- return sb;
+ return simple_set_mnt(mnt, sb);
out:
gfs_diaper_put(diaper);
close_bdev_excl(real);
- return sb;
+ return simple_set_mnt(mnt, sb);
}
/**
@@ -752,6 +759,13 @@ gfs_kill_sb(struct super_block *sb)
set_blocksize(diaper, bsize);
set_blocksize(real, bsize);
gfs_diaper_put(diaper);
+ if (real->bd_disk) {
+ if (real->bd_part)
+ kobject_uevent(&real->bd_part->kobj, KOBJ_UMOUNT);
+ else
+ kobject_uevent(&real->bd_disk->kobj, KOBJ_UMOUNT);
+ }
+ sync_blockdev(real);
close_bdev_excl(real);
}
Index: gfs-kernel/src/gfs/ops_inode.c
===================================================================
RCS file: /cvs/cluster/cluster/gfs-kernel/src/gfs/ops_inode.c,v
retrieving revision 1.6.6.1.2.5
diff -w -u -p -p -u -r1.6.6.1.2.5 ops_inode.c
--- gfs-kernel/src/gfs/ops_inode.c 16 Aug 2006 14:40:54 -0000 1.6.6.1.2.5
+++ gfs-kernel/src/gfs/ops_inode.c 2 Feb 2007 22:28:43 -0000
@@ -171,22 +171,22 @@ lookup_cdpn_sub_at(struct gfs_sbd *sdp,
parent = dget_parent(dentry);
if (gfs_filecmp(&dentry->d_name, "@hostname", 9))
- new = lookup_one_len(system_utsname.nodename,
+ new = lookup_one_len(init_utsname()->nodename,
parent,
- strlen(system_utsname.nodename));
+ strlen(init_utsname()->nodename));
else if (gfs_filecmp(&dentry->d_name, "@nodeid", 7))
new = lookup_one_len(buf,
parent,
sprintf(buf, "%s%i", "node",
get_my_nodeid()));
else if (gfs_filecmp(&dentry->d_name, "@mach", 5))
- new = lookup_one_len(system_utsname.machine,
+ new = lookup_one_len(init_utsname()->machine,
parent,
- strlen(system_utsname.machine));
+ strlen(init_utsname()->machine));
else if (gfs_filecmp(&dentry->d_name, "@os", 3))
- new = lookup_one_len(system_utsname.sysname,
+ new = lookup_one_len(init_utsname()->sysname,
parent,
- strlen(system_utsname.sysname));
+ strlen(init_utsname()->sysname));
else if (gfs_filecmp(&dentry->d_name, "@uid", 4))
new = lookup_one_len(buf,
parent,
@@ -199,8 +199,8 @@ lookup_cdpn_sub_at(struct gfs_sbd *sdp,
new = lookup_one_len(buf,
parent,
sprintf(buf, "%s_%s",
- system_utsname.machine,
- system_utsname.sysname));
+ init_utsname()->machine,
+ init_utsname()->sysname));
else if (gfs_filecmp(&dentry->d_name, "@jid", 4))
new = lookup_one_len(buf,
parent,
@@ -235,22 +235,22 @@ lookup_cdpn_sub_brace(struct gfs_sbd *sd
parent = dget_parent(dentry);
if (gfs_filecmp(&dentry->d_name, "{hostname}", 10))
- new = lookup_one_len(system_utsname.nodename,
+ new = lookup_one_len(init_utsname()->nodename,
parent,
- strlen(system_utsname.nodename));
+ strlen(init_utsname()->nodename));
else if (gfs_filecmp(&dentry->d_name, "{nodeid}", 8))
new = lookup_one_len(buf,
parent,
sprintf(buf, "%s%i", "node",
get_my_nodeid()));
else if (gfs_filecmp(&dentry->d_name, "{mach}", 6))
- new = lookup_one_len(system_utsname.machine,
+ new = lookup_one_len(init_utsname()->machine,
parent,
- strlen(system_utsname.machine));
+ strlen(init_utsname()->machine));
else if (gfs_filecmp(&dentry->d_name, "{os}", 4))
- new = lookup_one_len(system_utsname.sysname,
+ new = lookup_one_len(init_utsname()->sysname,
parent,
- strlen(system_utsname.sysname));
+ strlen(init_utsname()->sysname));
else if (gfs_filecmp(&dentry->d_name, "{uid}", 5))
new = lookup_one_len(buf,
parent,
@@ -263,8 +263,8 @@ lookup_cdpn_sub_brace(struct gfs_sbd *sd
new = lookup_one_len(buf,
parent,
sprintf(buf, "%s_%s",
- system_utsname.machine,
- system_utsname.sysname));
+ init_utsname()->machine,
+ init_utsname()->sysname));
else if (gfs_filecmp(&dentry->d_name, "{jid}", 5))
new = lookup_one_len(buf,
parent,
Index: gfs-kernel/src/gfs/ops_super.c
===================================================================
RCS file: /cvs/cluster/cluster/gfs-kernel/src/gfs/ops_super.c,v
retrieving revision 1.12.2.1.4.2.2.2
diff -w -u -p -p -u -r1.12.2.1.4.2.2.2 ops_super.c
--- gfs-kernel/src/gfs/ops_super.c 15 Feb 2006 22:49:19 -0000 1.12.2.1.4.2.2.2
+++ gfs-kernel/src/gfs/ops_super.c 2 Feb 2007 22:28:43 -0000
@@ -275,8 +275,9 @@ gfs_unlockfs(struct super_block *sb)
*/
static int
-gfs_statfs(struct super_block *sb, struct kstatfs *buf)
+gfs_statfs(struct dentry *dentry, struct kstatfs *buf)
{
+ struct super_block *sb = dentry->d_inode->i_sb;
struct gfs_sbd *sdp = get_v2sdp(sb);
struct gfs_stat_gfs sg;
int error;
Index: gfs-kernel/src/gfs/recovery.c
===================================================================
RCS file: /cvs/cluster/cluster/gfs-kernel/src/gfs/recovery.c,v
retrieving revision 1.5.8.1
diff -w -u -p -p -u -r1.5.8.1 recovery.c
--- gfs-kernel/src/gfs/recovery.c 15 Feb 2006 22:46:43 -0000 1.5.8.1
+++ gfs-kernel/src/gfs/recovery.c 2 Feb 2007 22:28:43 -0000
@@ -548,7 +548,7 @@ clean_journal(struct gfs_sbd *sdp, struc
}
/**
- * gfs_recover_journal - recovery a given journal
+ * gfs_recover_journal - recover a given journal
* @sdp: the filesystem
* @jid: the number of the journal to recover
* @jdesc: the struct gfs_jindex describing the journal
@@ -573,7 +573,7 @@ gfs_recover_journal(struct gfs_sbd *sdp,
printk("GFS: fsid=%s: jid=%u: Trying to acquire journal lock...\n",
sdp->sd_fsname, jid);
- /* Aquire the journal lock so we can do recovery */
+ /* Acquire the journal lock so we can do recovery */
error = gfs_glock_nq_num(sdp,
jdesc->ji_addr, &gfs_meta_glops,
Index: gfs-kernel/src/gfs/util.c
===================================================================
RCS file: /cvs/cluster/cluster/gfs-kernel/src/gfs/util.c,v
retrieving revision 1.9.2.1
diff -w -u -p -p -u -r1.9.2.1 util.c
--- gfs-kernel/src/gfs/util.c 22 Mar 2005 15:54:09 -0000 1.9.2.1
+++ gfs-kernel/src/gfs/util.c 2 Feb 2007 22:28:43 -0000
@@ -26,10 +26,10 @@
uint32_t gfs_random_number;
-kmem_cache_t *gfs_glock_cachep = NULL;
-kmem_cache_t *gfs_inode_cachep = NULL;
-kmem_cache_t *gfs_bufdata_cachep = NULL;
-kmem_cache_t *gfs_mhc_cachep = NULL;
+struct kmem_cache *gfs_glock_cachep = NULL;
+struct kmem_cache *gfs_inode_cachep = NULL;
+struct kmem_cache *gfs_bufdata_cachep = NULL;
+struct kmem_cache *gfs_mhc_cachep = NULL;
/**
* gfs_random - Generate a random 32-bit number
Index: gfs-kernel/src/gfs/util.h
===================================================================
RCS file: /cvs/cluster/cluster/gfs-kernel/src/gfs/util.h,v
retrieving revision 1.7.8.1
diff -w -u -p -p -u -r1.7.8.1 util.h
--- gfs-kernel/src/gfs/util.h 20 Feb 2006 04:01:05 -0000 1.7.8.1
+++ gfs-kernel/src/gfs/util.h 2 Feb 2007 22:28:43 -0000
@@ -311,10 +311,10 @@ for (;;) { \
yield(); \
}
-extern kmem_cache_t *gfs_glock_cachep;
-extern kmem_cache_t *gfs_inode_cachep;
-extern kmem_cache_t *gfs_bufdata_cachep;
-extern kmem_cache_t *gfs_mhc_cachep;
+extern struct kmem_cache *gfs_glock_cachep;
+extern struct kmem_cache *gfs_inode_cachep;
+extern struct kmem_cache *gfs_bufdata_cachep;
+extern struct kmem_cache *gfs_mhc_cachep;
void *gmalloc(unsigned int size);
Index: gfs-kernel/src/gulm/gulm.h
===================================================================
RCS file: /cvs/cluster/cluster/gfs-kernel/src/gulm/Attic/gulm.h,v
retrieving revision 1.11.6.1
diff -w -u -p -p -u -r1.11.6.1 gulm.h
--- gfs-kernel/src/gulm/gulm.h 1 Jun 2005 19:11:58 -0000 1.11.6.1
+++ gfs-kernel/src/gulm/gulm.h 2 Feb 2007 22:28:43 -0000
@@ -24,7 +24,6 @@
#include <linux/slab.h>
#include <linux/spinlock.h>
#include <asm/atomic.h>
-#include <linux/config.h>
#include <linux/version.h>
#include <linux/smp_lock.h>
#include <linux/list.h>
@@ -73,7 +72,7 @@
/* Divide x by y. Round up if there is a remainder. */
#define DIV_RU(x, y) (((x) + (y) - 1) / (y))
-#include <linux/lm_interface.h>
+#include "lm_interface.h"
#include "gulm_prints.h"
Index: gfs-kernel/src/gulm/gulm_fs.c
===================================================================
RCS file: /cvs/cluster/cluster/gfs-kernel/src/gulm/Attic/gulm_fs.c,v
retrieving revision 1.15.2.1
diff -w -u -p -p -u -r1.15.2.1 gulm_fs.c
--- gfs-kernel/src/gulm/gulm_fs.c 4 Mar 2005 20:08:00 -0000 1.15.2.1
+++ gfs-kernel/src/gulm/gulm_fs.c 2 Feb 2007 22:28:43 -0000
@@ -258,7 +258,7 @@ start_gulm_threads (char *csnm, char *ho
if (hostdata != NULL && strlen (hostdata) > 0) {
strncpy (gulm_cm.myName, hostdata, 64);
} else {
- strncpy (gulm_cm.myName, system_utsname.nodename, 64);
+ strncpy (gulm_cm.myName, init_utsname()->nodename, 64);
}
gulm_cm.myName[63] = '\0';
Index: gfs-kernel/src/gulm/handler.h
===================================================================
RCS file: /cvs/cluster/cluster/gfs-kernel/src/gulm/Attic/handler.h,v
retrieving revision 1.1
diff -w -u -p -p -u -r1.1 handler.h
--- gfs-kernel/src/gulm/handler.h 24 Jun 2004 08:53:28 -0000 1.1
+++ gfs-kernel/src/gulm/handler.h 2 Feb 2007 22:28:43 -0000
@@ -13,7 +13,8 @@
#ifndef __handler_c__
#define __handler_c__
-#include <linux/lm_interface.h>
+
+#include "lm_interface.h"
struct callback_qu_s {
struct completion startup;
Index: gfs-kernel/src/harness/main.c
===================================================================
RCS file: /cvs/cluster/cluster/gfs-kernel/src/harness/Attic/main.c,v
retrieving revision 1.3
diff -w -u -p -p -u -r1.3 main.c
--- gfs-kernel/src/harness/main.c 22 Dec 2004 02:23:11 -0000 1.3
+++ gfs-kernel/src/harness/main.c 2 Feb 2007 22:28:43 -0000
@@ -19,7 +19,8 @@
#include <linux/sched.h>
#include <linux/kmod.h>
#include <linux/fs.h>
-#include <linux/lm_interface.h>
+
+#include "lm_interface.h"
#define RELEASE_NAME "<CVS>"
Index: gfs-kernel/src/nolock/main.c
===================================================================
RCS file: /cvs/cluster/cluster/gfs-kernel/src/nolock/Attic/main.c,v
retrieving revision 1.4.6.2.2.1
diff -w -u -p -p -u -r1.4.6.2.2.1 main.c
--- gfs-kernel/src/nolock/main.c 26 Jun 2006 21:27:43 -0000 1.4.6.2.2.1
+++ gfs-kernel/src/nolock/main.c 2 Feb 2007 22:28:43 -0000
@@ -18,7 +18,8 @@
#include <linux/types.h>
#include <linux/fs.h>
#include <linux/smp_lock.h>
-#include <linux/lm_interface.h>
+
+#include "lm_interface.h"
#define RELEASE_NAME "<CVS>"
Index: gnbd-kernel/src/gnbd.c
===================================================================
RCS file: /cvs/cluster/cluster/gnbd-kernel/src/gnbd.c,v
retrieving revision 1.6.6.1.2.4
diff -w -u -p -p -u -r1.6.6.1.2.4 gnbd.c
--- gnbd-kernel/src/gnbd.c 12 Jul 2006 17:34:29 -0000 1.6.6.1.2.4
+++ gnbd-kernel/src/gnbd.c 2 Feb 2007 22:28:44 -0000
@@ -30,12 +30,11 @@
#include <linux/buffer_head.h>
#include <linux/miscdevice.h>
#include <linux/moduleparam.h>
-#include <linux/devfs_fs_kernel.h>
#include <asm/uaccess.h>
#include <asm/types.h>
-#include <linux/gnbd.h>
+#include "gnbd.h"
static int major_nr = 0;
uint64_t insmod_time;
@@ -578,10 +577,10 @@ static void do_gnbd_request(request_queu
struct gnbd_device *dev;
blkdev_dequeue_request(req);
- dprintk(DBG_BLKDEV, "%s: request %p: dequeued (flags=%lx)\n",
- req->rq_disk->disk_name, req, req->flags);
+ dprintk(DBG_BLKDEV, "%s: request %p: dequeued (flags=%x)\n",
+ req->rq_disk->disk_name, req, req->cmd_type);
- if (!(req->flags & REQ_CMD))
+ if (!blk_fs_request(req))
goto error_out;
dev = req->rq_disk->private_data;
@@ -845,7 +844,6 @@ static struct miscdevice _gnbd_misc =
{
.minor = MISC_DYNAMIC_MINOR,
.name = "gnbd_ctl",
- .devfs_name = "gnbd_ctl",
.fops = &_gnbd_ctl_fops
};
@@ -890,12 +888,12 @@ static int __init gnbd_init(void)
printk(KERN_CRIT "gnbd: sizeof gnbd_request needs to be 28 in order to work!\n" );
return -EIO;
}
- shutdown_req.flags = REQ_SPECIAL;
+ shutdown_req.cmd_type = REQ_TYPE_SPECIAL;
gnbd_cmd(&shutdown_req) = GNBD_CMD_DISC;
shutdown_req.sector = 0;
shutdown_req.nr_sectors = 0;
- ping_req.flags = REQ_SPECIAL;
+ ping_req.cmd_type = REQ_TYPE_SPECIAL;
gnbd_cmd(&ping_req) = GNBD_CMD_PING;
ping_req.sector = 0;
ping_req.nr_sectors = 0;
@@ -926,7 +924,6 @@ static int __init gnbd_init(void)
printk(KERN_INFO "gnbd: registered device at major %d\n", major_nr);
dprintk(DBG_INIT, "gnbd: debugflags=0x%x\n", debugflags);
- devfs_mk_dir("gnbd_minor");
err = class_register(&gnbd_class);
if (err)
goto out_unregister;
@@ -982,7 +979,6 @@ static int __init gnbd_init(void)
disk->fops = &gnbd_fops;
disk->private_data = &gnbd_dev[i];
sprintf(disk->disk_name, "gnbd%d", i);
- sprintf(disk->devfs_name, "gnbd_minor/%d", i);
set_capacity(disk, 0);
add_disk(disk);
if(sysfs_create_link(&gnbd_dev[i].class_dev.kobj,
@@ -1036,7 +1032,6 @@ static void __exit gnbd_cleanup(void)
kfree(gnbd_dev[i].server_name);
}
class_unregister(&gnbd_class);
- devfs_remove("gnbd");
unregister_blkdev(major_nr, "gnbd");
printk(KERN_INFO "gnbd: unregistered device at major %d\n", major_nr);
}
--
Linux-cluster mailing list
Linux-cluster@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/linux-cluster