* Also add the creating thread to an IORequest and let child requests
inherit it. * IOScheduler::ScheduleRequest() uses the request's thread and team now instead of the current one. Otherwise for requests processed iteratively this would always be the I/O scheduler's notifier thread. * Also get the thread's I/O priority now. It's still ignored later, though. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@27248 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
3b3e3805f8
commit
841b6cd749
@ -144,6 +144,7 @@ IOScheduler::Init(const char* name)
|
||||
IORequestOwner& owner = fAllocatedRequestOwners[i];
|
||||
owner.team = -1;
|
||||
owner.thread = -1;
|
||||
owner.priority = B_IDLE_PRIORITY;
|
||||
fUnusedRequestOwners.Add(&owner);
|
||||
}
|
||||
|
||||
@ -217,8 +218,7 @@ IOScheduler::ScheduleRequest(IORequest* request)
|
||||
|
||||
MutexLocker locker(fLock);
|
||||
|
||||
struct thread* thread = thread_get_current_thread();
|
||||
IORequestOwner* owner = _GetRequestOwner(thread->team->id, thread->id,
|
||||
IORequestOwner* owner = _GetRequestOwner(request->Team(), request->Thread(),
|
||||
true);
|
||||
if (owner == NULL) {
|
||||
panic("IOScheduler: Out of request owners!\n");
|
||||
@ -231,8 +231,10 @@ IOScheduler::ScheduleRequest(IORequest* request)
|
||||
bool wasActive = owner->IsActive();
|
||||
request->SetOwner(owner);
|
||||
owner->requests.Add(request);
|
||||
owner->priority = thread->priority;
|
||||
// TODO: Use the I/O priority instead!
|
||||
|
||||
int32 priority = thread_get_io_priority(request->Thread());
|
||||
if (priority >= 0)
|
||||
owner->priority = priority;
|
||||
//dprintf(" request %p -> owner %p (thread %ld, active %d)\n", request, owner, owner->thread, wasActive);
|
||||
|
||||
if (!wasActive)
|
||||
@ -753,6 +755,7 @@ IOScheduler::_GetRequestOwner(team_id team, thread_id thread, bool allocate)
|
||||
fRequestOwners->RemoveUnchecked(owner);
|
||||
owner->team = team;
|
||||
owner->thread = thread;
|
||||
owner->priority = B_IDLE_PRIORITY;
|
||||
fRequestOwners->InsertUnchecked(owner);
|
||||
break;
|
||||
}
|
||||
|
@ -12,7 +12,7 @@
|
||||
#include <debug.h>
|
||||
#include <heap.h>
|
||||
#include <kernel.h>
|
||||
#include <team.h>
|
||||
#include <thread.h>
|
||||
#include <util/AutoLock.h>
|
||||
#include <vm.h>
|
||||
|
||||
@ -640,7 +640,9 @@ IORequest::Init(off_t offset, size_t firstVecOffset, const iovec* vecs,
|
||||
fRelativeParentOffset = 0;
|
||||
fTransferSize = 0;
|
||||
fFlags = flags;
|
||||
fTeam = team_get_current_team_id();
|
||||
struct thread* thread = thread_get_current_thread();
|
||||
fTeam = thread->team->id;
|
||||
fThread = thread->id;
|
||||
fIsWrite = write;
|
||||
fPartialTransfer = 0;
|
||||
|
||||
@ -703,6 +705,8 @@ IORequest::CreateSubRequest(off_t parentOffset, off_t offset, size_t length,
|
||||
}
|
||||
|
||||
subRequest->fRelativeParentOffset = parentOffset - fOffset;
|
||||
subRequest->fTeam = fTeam;
|
||||
subRequest->fThread = fThread;
|
||||
|
||||
_subRequest = subRequest;
|
||||
subRequest->SetParent(this);
|
||||
@ -1183,6 +1187,7 @@ IORequest::Dump() const
|
||||
kprintf(" pending children: %ld\n", fPendingChildren);
|
||||
kprintf(" flags: %#lx\n", fFlags);
|
||||
kprintf(" team: %ld\n", fTeam);
|
||||
kprintf(" thread: %ld\n", fThread);
|
||||
kprintf(" r/w: %s\n", fIsWrite ? "write" : "read");
|
||||
kprintf(" partial transfer: %s\n", fPartialTransfer ? "yes" : "no");
|
||||
kprintf(" finished cvar: %p\n", &fFinishedCondition);
|
||||
|
@ -267,6 +267,7 @@ struct IORequest : IORequestChunk, DoublyLinkedListLinkImpl<IORequest> {
|
||||
bool IsWrite() const { return fIsWrite; }
|
||||
bool IsRead() const { return !fIsWrite; }
|
||||
team_id Team() const { return fTeam; }
|
||||
thread_id Thread() const { return fThread; }
|
||||
uint32 Flags() const { return fFlags; }
|
||||
|
||||
IOBuffer* Buffer() const { return fBuffer; }
|
||||
@ -321,6 +322,7 @@ private:
|
||||
int32 fPendingChildren;
|
||||
uint32 fFlags;
|
||||
team_id fTeam;
|
||||
thread_id fThread;
|
||||
bool fIsWrite;
|
||||
bool fPartialTransfer;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user