[stgt] [PATCH 08/12] Use bs_finish in thread per target

FUJITA Tomonori fujita.tomonori at lab.ntt.co.jp
Mon Oct 11 20:34:50 CEST 2010


On Mon, 27 Sep 2010 14:07:19 -0700
Chandra Seetharaman <sekharan at us.ibm.com> wrote:

> Use bs_finish data structure in iSCSI thread per target context.
> 
> Signed-off-by: FUJITA Tomonori <fujita.tomonori at lab.ntt.co.jp>
> Signed-off-by: Chandra Seetharaman <sekharan at us.ibm.com>
> 
> ---
>  usr/bs.c           |    1 +
>  usr/iscsi/iscsid.h |    2 ++
>  usr/iscsi/target.c |   17 ++++++++++++++++-
>  3 files changed, 19 insertions(+), 1 deletion(-)
> 
> Index: tgt-102236c/usr/bs.c
> ===================================================================
> --- tgt-102236c.orig/usr/bs.c
> +++ tgt-102236c/usr/bs.c
> @@ -34,6 +34,7 @@
>  
>  #include "list.h"
>  #include "tgtd.h"
> +#include "target.h"
>  #include "tgtadm_error.h"
>  #include "util.h"
>  #include "target.h"
> Index: tgt-102236c/usr/iscsi/iscsid.h
> ===================================================================
> --- tgt-102236c.orig/usr/iscsi/iscsid.h
> +++ tgt-102236c/usr/iscsi/iscsid.h
> @@ -259,6 +259,8 @@ struct iscsi_target {
>  
>  	pthread_t thread;
>  	int stop_pthread;
> +
> +	struct bs_finish bsfin;
>  };
>  
>  enum task_flags {
> Index: tgt-102236c/usr/iscsi/target.c
> ===================================================================
> --- tgt-102236c.orig/usr/iscsi/target.c
> +++ tgt-102236c/usr/iscsi/target.c
> @@ -384,6 +384,7 @@ void iscsi_target_destroy(int tid)
>  		pthread_kill(target->thread, SIGUSR2);
>  
>  		pthread_join(target->thread, NULL);
> +		pthread_mutex_destroy(&target->bsfin.finished_lock);
>  	}
>  
>  	close(target->efd);
> @@ -405,6 +406,18 @@ static void *iscsi_thread_fn(void *arg)
>  	sigaddset(&mask, SIGUSR2);
>  	pthread_sigmask(SIG_BLOCK, &mask, NULL);
>  
> +	pthread_mutex_init(&t->bsfin.finished_lock, NULL);
> +	INIT_LIST_HEAD(&t->bsfin.finished_list);
> +
> +	t->bsfin.th_id = syscall(SYS_gettid);

Can we simply use gettid here?
--
To unsubscribe from this list: send the line "unsubscribe stgt" in
the body of a message to majordomo at vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html



More information about the stgt mailing list