Skip to contentSkip to conversation

RDMA/cxgb4: Add default_llseek to debugfs files.

PATCH In review Steve Wise 3 participants 11 messages Sep 29, 2010

Subsystems (3)
lore
Share & tools
lore

Steve Wise

author
#0 lore raw

PATCH 1/1 RDMA/cxgb4: Add default_llseek to debugfs files.

This resolves a linux-next merge issue.

---

 drivers/infiniband/hw/cxgb4/device.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
drivers/infiniband/hw/cxgb4/device.c +2 -0
index 986cfd7..b254357 100644
@@ -182,6 +182,7 @@ static const struct file_operations qp_debugfs_fops = {
 	.open    = qp_open,
 	.release = qp_release,
 	.read    = debugfs_read,
+	.llseek  = default_llseek,
 };
 
 static int dump_stag(int id, void *p, void *data)
@@ -255,6 +256,7 @@ static const struct file_operations stag_debugfs_fops = {
 	.open    = stag_open,
 	.release = stag_release,
 	.read    = debugfs_read,
+	.llseek  = default_llseek,
 };
 
 static int setup_debugfs(struct c4iw_dev *devp)
#1 lore raw

drivers/infiniband/hw/cxgb4/device.c static const struct file_operations qp_debugfs_fops = { · line 186

Quoted 6 lines
drivers/infiniband/hw/cxgb4/device.c +1 -0
@@ -182,6 +182,7 @@ static const struct file_operations qp_debugfs_fops = {
 	.open    = qp_open,
 	.release = qp_release,
 	.read    = debugfs_read,
+	.llseek  = default_llseek,
 };

I think this could actually be generic_file_llseek (right, Arnd?).

Also could qp_read() and other read methods be simplified by using simple_read_from_buffer()? I don't see anything fancy there, seems like the read methods could become one-liners that way.

- R.
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

author
#2 lore raw
Quoted 7 lines · Roland Dreier
Quoted 6 lines

@@ -182,6 +182,7 @@ static const struct file_operations qp_debugfs_fops = {
.open = qp_open,
.release = qp_release,
.read = debugfs_read,
+ .llseek = default_llseek,
};

Quoted 7 lines

I think this could actually be generic_file_llseek (right, Arnd?).

Also could qp_read() and other read methods be simplified by using simple_read_from_buffer()? I don't see anything fancy there, seems like the read methods could become one-liners that way.

I assume you mean debugs_read()...Like this?

static ssize_t debugfs_read(struct file *file, char __user *buf, size_t count,
loff_t *ppos)

{
        struct c4iw_debugfs_data *d = file->private_data;

        return simple_read_from_buffer(buf, ppos, d->buf, d->pos);
}

Steve.
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

#3 lore raw
Quoted 1 line

I assume you mean debugs_read()...Like this?

Sorry, yeah, was looking at the old code. But yes, that code seems a lot simpler.

author
#4 lore raw
Quoted 10 lines · Roland Dreier
Quoted 1 line

I assume you mean debugs_read()...Like this?

Sorry, yeah, was looking at the old code. But yes, that code seems a lot simpler.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

I'll change it, test it, and send you a patch.

#5 lore raw
Quoted 1 line

I'll change it, test it, and send you a patch.

great, thanks.

#6 lore raw
In reply to Roland Dreier
Quoted 8 lines · On Wednesday 29 September 2010 19:19:32 Roland Dreier wrote:

drivers/infiniband/hw/cxgb4/device.c static const struct file_operations qp_debugfs_fops = { · line 186

Quoted 6 lines
drivers/infiniband/hw/cxgb4/device.c +1 -0
@@ -182,6 +182,7 @@ static const struct file_operations qp_debugfs_fops = {
     .open    = qp_open,
     .release = qp_release,
     .read    = debugfs_read,
+    .llseek  = default_llseek,
 };

I think this could actually be generic_file_llseek (right, Arnd?).

The main difference between default_llseek and generic_file_llseek is that default_llseek doesn't care about the maximum file size of the underlying file system, which is ULONG_MAX on debugfs, so they are equivalent.

In general, the preferred one is no_llseek for those files where you know you do not need to seek. If you do, I'd use default_llseek for character devices and generic_file_llseek for file systems that set the s_maxbytes.

Arnd
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

#7 lore raw
Quoted 4 lines

The main difference between default_llseek and generic_file_llseek is that default_llseek doesn't care about the maximum file size of the underlying file system, which is ULONG_MAX on debugfs, so they are equivalent.

I thought default_llseek also takes the BKL still?

Quoted 4 lines

In general, the preferred one is no_llseek for those files where you know you do not need to seek. If you do, I'd use default_llseek for character devices and generic_file_llseek for file systems that set the s_maxbytes.

The case in question is for debugfs files, so we should use generic_file_llseek, right?

- R.
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

#8 lore raw
Quoted 7 lines · On Wednesday 29 September 2010 21:21:14 Roland Dreier wrote:
Quoted 5 lines

The main difference between default_llseek and generic_file_llseek is that default_llseek doesn't care about the maximum file size of the underlying file system, which is ULONG_MAX on debugfs, so they are equivalent.

I thought default_llseek also takes the BKL still?

Not any more in linux-next.

Quoted 7 lines
Quoted 4 lines

In general, the preferred one is no_llseek for those files where you know you do not need to seek. If you do, I'd use default_llseek for character devices and generic_file_llseek for file systems that set the s_maxbytes.

The case in question is for debugfs files, so we should use generic_file_llseek, right?

Yes, but it's a very weak "should". My automatic conversion script uses default_llseek.

Arnd

#9 lore raw
Quoted 2 lines

Yes, but it's a very weak "should". My automatic conversion script uses default_llseek.

OK, I'll just take steve's patch that does default_llseek if it really doesn't matter.

- R.

#10 lore raw
In reply to Steve Wise
Quoted 13 lines
drivers/infiniband/hw/cxgb4/device.c +1 -0
@@ -182,6 +182,7 @@ static const struct file_operations qp_debugfs_fops = {
 	.open    = qp_open,
 	.release = qp_release,
 	.read    = debugfs_read,
+	.llseek  = default_llseek,
 };
 
 static int dump_stag(int id, void *p, void *data)

drivers/infiniband/hw/cxgb4/device.c static const struct file_operations stag_debugfs_fops = { · line 262

Quoted 7 lines
drivers/infiniband/hw/cxgb4/device.c +1 -0
@@ -255,6 +256,7 @@ static const struct file_operations stag_debugfs_fops = {
 	.open    = stag_open,
 	.release = stag_release,
 	.read    = debugfs_read,
+	.llseek  = default_llseek,
 };
 
 static int setup_debugfs(struct c4iw_dev *devp)

Steve, can you also do a quick test to make sure this works OK with generic_file_llseek instead of default_llseek?

Thanks.
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html