/*
* logfile.c - NTFS kernel journal handling. Part of the Linux-NTFS project.
*
- * Copyright (c) 2002-2004 Anton Altaparmakov.
+ * Copyright (c) 2002-2004 Anton Altaparmakov
*
* This program/include file is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as published
#include <linux/fs.h>
#include <linux/highmem.h>
#include <linux/buffer_head.h>
+#include <linux/bitops.h>
#include "logfile.h"
#include "volume.h"
else
log_page_size = PAGE_CACHE_SIZE;
log_page_mask = log_page_size - 1;
- log_page_bits = ffs(log_page_size) - 1;
+ /*
+ * Use generic_ffs() instead of ffs() to enable the compiler to
+ * optimize log_page_size and log_page_bits into constants.
+ */
+ log_page_bits = generic_ffs(log_page_size) - 1;
size &= ~(log_page_size - 1);
/*
* Ensure the log file is big enough to store at least the two restart
* empty block after a non-empty block has been encountered
* means we are done.
*/
- if (!ntfs_is_empty_recordp(kaddr))
+ if (!ntfs_is_empty_recordp((le32*)kaddr))
logfile_is_empty = FALSE;
else if (!logfile_is_empty)
break;
* A log record page means there cannot be a restart page after
* this so no need to continue searching.
*/
- if (ntfs_is_rcrd_recordp(kaddr))
+ if (ntfs_is_rcrd_recordp((le32*)kaddr))
break;
/*
* A modified by chkdsk restart page means we cannot handle
* this log file.
*/
- if (ntfs_is_chkd_recordp(kaddr)) {
+ if (ntfs_is_chkd_recordp((le32*)kaddr)) {
ntfs_error(vol->sb, "$LogFile has been modified by "
"chkdsk. Mount this volume in "
"Windows.");
goto err_out;
}
/* If not a restart page, continue. */
- if (!ntfs_is_rstr_recordp(kaddr)) {
+ if (!ntfs_is_rstr_recordp((le32*)kaddr)) {
/* Skip to the minimum page size for the next one. */
if (!pos)
pos = NTFS_BLOCK_SIZE >> 1;
* @log_vi: struct inode of loaded journal $LogFile to empty
*
* Empty the contents of the $LogFile journal @log_vi and return TRUE on
- * success FALSE on error.
+ * success and FALSE on error.
*
* This function assumes that the $LogFile journal has already been consistency
* checked by a call to ntfs_check_logfile() and that ntfs_is_logfile_clean()