struct address_space *mapping;
struct folio *folio;
u8 *kaddr;
- int pos, len;
+ int pos, len, err;
u8 bit;
struct ntfs_inode *ni = NTFS_I(vi);
struct ntfs_volume *vol = ni->vol;
/* If we are not in the last page, deal with all subsequent pages. */
while (index < end_index) {
- if (cnt <= 0)
+ if (cnt <= 0) {
+ err = -EIO;
goto rollback;
+ }
/* Update @index and get the next folio. */
folio_mark_dirty(folio);
ntfs_error(vi->i_sb,
"Failed to map subsequent page (error %li), aborting.",
PTR_ERR(folio));
+ err = PTR_ERR(folio);
goto rollback;
}
* - @count - @cnt is the number of bits that have been modified
*/
if (is_rollback)
- return PTR_ERR(folio);
+ return err;
if (count != cnt)
pos = __ntfs_bitmap_set_bits_in_run(vi, start_bit, count - cnt,
value ? 0 : 1, true);
if (!pos) {
/* Rollback was successful. */
ntfs_error(vi->i_sb,
- "Failed to map subsequent page (error %li), aborting.",
- PTR_ERR(folio));
+ "Failed to map subsequent page (error %i), aborting.",
+ err);
} else {
/* Rollback failed. */
ntfs_error(vi->i_sb,
- "Failed to map subsequent page (error %li) and rollback failed (error %i). Aborting and leaving inconsistent metadata. Unmount and run chkdsk.",
- PTR_ERR(folio), pos);
+ "Failed to map subsequent page (error %i) and rollback failed (error %i). Aborting and leaving inconsistent metadata. Unmount and run chkdsk.",
+ err, pos);
NVolSetErrors(NTFS_SB(vi->i_sb));
}
- return PTR_ERR(folio);
+ return err;
}