Skip to content

Commit

Permalink
Merge branch 'master'
Browse files Browse the repository at this point in the history
  • Loading branch information
Jeff Garzik committed Nov 14, 2005
2 parents c9d3913 + 4ba529a commit 85d6162
Show file tree
Hide file tree
Showing 36 changed files with 332 additions and 4,573 deletions.
4 changes: 0 additions & 4 deletions arch/powerpc/kernel/ioctl32.c
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,6 @@ IOCTL_TABLE_START
#define DECLARES
#include "compat_ioctl.c"

/* Little p (/dev/rtc, /dev/envctrl, etc.) */
COMPATIBLE_IOCTL(_IOR('p', 20, int[7])) /* RTCGET */
COMPATIBLE_IOCTL(_IOW('p', 21, int[7])) /* RTCSET */

IOCTL_TABLE_END

int ioctl_table_size = ARRAY_SIZE(ioctl_start);
92 changes: 0 additions & 92 deletions arch/sparc64/kernel/ioctl32.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,86 +12,10 @@
#define INCLUDES
#include "compat_ioctl.c"
#include <linux/syscalls.h>
#include <asm/fbio.h>

/* Use this to get at 32-bit user passed pointers.
* See sys_sparc32.c for description about it.
*/
#define A(__x) compat_ptr(__x)

#define CODE
#include "compat_ioctl.c"

struct fbcmap32 {
int index; /* first element (0 origin) */
int count;
u32 red;
u32 green;
u32 blue;
};

#define FBIOPUTCMAP32 _IOW('F', 3, struct fbcmap32)
#define FBIOGETCMAP32 _IOW('F', 4, struct fbcmap32)

static int fbiogetputcmap(unsigned int fd, unsigned int cmd, unsigned long arg)
{
struct fbcmap32 __user *argp = (void __user *)arg;
struct fbcmap __user *p = compat_alloc_user_space(sizeof(*p));
u32 addr;
int ret;

ret = copy_in_user(p, argp, 2 * sizeof(int));
ret |= get_user(addr, &argp->red);
ret |= put_user(compat_ptr(addr), &p->red);
ret |= get_user(addr, &argp->green);
ret |= put_user(compat_ptr(addr), &p->green);
ret |= get_user(addr, &argp->blue);
ret |= put_user(compat_ptr(addr), &p->blue);
if (ret)
return -EFAULT;
return sys_ioctl(fd, (cmd == FBIOPUTCMAP32) ? FBIOPUTCMAP_SPARC : FBIOGETCMAP_SPARC, (unsigned long)p);
}

struct fbcursor32 {
short set; /* what to set, choose from the list above */
short enable; /* cursor on/off */
struct fbcurpos pos; /* cursor position */
struct fbcurpos hot; /* cursor hot spot */
struct fbcmap32 cmap; /* color map info */
struct fbcurpos size; /* cursor bit map size */
u32 image; /* cursor image bits */
u32 mask; /* cursor mask bits */
};

#define FBIOSCURSOR32 _IOW('F', 24, struct fbcursor32)
#define FBIOGCURSOR32 _IOW('F', 25, struct fbcursor32)

static int fbiogscursor(unsigned int fd, unsigned int cmd, unsigned long arg)
{
struct fbcursor __user *p = compat_alloc_user_space(sizeof(*p));
struct fbcursor32 __user *argp = (void __user *)arg;
compat_uptr_t addr;
int ret;

ret = copy_in_user(p, argp,
2 * sizeof (short) + 2 * sizeof(struct fbcurpos));
ret |= copy_in_user(&p->size, &argp->size, sizeof(struct fbcurpos));
ret |= copy_in_user(&p->cmap, &argp->cmap, 2 * sizeof(int));
ret |= get_user(addr, &argp->cmap.red);
ret |= put_user(compat_ptr(addr), &p->cmap.red);
ret |= get_user(addr, &argp->cmap.green);
ret |= put_user(compat_ptr(addr), &p->cmap.green);
ret |= get_user(addr, &argp->cmap.blue);
ret |= put_user(compat_ptr(addr), &p->cmap.blue);
ret |= get_user(addr, &argp->mask);
ret |= put_user(compat_ptr(addr), &p->mask);
ret |= get_user(addr, &argp->image);
ret |= put_user(compat_ptr(addr), &p->image);
if (ret)
return -EFAULT;
return sys_ioctl (fd, FBIOSCURSOR, (unsigned long)p);
}

#define COMPATIBLE_IOCTL(cmd) HANDLE_IOCTL((cmd),sys_ioctl)
#define HANDLE_IOCTL(cmd,handler) { (cmd), (ioctl_trans_handler_t)(handler), NULL },
#define IOCTL_TABLE_START \
Expand All @@ -103,22 +27,6 @@ IOCTL_TABLE_START
#include <linux/compat_ioctl.h>
#define DECLARES
#include "compat_ioctl.c"
COMPATIBLE_IOCTL(FBIOGTYPE)
COMPATIBLE_IOCTL(FBIOSATTR)
COMPATIBLE_IOCTL(FBIOGATTR)
COMPATIBLE_IOCTL(FBIOSVIDEO)
COMPATIBLE_IOCTL(FBIOGVIDEO)
COMPATIBLE_IOCTL(FBIOGCURSOR32) /* This is not implemented yet. Later it should be converted... */
COMPATIBLE_IOCTL(FBIOSCURPOS)
COMPATIBLE_IOCTL(FBIOGCURPOS)
COMPATIBLE_IOCTL(FBIOGCURMAX)
/* Little k */
/* Little v, the video4linux ioctls */
/* And these ioctls need translation */
/* Note SIOCRTMSG is no longer, so this is safe and * the user would have seen just an -EINVAL anyways. */
HANDLE_IOCTL(FBIOPUTCMAP32, fbiogetputcmap)
HANDLE_IOCTL(FBIOGETCMAP32, fbiogetputcmap)
HANDLE_IOCTL(FBIOSCURSOR32, fbiogscursor)
#if 0
HANDLE_IOCTL(RTC32_IRQP_READ, do_rtc_ioctl)
HANDLE_IOCTL(RTC32_IRQP_SET, do_rtc_ioctl)
Expand Down
58 changes: 47 additions & 11 deletions block/cfq-iosched.c
Original file line number Diff line number Diff line change
Expand Up @@ -861,8 +861,8 @@ __cfq_slice_expired(struct cfq_data *cfqd, struct cfq_queue *cfqq,
* store what was left of this slice, if the queue idled out
* or was preempted
*/
if (time_after(now, cfqq->slice_end))
cfqq->slice_left = now - cfqq->slice_end;
if (time_after(cfqq->slice_end, now))
cfqq->slice_left = cfqq->slice_end - now;
else
cfqq->slice_left = 0;

Expand Down Expand Up @@ -999,7 +999,7 @@ cfq_prio_to_maxrq(struct cfq_data *cfqd, struct cfq_queue *cfqq)
/*
* get next queue for service
*/
static struct cfq_queue *cfq_select_queue(struct cfq_data *cfqd, int force)
static struct cfq_queue *cfq_select_queue(struct cfq_data *cfqd)
{
unsigned long now = jiffies;
struct cfq_queue *cfqq;
Expand All @@ -1023,7 +1023,7 @@ static struct cfq_queue *cfq_select_queue(struct cfq_data *cfqd, int force)
*/
if (!RB_EMPTY(&cfqq->sort_list))
goto keep_queue;
else if (!force && cfq_cfqq_class_sync(cfqq) &&
else if (cfq_cfqq_class_sync(cfqq) &&
time_before(now, cfqq->slice_end)) {
if (cfq_arm_slice_timer(cfqd, cfqq))
return NULL;
Expand Down Expand Up @@ -1091,6 +1091,42 @@ __cfq_dispatch_requests(struct cfq_data *cfqd, struct cfq_queue *cfqq,
return dispatched;
}

static int
cfq_forced_dispatch_cfqqs(struct list_head *list)
{
int dispatched = 0;
struct cfq_queue *cfqq, *next;
struct cfq_rq *crq;

list_for_each_entry_safe(cfqq, next, list, cfq_list) {
while ((crq = cfqq->next_crq)) {
cfq_dispatch_insert(cfqq->cfqd->queue, crq);
dispatched++;
}
BUG_ON(!list_empty(&cfqq->fifo));
}
return dispatched;
}

static int
cfq_forced_dispatch(struct cfq_data *cfqd)
{
int i, dispatched = 0;

for (i = 0; i < CFQ_PRIO_LISTS; i++)
dispatched += cfq_forced_dispatch_cfqqs(&cfqd->rr_list[i]);

dispatched += cfq_forced_dispatch_cfqqs(&cfqd->busy_rr);
dispatched += cfq_forced_dispatch_cfqqs(&cfqd->cur_rr);
dispatched += cfq_forced_dispatch_cfqqs(&cfqd->idle_rr);

cfq_slice_expired(cfqd, 0);

BUG_ON(cfqd->busy_queues);

return dispatched;
}

static int
cfq_dispatch_requests(request_queue_t *q, int force)
{
Expand All @@ -1100,7 +1136,10 @@ cfq_dispatch_requests(request_queue_t *q, int force)
if (!cfqd->busy_queues)
return 0;

cfqq = cfq_select_queue(cfqd, force);
if (unlikely(force))
return cfq_forced_dispatch(cfqd);

cfqq = cfq_select_queue(cfqd);
if (cfqq) {
int max_dispatch;

Expand All @@ -1115,12 +1154,9 @@ cfq_dispatch_requests(request_queue_t *q, int force)
cfq_clear_cfqq_wait_request(cfqq);
del_timer(&cfqd->idle_slice_timer);

if (!force) {
max_dispatch = cfqd->cfq_quantum;
if (cfq_class_idle(cfqq))
max_dispatch = 1;
} else
max_dispatch = INT_MAX;
max_dispatch = cfqd->cfq_quantum;
if (cfq_class_idle(cfqq))
max_dispatch = 1;

return __cfq_dispatch_requests(cfqd, cfqq, max_dispatch);
}
Expand Down
60 changes: 33 additions & 27 deletions block/elevator.c
Original file line number Diff line number Diff line change
Expand Up @@ -155,9 +155,10 @@ static void elevator_setup_default(void)
/*
* If the given scheduler is not available, fall back to no-op.
*/
if (!(e = elevator_find(chosen_elevator)))
if ((e = elevator_find(chosen_elevator)))
elevator_put(e);
else
strcpy(chosen_elevator, "noop");
elevator_put(e);
}

static int __init elevator_setup(char *str)
Expand Down Expand Up @@ -190,14 +191,14 @@ int elevator_init(request_queue_t *q, char *name)

eq = kmalloc(sizeof(struct elevator_queue), GFP_KERNEL);
if (!eq) {
elevator_put(e->elevator_type);
elevator_put(e);
return -ENOMEM;
}

ret = elevator_attach(q, e, eq);
if (ret) {
kfree(eq);
elevator_put(e->elevator_type);
elevator_put(e);
}

return ret;
Expand Down Expand Up @@ -225,6 +226,7 @@ void elv_dispatch_sort(request_queue_t *q, struct request *rq)

if (q->last_merge == rq)
q->last_merge = NULL;
q->nr_sorted--;

boundary = q->end_sector;

Expand Down Expand Up @@ -283,6 +285,7 @@ void elv_merge_requests(request_queue_t *q, struct request *rq,

if (e->ops->elevator_merge_req_fn)
e->ops->elevator_merge_req_fn(q, rq, next);
q->nr_sorted--;

q->last_merge = rq;
}
Expand Down Expand Up @@ -314,6 +317,20 @@ void elv_requeue_request(request_queue_t *q, struct request *rq)
__elv_add_request(q, rq, ELEVATOR_INSERT_FRONT, 0);
}

static void elv_drain_elevator(request_queue_t *q)
{
static int printed;
while (q->elevator->ops->elevator_dispatch_fn(q, 1))
;
if (q->nr_sorted == 0)
return;
if (printed++ < 10) {
printk(KERN_ERR "%s: forced dispatching is broken "
"(nr_sorted=%u), please report this\n",
q->elevator->elevator_type->elevator_name, q->nr_sorted);
}
}

void __elv_add_request(request_queue_t *q, struct request *rq, int where,
int plug)
{
Expand Down Expand Up @@ -348,9 +365,7 @@ void __elv_add_request(request_queue_t *q, struct request *rq, int where,

case ELEVATOR_INSERT_BACK:
rq->flags |= REQ_SOFTBARRIER;

while (q->elevator->ops->elevator_dispatch_fn(q, 1))
;
elv_drain_elevator(q);
list_add_tail(&rq->queuelist, &q->queue_head);
/*
* We kick the queue here for the following reasons.
Expand All @@ -369,6 +384,7 @@ void __elv_add_request(request_queue_t *q, struct request *rq, int where,
case ELEVATOR_INSERT_SORT:
BUG_ON(!blk_fs_request(rq));
rq->flags |= REQ_SORTED;
q->nr_sorted++;
if (q->last_merge == NULL && rq_mergeable(rq))
q->last_merge = rq;
/*
Expand Down Expand Up @@ -525,33 +541,19 @@ int elv_queue_empty(request_queue_t *q)

struct request *elv_latter_request(request_queue_t *q, struct request *rq)
{
struct list_head *next;

elevator_t *e = q->elevator;

if (e->ops->elevator_latter_req_fn)
return e->ops->elevator_latter_req_fn(q, rq);

next = rq->queuelist.next;
if (next != &q->queue_head && next != &rq->queuelist)
return list_entry_rq(next);

return NULL;
}

struct request *elv_former_request(request_queue_t *q, struct request *rq)
{
struct list_head *prev;

elevator_t *e = q->elevator;

if (e->ops->elevator_former_req_fn)
return e->ops->elevator_former_req_fn(q, rq);

prev = rq->queuelist.prev;
if (prev != &q->queue_head && prev != &rq->queuelist)
return list_entry_rq(prev);

return NULL;
}

Expand Down Expand Up @@ -691,13 +693,15 @@ static void elevator_switch(request_queue_t *q, struct elevator_type *new_e)

set_bit(QUEUE_FLAG_ELVSWITCH, &q->queue_flags);

while (q->elevator->ops->elevator_dispatch_fn(q, 1))
;
elv_drain_elevator(q);

while (q->rq.elvpriv) {
blk_remove_plug(q);
q->request_fn(q);
spin_unlock_irq(q->queue_lock);
msleep(10);
spin_lock_irq(q->queue_lock);
elv_drain_elevator(q);
}

spin_unlock_irq(q->queue_lock);
Expand Down Expand Up @@ -744,13 +748,15 @@ static void elevator_switch(request_queue_t *q, struct elevator_type *new_e)
ssize_t elv_iosched_store(request_queue_t *q, const char *name, size_t count)
{
char elevator_name[ELV_NAME_MAX];
size_t len;
struct elevator_type *e;

memset(elevator_name, 0, sizeof(elevator_name));
strncpy(elevator_name, name, sizeof(elevator_name));
elevator_name[sizeof(elevator_name) - 1] = '\0';
strncpy(elevator_name, name, sizeof(elevator_name) - 1);
len = strlen(elevator_name);

if (elevator_name[strlen(elevator_name) - 1] == '\n')
elevator_name[strlen(elevator_name) - 1] = '\0';
if (len && elevator_name[len - 1] == '\n')
elevator_name[len - 1] = '\0';

e = elevator_get(elevator_name);
if (!e) {
Expand Down
14 changes: 8 additions & 6 deletions block/genhd.c
Original file line number Diff line number Diff line change
Expand Up @@ -391,12 +391,14 @@ static ssize_t disk_stats_read(struct gendisk * disk, char *page)
"%8u %8u %8llu %8u "
"%8u %8u %8u"
"\n",
disk_stat_read(disk, ios[0]), disk_stat_read(disk, merges[0]),
(unsigned long long)disk_stat_read(disk, sectors[0]),
jiffies_to_msecs(disk_stat_read(disk, ticks[0])),
disk_stat_read(disk, ios[1]), disk_stat_read(disk, merges[1]),
(unsigned long long)disk_stat_read(disk, sectors[1]),
jiffies_to_msecs(disk_stat_read(disk, ticks[1])),
disk_stat_read(disk, ios[READ]),
disk_stat_read(disk, merges[READ]),
(unsigned long long)disk_stat_read(disk, sectors[READ]),
jiffies_to_msecs(disk_stat_read(disk, ticks[READ])),
disk_stat_read(disk, ios[WRITE]),
disk_stat_read(disk, merges[WRITE]),
(unsigned long long)disk_stat_read(disk, sectors[WRITE]),
jiffies_to_msecs(disk_stat_read(disk, ticks[WRITE])),
disk->in_flight,
jiffies_to_msecs(disk_stat_read(disk, io_ticks)),
jiffies_to_msecs(disk_stat_read(disk, time_in_queue)));
Expand Down
Loading

0 comments on commit 85d6162

Please sign in to comment.