All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jens Axboe <axboe@suse.de>
To: Tom Zanussi <zanussi@us.ibm.com>
Cc: akpm@osdl.org, linux-kernel@vger.kernel.org, karim@opersys.com,
	prasadav@us.ibm.com
Subject: Re: [-mm patch] relayfs: add read() support
Date: Fri, 5 Aug 2005 16:49:27 +0200	[thread overview]
Message-ID: <20050805144926.GS5561@suse.de> (raw)
In-Reply-To: <17138.53203.430849.147593@tut.ibm.com>

On Thu, Aug 04 2005, Tom Zanussi wrote:
> At the kernel summit, there was some discussion of relayfs and the
> consensus was that it didn't make sense for relayfs to not implement
> read().  So here's a read implementation...

It needs a few fixes to actually compile without errors. This works for
me, just tested with the block tracing stuff, works a charm!


diff -urp -X /home/axboe/cdrom/exclude /opt/kernel/linux-2.6.13-rc4-mm1/fs/relayfs/inode.c linux-2.6.13-rc4-mm1/fs/relayfs/inode.c
--- /opt/kernel/linux-2.6.13-rc4-mm1/fs/relayfs/inode.c	2005-08-05 16:47:57.000000000 +0200
+++ linux-2.6.13-rc4-mm1/fs/relayfs/inode.c	2005-08-05 16:45:38.000000000 +0200
@@ -33,6 +33,8 @@ static struct backing_dev_info		relayfs_
 	.capabilities	= BDI_CAP_NO_ACCT_DIRTY | BDI_CAP_NO_WRITEBACK,
 };
 
+struct file_operations relayfs_file_operations;
+
 static struct inode *relayfs_get_inode(struct super_block *sb, int mode,
 				       struct rchan *chan)
 {
@@ -370,7 +372,7 @@ static inline unsigned int relayfs_read_
  *	
  */
 static inline unsigned int relayfs_read_avail(struct rchan_buf *buf,
-					      unsigned int *start_subbuf)
+					      size_t *start_subbuf)
 {
 	unsigned int avail, complete_subbufs, cur_subbuf, buf_offset;
 	unsigned int subbuf_size = buf->chan->subbuf_size;
@@ -378,12 +380,12 @@ static inline unsigned int relayfs_read_
 
 	buf_offset = buf->offset > subbuf_size ? subbuf_size : buf->offset;
 	
-	if (buf->subbufs_produced >= n_subbufs) {
+	if (atomic_read(&buf->subbufs_produced) >= n_subbufs) {
 		complete_subbufs = n_subbufs - 1;
 		cur_subbuf = (buf->data - buf->start) / subbuf_size;
 		*start_subbuf = (cur_subbuf + 1) % n_subbufs;
 	} else {
-		complete_subbufs = buf->subbufs_produced;
+		complete_subbufs = atomic_read(&buf->subbufs_produced);
 		*start_subbuf = 0;
 	}
 	
@@ -416,8 +418,8 @@ static ssize_t relayfs_read(struct file 
 {
 	struct inode *inode = filp->f_dentry->d_inode;
 	struct rchan_buf *buf = RELAYFS_I(inode)->buf;
-	unsigned int read_start, read_end, avail, start_subbuf;
-	unsigned int buf_size = buf->chan->subbuf_size * buf->chan->n_subbufs;
+	size_t read_start, read_end, avail, start_subbuf;
+	size_t buf_size = buf->chan->subbuf_size * buf->chan->n_subbufs;
 	void *from;
 
 	avail = relayfs_read_avail(buf, &start_subbuf);
diff -urp -X /home/axboe/cdrom/exclude /opt/kernel/linux-2.6.13-rc4-mm1/include/linux/relayfs_fs.h linux-2.6.13-rc4-mm1/include/linux/relayfs_fs.h
--- /opt/kernel/linux-2.6.13-rc4-mm1/include/linux/relayfs_fs.h	2005-08-05 16:47:44.000000000 +0200
+++ linux-2.6.13-rc4-mm1/include/linux/relayfs_fs.h	2005-08-05 16:45:47.000000000 +0200
@@ -253,15 +253,5 @@ static inline void *relay_reserve(struct
 	return reserved;
 }
 
-/*
- * exported relayfs file operations, fs/relayfs/inode.c
- */
-
-extern struct file_operations relayfs_file_operations;
-extern int relayfs_open(struct inode *inode, struct file *filp);
-extern unsigned int relayfs_poll(struct file *filp, poll_table *wait);
-extern int relayfs_mmap(struct file *filp, struct vm_area_struct *vma);
-extern int relayfs_release(struct inode *inode, struct file *filp);
-
 #endif /* _LINUX_RELAYFS_FS_H */
 


-- 
Jens Axboe


  parent reply	other threads:[~2005-08-05 14:48 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-08-05  2:32 [-mm patch] relayfs: add read() support Tom Zanussi
2005-08-05  7:57 ` Andrew Morton
2005-08-05 17:06   ` Tom Zanussi
2005-08-05 14:49 ` Jens Axboe [this message]
2005-08-05 15:05   ` Tom Zanussi
2005-08-05 15:58     ` Jens Axboe
2005-08-05 19:01       ` Andrew Morton

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20050805144926.GS5561@suse.de \
    --to=axboe@suse.de \
    --cc=akpm@osdl.org \
    --cc=karim@opersys.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=prasadav@us.ibm.com \
    --cc=zanussi@us.ibm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.