.\" This manpage has been automatically generated by docbook2man
.\" from a DocBook document. This tool can be found at:
.\"
.\" Please send any bug reports, improvements, comments, patches,
.\" etc. to Steve Cheng .
.TH "WRITE_MFT_RECORD_NOLOCK" "9" "09 October 2005" "" ""
.SH NAME
write_mft_record_nolock \- write out a mapped (extent) mft record
.SH SYNOPSIS
"SYNOPSIS"
.sp
\fB
.sp
int write_mft_record_nolock (ntfs_inode * \fIni\fB, MFT_RECORD * \fIm\fB, int \fIsync\fB);
\fR
.SH "ARGUMENTS"
.TP
\fB\fIni\fB\fR
ntfs inode describing the mapped (extent) mft record
.TP
\fB\fIm\fB\fR
mapped (extent) mft record to write
.TP
\fB\fIsync\fB\fR
if true, wait for i/o completion
.SH "DESCRIPTION"
.PP
Write the mapped (extent) mft record \fIm\fR described by the (regular or extent)
ntfs inode \fIni\fR to backing store. If the mft record \fIm\fR has a counterpart in
the mft mirror, that is also updated.
.PP
We only write the mft record if the ntfs inode \fIni\fR is dirty and the first
buffer belonging to its mft record is dirty, too. We ignore the dirty state
of subsequent buffers because we could have raced with
fs/ntfs/aops.c::\fBmark_ntfs_record_dirty\fR\&.
.PP
On success, clean the mft record and return 0. On error, leave the mft
record dirty and return -errno. The caller should call \fBmake_bad_inode\fR on
the base inode to ensure no more access happens to this inode. We do not do
it here as the caller may want to finish writing other extent mft records
first to minimize on-disk metadata inconsistencies.
.SH "NOTE"
.PP
We always perform synchronous i/o and ignore the \fIsync\fR parameter.
However, if the mft record has a counterpart in the mft mirror and \fIsync\fR is
true, we write the mft record, wait for i/o completion, and only then write
the mft mirror copy. This ensures that if the system crashes either the mft
or the mft mirror will contain a self-consistent mft record \fIm\fR\&. If \fIsync\fR is
false on the other hand, we start i/o on both and then wait for completion
on them. This provides a speedup but no longer guarantees that you will end
up with a self-consistent mft record in the case of a crash but if you asked
for asynchronous writing you probably do not care about that anyway.
.SH "TODO"
.PP
If \fIsync\fR is false, want to do truly asynchronous i/o, i.e. just
schedule i/o via ->writepage or do it via kntfsd or whatever.