Browse Source

[SCSI] libosd: Free resources in reverse order of allocation

At osd_end_request first free the request that might
point to pages, then free these pages. In reverse order
of allocation. For now it's just anal neatness. When we'll
use mempools It'll also pay in performance.

Signed-off-by: Boaz Harrosh <bharrosh@panasas.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
Boaz Harrosh 14 years ago
parent
commit
c4df46c49d
1 changed files with 5 additions and 4 deletions
  1. 5 4
      drivers/scsi/osd/osd_initiator.c

+ 5 - 4
drivers/scsi/osd/osd_initiator.c

@@ -452,10 +452,6 @@ void osd_end_request(struct osd_request *or)
 {
 {
 	struct request *rq = or->request;
 	struct request *rq = or->request;
 
 
-	_osd_free_seg(or, &or->set_attr);
-	_osd_free_seg(or, &or->enc_get_attr);
-	_osd_free_seg(or, &or->get_attr);
-
 	if (rq) {
 	if (rq) {
 		if (rq->next_rq) {
 		if (rq->next_rq) {
 			_put_request(rq->next_rq);
 			_put_request(rq->next_rq);
@@ -464,6 +460,11 @@ void osd_end_request(struct osd_request *or)
 
 
 		_put_request(rq);
 		_put_request(rq);
 	}
 	}
+
+	_osd_free_seg(or, &or->get_attr);
+	_osd_free_seg(or, &or->enc_get_attr);
+	_osd_free_seg(or, &or->set_attr);
+
 	_osd_request_free(or);
 	_osd_request_free(or);
 }
 }
 EXPORT_SYMBOL(osd_end_request);
 EXPORT_SYMBOL(osd_end_request);