[완료] ext3 에서 transaction과 handle과의 관계, start_this_handle()

kgykingdom의 이미지

ext3 저널링에서 언급되는 트랜잭션과 핸들과의 관계가 명확하게 이해가 되지 않습니다..

트랙잭션은 데이터 로그를 저널에 쓰는 단위를 이야기 하는 것 같은데 핸들은 이러한 데이터 로그를 저널에 직접적으로 쓰는 작업을 처리하는 핸들인가요?? 그렇다면 하나의 트랜잭션에 여러개의 핸들이 존재하는 건지..

그리고 <fs/jdb/transaction.c> 에서
static int start_this_handle(journal_t *journal, handle_t *handle)
{\
.....
....
handle->h_transaction = transaction;
transaction->t_outstanding_credits += nblocks;
transaction->t_updates++;
transaction->t_handle_count++;
.....
}

위의 코드가 어떤 일을 하는건지 모르겠습니다. 아시는 분 있으시면 답변 좀 달아주세요.. 급박함... 속터집니다..ㅡㅜ

pastime의 이미지

<fs/jbd/transaction.c> 에 보면

65 /*
66  * Handle management.
67  *
68  * A handle_t is an object which represents a single atomic update to a
69  * filesystem, and which tracks all of the modifications which form part
70  * of that one update.
71  */

핸들은 각각의 파일 시스템 변경 사항에 대한 정보를 유지하는 필드이고
트랜잭션은 이런 핸들들을 모아두고 있다가 적당한 시기에 기록하게 되는 듯 합니다.

kgykingdom wrote:
static int start_this_handle(journal_t *journal, handle_t *handle)
{\
.....
....
handle->h_transaction = transaction;
transaction->t_outstanding_credits += nblocks;
transaction->t_updates++;
transaction->t_handle_count++;
.....
}

위의 코드에서는 주어진 핸들이 속하는 트랜잭션 정보를 설정하고
현재 핸들이 변경하는 블럭의 수를 트랜잭션 정보에 더하고
트랜잭션내에서 관리하는 업데이트 수, 핸들의 수 등의 정보를 갱신하게 됩니다.

kgykingdom의 이미지

감사합니다. 궁금증이 어느정도 해소 되었네요.. ^^