summaryrefslogtreecommitdiff
path: root/eio.c
diff options
context:
space:
mode:
authorroot <root>2011-06-05 20:25:00 +0000
committerroot <root>2011-06-05 20:25:00 +0000
commit655aee59fd0808a47cf5a0bb544c16abd8924791 (patch)
treed398a3c9fe72f901c3593fb3dd97327a7e958862 /eio.c
parent653e0063cb266d51505942ab3642db3401aa7806 (diff)
make mtouch cancellable
Diffstat (limited to 'eio.c')
-rw-r--r--eio.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/eio.c b/eio.c
index 4ab2dd3..07492cd 100644
--- a/eio.c
+++ b/eio.c
@@ -1525,8 +1525,12 @@ eio__msync (void *mem, size_t len, int flags)
#endif
int
-eio__mtouch (void *mem, size_t len, int flags)
+eio__mtouch (eio_req *req)
{
+ void *mem = req->ptr2;
+ size_t len = req->size;
+ int flags = req->int1;
+
eio_page_align (&mem, &len);
{
@@ -1536,9 +1540,9 @@ eio__mtouch (void *mem, size_t len, int flags)
if (addr < end)
if (flags & EIO_MT_MODIFY) /* modify */
- do { *((volatile sig_atomic_t *)addr) |= 0; } while ((addr += page) < len);
+ do { *((volatile sig_atomic_t *)addr) |= 0; } while ((addr += page) < len && !EIO_CANCELLED (req));
else
- do { *((volatile sig_atomic_t *)addr) ; } while ((addr += page) < len);
+ do { *((volatile sig_atomic_t *)addr) ; } while ((addr += page) < len && !EIO_CANCELLED (req));
}
return 0;
@@ -1722,7 +1726,7 @@ static void eio_execute (etp_worker *self, eio_req *req)
case EIO_FSYNC: req->result = fsync (req->int1); break;
case EIO_FDATASYNC: req->result = fdatasync (req->int1); break;
case EIO_MSYNC: req->result = eio__msync (req->ptr2, req->size, req->int1); break;
- case EIO_MTOUCH: req->result = eio__mtouch (req->ptr2, req->size, req->int1); break;
+ case EIO_MTOUCH: req->result = eio__mtouch (req); break;
case EIO_MLOCK: req->result = eio__mlock (req->ptr2, req->size); break;
case EIO_MLOCKALL: req->result = eio__mlockall (req->int1); break;
case EIO_SYNC_FILE_RANGE: req->result = eio__sync_file_range (req->int1, req->offs, req->size, req->int2); break;