Skip to content

Commit 83f3aa3

Browse files
sboxnetLinus Torvalds
authored andcommitted
[PATCH] pktcdvd: cleanup
- update documentation - use clear_bdi_congested/set_bdi_congested functions directly instead of old wrappers - removed DECLARE_BUF_AS_STRING macro Signed-off-by: Thomas Maier <balagi@justmail.de> Cc: Peter Osterlund <petero2@telia.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
1 parent b035b6d commit 83f3aa3

4 files changed

Lines changed: 11 additions & 24 deletions

File tree

‎Documentation/ABI/testing/debugfs-pktcdvd‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
What: /debug/pktcdvd/pktcdvd[0-7]
22
Date: Oct. 2006
3-
KernelVersion: 2.6.19
3+
KernelVersion: 2.6.20
44
Contact: Thomas Maier <balagi@justmail.de>
55
Description:
66

@@ -11,8 +11,7 @@ The pktcdvd module (packet writing driver) creates
1111
these files in debugfs:
1212

1313
/debug/pktcdvd/pktcdvd[0-7]/
14-
info (0444) Lots of human readable driver
15-
statistics and infos. Multiple lines!
14+
info (0444) Lots of driver statistics and infos.
1615

1716
Example:
1817
-------

‎Documentation/ABI/testing/sysfs-class-pktcdvd‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
What: /sys/class/pktcdvd/
22
Date: Oct. 2006
3-
KernelVersion: 2.6.19
3+
KernelVersion: 2.6.20
44
Contact: Thomas Maier <balagi@justmail.de>
55
Description:
66

‎Documentation/cdrom/packet-writing.txt‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ Notes
9393
Using the pktcdvd sysfs interface
9494
---------------------------------
9595

96-
Since Linux 2.6.19, the pktcdvd module has a sysfs interface
96+
Since Linux 2.6.20, the pktcdvd module has a sysfs interface
9797
and can be controlled by it. For example the "pktcdvd" tool uses
9898
this interface. (see http://people.freenet.de/BalaGi#pktcdvd )
9999

‎drivers/block/pktcdvd.c‎

Lines changed: 7 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -190,15 +190,6 @@ static struct attribute *kobj_pkt_attrs_wqueue[] = {
190190
NULL
191191
};
192192

193-
/* declares a char buffer[64] _dbuf, copies data from
194-
* _b with length _l into it and ensures that _dbuf ends
195-
* with a \0 character.
196-
*/
197-
#define DECLARE_BUF_AS_STRING(_dbuf, _b, _l) \
198-
char _dbuf[64]; int dlen = (_l) < 0 ? 0 : (_l); \
199-
if (dlen >= sizeof(_dbuf)) dlen = sizeof(_dbuf)-1; \
200-
memcpy(_dbuf, _b, dlen); _dbuf[dlen] = 0
201-
202193
static ssize_t kobj_pkt_show(struct kobject *kobj,
203194
struct attribute *attr, char *data)
204195
{
@@ -264,25 +255,24 @@ static ssize_t kobj_pkt_store(struct kobject *kobj,
264255
{
265256
struct pktcdvd_device *pd = to_pktcdvdkobj(kobj)->pd;
266257
int val;
267-
DECLARE_BUF_AS_STRING(dbuf, data, len); /* ensure sscanf scans a string */
268258

269-
if (strcmp(attr->name, "reset") == 0 && dlen > 0) {
259+
if (strcmp(attr->name, "reset") == 0 && len > 0) {
270260
pd->stats.pkt_started = 0;
271261
pd->stats.pkt_ended = 0;
272262
pd->stats.secs_w = 0;
273263
pd->stats.secs_rg = 0;
274264
pd->stats.secs_r = 0;
275265

276266
} else if (strcmp(attr->name, "congestion_off") == 0
277-
&& sscanf(dbuf, "%d", &val) == 1) {
267+
&& sscanf(data, "%d", &val) == 1) {
278268
spin_lock(&pd->lock);
279269
pd->write_congestion_off = val;
280270
init_write_congestion_marks(&pd->write_congestion_off,
281271
&pd->write_congestion_on);
282272
spin_unlock(&pd->lock);
283273

284274
} else if (strcmp(attr->name, "congestion_on") == 0
285-
&& sscanf(dbuf, "%d", &val) == 1) {
275+
&& sscanf(data, "%d", &val) == 1) {
286276
spin_lock(&pd->lock);
287277
pd->write_congestion_on = val;
288278
init_write_congestion_marks(&pd->write_congestion_off,
@@ -369,8 +359,7 @@ static ssize_t class_pktcdvd_store_add(struct class *c, const char *buf,
369359
size_t count)
370360
{
371361
unsigned int major, minor;
372-
DECLARE_BUF_AS_STRING(dbuf, buf, count);
373-
if (sscanf(dbuf, "%u:%u", &major, &minor) == 2) {
362+
if (sscanf(buf, "%u:%u", &major, &minor) == 2) {
374363
pkt_setup_dev(MKDEV(major, minor), NULL);
375364
return count;
376365
}
@@ -381,8 +370,7 @@ static ssize_t class_pktcdvd_store_remove(struct class *c, const char *buf,
381370
size_t count)
382371
{
383372
unsigned int major, minor;
384-
DECLARE_BUF_AS_STRING(dbuf, buf, count);
385-
if (sscanf(dbuf, "%u:%u", &major, &minor) == 2) {
373+
if (sscanf(buf, "%u:%u", &major, &minor) == 2) {
386374
pkt_remove_dev(MKDEV(major, minor));
387375
return count;
388376
}
@@ -1377,7 +1365,7 @@ static int pkt_handle_queue(struct pktcdvd_device *pd)
13771365
&& pd->bio_queue_size <= pd->write_congestion_off);
13781366
spin_unlock(&pd->lock);
13791367
if (wakeup)
1380-
blk_clear_queue_congested(pd->disk->queue, WRITE);
1368+
clear_bdi_congested(&pd->disk->queue->backing_dev_info, WRITE);
13811369

13821370
pkt->sleep_time = max(PACKET_WAIT_TIME, 1);
13831371
pkt_set_state(pkt, PACKET_WAITING_STATE);
@@ -2598,7 +2586,7 @@ static int pkt_make_request(request_queue_t *q, struct bio *bio)
25982586
spin_lock(&pd->lock);
25992587
if (pd->write_congestion_on > 0
26002588
&& pd->bio_queue_size >= pd->write_congestion_on) {
2601-
blk_set_queue_congested(q, WRITE);
2589+
set_bdi_congested(&q->backing_dev_info, WRITE);
26022590
do {
26032591
spin_unlock(&pd->lock);
26042592
congestion_wait(WRITE, HZ);

0 commit comments

Comments
 (0)