public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 2.6.6-rc3] as-io isolation ?
@ 2004-04-28 20:24 FabF
  2004-04-29  0:39 ` Nick Piggin
  0 siblings, 1 reply; 4+ messages in thread
From: FabF @ 2004-04-28 20:24 UTC (permalink / raw)
  To: lkml

[-- Attachment #1: Type: text/plain, Size: 282 bytes --]

Hi,

	Here's a patch _idea_ to isolate anticipatory I/O from normal I/O
scheduler process by adding a specific put io context method so that
ll_rw_blk stuff could be as-iosched transparent.I guess we could point
as iosched exit instead of exit_io_context as well ...

Regards,
FabF

[-- Attachment #2: asiocontext1.diff --]
[-- Type: text/x-patch, Size: 2485 bytes --]

diff -Naur orig/drivers/block/as-iosched.c edited/drivers/block/as-iosched.c
--- orig/drivers/block/as-iosched.c	2004-04-04 05:36:13.000000000 +0200
+++ edited/drivers/block/as-iosched.c	2004-04-28 22:05:21.000000000 +0200
@@ -222,6 +222,16 @@
 	return ret;
 }
 
+void as_put_io_context(struct io_context *ioc)
+{
+	if (ioc == NULL)
+		return;
+        if (ioc->aic && ioc->aic->dtor)
+        	ioc->aic->dtor(ioc->aic);
+	put_io_context(ioc);
+	
+}
+
 /*
  * If the current task has no AS IO context then create one and initialise it.
  * Then take a ref on the task's io context and return it.
@@ -231,10 +241,8 @@
 	struct io_context *ioc = get_io_context(GFP_ATOMIC);
 	if (ioc && !ioc->aic) {
 		ioc->aic = alloc_as_io_context();
-		if (!ioc->aic) {
-			put_io_context(ioc);
-			ioc = NULL;
-		}
+		if (!ioc->aic) 
+			as_put_io_context(ioc);
 	}
 	return ioc;
 }
@@ -1015,7 +1023,7 @@
 		}
 	}
 
-	put_io_context(arq->io_context);
+	as_put_io_context(arq->io_context);
 out:
 	arq->state = AS_RQ_POSTSCHED;
 }
@@ -1183,10 +1191,8 @@
 		/* In case we have to anticipate after this */
 		copy_io_context(&ad->io_context, &arq->io_context);
 	} else {
-		if (ad->io_context) {
-			put_io_context(ad->io_context);
-			ad->io_context = NULL;
-		}
+		if (ad->io_context) 
+			as_put_io_context(ad->io_context);
 
 		if (ad->current_write_count != 0)
 			ad->current_write_count--;
@@ -1837,7 +1843,7 @@
 	BUG_ON(!list_empty(&ad->fifo_list[REQ_ASYNC]));
 
 	mempool_destroy(ad->arq_pool);
-	put_io_context(ad->io_context);
+	as_put_io_context(ad->io_context);
 	kfree(ad->hash);
 	kfree(ad);
 }
diff -Naur orig/drivers/block/ll_rw_blk.c edited/drivers/block/ll_rw_blk.c
--- orig/drivers/block/ll_rw_blk.c	2004-04-28 19:13:23.000000000 +0200
+++ edited/drivers/block/ll_rw_blk.c	2004-04-28 22:06:35.000000000 +0200
@@ -2844,13 +2844,12 @@
 	BUG_ON(atomic_read(&ioc->refcount) == 0);
 
 	if (atomic_dec_and_test(&ioc->refcount)) {
-		if (ioc->aic && ioc->aic->dtor)
-			ioc->aic->dtor(ioc->aic);
 		kfree(ioc);
+		ioc=NULL;
 	}
 }
 
-/* Called by the exitting task */
+/* Called by the exiting task */
 void exit_io_context(void)
 {
 	unsigned long flags;
@@ -2859,10 +2858,10 @@
 	local_irq_save(flags);
 	ioc = current->io_context;
 	if (ioc) {
-		if (ioc->aic && ioc->aic->exit)
+		if (ioc->aic && ioc->aic->exit){
 			ioc->aic->exit(ioc->aic);
-		put_io_context(ioc);
-		current->io_context = NULL;
+			as_put_io_context(ioc);
+		}
 	} else
 		WARN_ON(1);
 	local_irq_restore(flags);

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2004-04-30 12:18 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-04-28 20:24 [PATCH 2.6.6-rc3] as-io isolation ? FabF
2004-04-29  0:39 ` Nick Piggin
2004-04-29 15:38   ` FabF
2004-04-30 12:18     ` Jens Axboe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox