From 5277797dc4ed873d067477d84e910b39d113f649 Mon Sep 17 00:00:00 2001 From: Nicholas Bellinger Date: Wed, 6 Nov 2013 21:03:43 -0800 Subject: target: Add percpu refcounting for se_lun access This patch adds percpu refcounting for se_lun access that allows the association of an se_lun + se_cmd in transport_lookup_cmd_lun() to occur without an extra list_head for tracking outstanding I/O during se_lun shutdown. This effectively changes se_lun shutdown logic to wait for outstanding I/O percpu references to complete in transport_lun_remove_cmd() using se_lun->lun_ref_comp, instead of explicitly draining the per se_lun command list and waiting for individual se_cmd descriptor processing to complete. Cc: Kent Overstreet Signed-off-by: Nicholas Bellinger --- include/target/target_core_base.h | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'include/target') diff --git a/include/target/target_core_base.h b/include/target/target_core_base.h index 22e752c4406d..4d16fd9330a6 100644 --- a/include/target/target_core_base.h +++ b/include/target/target_core_base.h @@ -499,6 +499,9 @@ struct se_cmd { /* backend private data */ void *priv; + + /* Used for lun->lun_ref counting */ + bool lun_ref_active; }; struct se_ua { @@ -757,6 +760,8 @@ struct se_lun { struct se_port *lun_sep; struct config_group lun_group; struct se_port_stat_grps port_stat_grps; + struct completion lun_ref_comp; + struct percpu_ref lun_ref; }; struct scsi_port_stats { -- cgit v1.2.3-59-g8ed1b