m->usa_ofs = cpu_to_le16((sizeof(MFT_RECORD) + 1) & ~1);
m->usa_count = cpu_to_le16(size / NTFS_BLOCK_SIZE + 1);
/* Set the update sequence number to 1. */
- *(u16*)((char*)m + ((sizeof(MFT_RECORD) + 1) & ~1)) = cpu_to_le16(1);
+ *(le16*)((char*)m + ((sizeof(MFT_RECORD) + 1) & ~1)) = cpu_to_le16(1);
m->lsn = cpu_to_le64(0LL);
m->sequence_number = cpu_to_le16(1);
- m->link_count = cpu_to_le16(0);
+ m->link_count = 0;
/* Aligned to 8-byte boundary. */
m->attrs_offset = cpu_to_le16((le16_to_cpu(m->usa_ofs) +
(le16_to_cpu(m->usa_count) << 1) + 7) & ~7);
- m->flags = cpu_to_le16(0);
+ m->flags = 0;
/*
* Using attrs_offset plus eight bytes (for the termination attribute),
* aligned to 8-byte boundary.
~7);
m->bytes_allocated = cpu_to_le32(size);
m->base_mft_record = cpu_to_le64((MFT_REF)0);
- m->next_attr_instance = cpu_to_le16(0);
+ m->next_attr_instance = 0;
a = (ATTR_RECORD*)((char*)m + le16_to_cpu(m->attrs_offset));
a->type = AT_END;
- a->length = cpu_to_le32(0);
+ a->length = 0;
}
/**
#ifdef NTFS_RW
.writepage = ntfs_mft_writepage, /* Write out the dirty mft
records in a page. */
+ .set_page_dirty = __set_page_dirty_nobuffers, /* Set the page dirty
+ without touching the buffers
+ belonging to the page. */
#endif /* NTFS_RW */
};
/**
* map_extent_mft_record - load an extent inode and attach it to its base
* @base_ni: base ntfs inode
- * @mref: mft reference of the extent inode to load (in little endian)
+ * @mref: mft reference of the extent inode to load
* @ntfs_ino: on successful return, pointer to the ntfs_inode structure
*
* Load the extent mft record @mref and attach it to its base inode @base_ni.
- * Return the mapped extent mft record if IS_ERR(result) is false. Otherwise
+ * Return the mapped extent mft record if IS_ERR(result) is false. Otherwise
* PTR_ERR(result) gives the negative error code.
*
* On successful return, @ntfs_ino contains a pointer to the ntfs_inode
ntfs_inode *ni = NULL;
ntfs_inode **extent_nis = NULL;
int i;
- unsigned long mft_no = MREF_LE(mref);
- u16 seq_no = MSEQNO_LE(mref);
+ unsigned long mft_no = MREF(mref);
+ u16 seq_no = MSEQNO(mref);
BOOL destroy_ni = FALSE;
ntfs_debug("Mapping extent mft record 0x%lx (base mft record 0x%lx).",
ni->ext.base_ntfs_ino = base_ni;
/* Now map the record. */
m = map_mft_record(ni);
- if (unlikely(IS_ERR(m))) {
+ if (IS_ERR(m)) {
up(&base_ni->extent_lock);
atomic_dec(&base_ni->count);
ntfs_clear_extent_inode(ni);
m = ERR_PTR(-ENOMEM);
goto unm_err_out;
}
- if (base_ni->ext.extent_ntfs_inos) {
+ if (base_ni->nr_extents) {
+ BUG_ON(!base_ni->ext.extent_ntfs_inos);
memcpy(tmp, base_ni->ext.extent_ntfs_inos, new_size -
4 * sizeof(ntfs_inode *));
kfree(base_ni->ext.extent_ntfs_inos);
/* Get the page containing the mirror copy of the mft record @m. */
page = ntfs_map_page(vol->mftmirr_ino->i_mapping, ni->mft_no >>
(PAGE_CACHE_SHIFT - vol->mft_record_size_bits));
- if (unlikely(IS_ERR(page))) {
+ if (IS_ERR(page)) {
ntfs_error(vol->sb, "Failed to map mft mirror page.");
err = PTR_ERR(page);
goto err_out;
ntfs_debug("Entering for inode 0x%lx.", ni->mft_no);
BUG_ON(NInoAttr(ni));
BUG_ON(!max_bhs);
- BUG_ON(!page);
BUG_ON(!PageLocked(page));
/*
* If the ntfs_inode is clean no need to do anything. If it is dirty,
* mark it as clean now so that it can be redirtied later on if needed.
- * There is no danger of races as as long as the caller is holding the
- * locks for the mft record @m and the page it is in.
+ * There is no danger of races since the caller is holding the locks
+ * for the mft record @m and the page it is in.
*/
if (!NInoTestClearDirty(ni))
goto done;
int nr, i, j;
BOOL is_dirty = FALSE;
+ BUG_ON(!PageLocked(page));
+ BUG_ON(PageWriteback(page));
BUG_ON(mft_vi != vol->mft_ino);
/* The first mft record number in the page. */
mft_no = page->index << (PAGE_CACHE_SHIFT - vol->mft_record_size_bits);
ntfs_debug("Inode 0x%lx is not in icache.", mft_no);
/* The inode is not in icache. */
/* Skip the record if it is not a mft record (type "FILE"). */
- if (!ntfs_is_mft_recordp(maddr)) {
+ if (!ntfs_is_mft_recordp((le32*)maddr)) {
ntfs_debug("Mft record 0x%lx is not a FILE record, "
"continuing search.", mft_no);
continue;