--------------------- PatchSet 299 Date: 2002/12/10 01:20:40 Author: rbcollins Branch: unify-io Tag: (none) Log: move readability test to IO object Members: src/fs/aufs/store_asyncufs.h:1.2.12.14->1.2.12.15 src/fs/aufs/store_io_aufs.cc:1.3.12.17->1.3.12.18 Index: squid3/src/fs/aufs/store_asyncufs.h =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/fs/aufs/Attic/store_asyncufs.h,v retrieving revision 1.2.12.14 retrieving revision 1.2.12.15 diff -u -r1.2.12.14 -r1.2.12.15 --- squid3/src/fs/aufs/store_asyncufs.h 9 Dec 2002 12:11:13 -0000 1.2.12.14 +++ squid3/src/fs/aufs/store_asyncufs.h 10 Dec 2002 01:20:40 -0000 1.2.12.15 @@ -95,6 +95,7 @@ void close(); virtual bool error() const; virtual int getFD() const { return fd;} + bool canRead() const; private: int fd; bool errorOccured; Index: squid3/src/fs/aufs/store_io_aufs.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/fs/aufs/Attic/store_io_aufs.cc,v retrieving revision 1.3.12.17 retrieving revision 1.3.12.18 diff -u -r1.3.12.17 -r1.3.12.18 --- squid3/src/fs/aufs/store_io_aufs.cc 9 Dec 2002 12:11:13 -0000 1.3.12.17 +++ squid3/src/fs/aufs/store_io_aufs.cc 10 Dec 2002 01:20:40 -0000 1.3.12.18 @@ -116,7 +116,7 @@ void AUFSFile::deleteSelf() const {delete this;} -AUFSFile::AUFSFile (char const *aPath, AufsIO *anIO):errorOccured (false), IO(anIO) { +AUFSFile::AUFSFile (char const *aPath, AufsIO *anIO):fd(-1), errorOccured (false), IO(anIO) { assert (aPath); debug (79,0)("UFSFile::UFSFile: %s\n", aPath); path_ = xstrdup (aPath); @@ -250,6 +250,13 @@ storeAufsIOCallback(sio, DISK_OK); } +bool +AUFSFile::canRead() const +{ + debug (79,3)("AUFSFile::canRead: fd is %d\n",fd); + return fd > -1; +} + /* Read */ void @@ -259,9 +266,9 @@ assert(sio->read.callback == NULL); assert(sio->read.callback_data == NULL); assert(!aiostate->reading); - if (aiostate->fd < 0) { + if (!((AUFSFile *)aiostate->theFile.getRaw())->canRead()) { struct _queued_read *q; - debug(79, 3) ("storeAufsRead: queueing read because FD < 0\n"); + debug(79, 3) ("storeAufsRead: queueing read because theFile can't read\n"); assert(aiostate->opening); assert(aiostate->pending_reads == NULL); q = (struct _queued_read *)memPoolAlloc(aufs_qread_pool);