From 53d59aad9326199ef5749c97513db498309a057e Mon Sep 17 00:00:00 2001 From: Anton Altaparmakov Date: Thu, 17 Mar 2005 10:51:33 +0000 Subject: NTFS: Fix compilation when configured read-only. - Add ifdef NTFS_RW around write specific code if fs/ntfs/runlist.[hc] and fs/ntfs/attrib.[hc]. - Minor bugfix to fs/ntfs/attrib.c::ntfs_attr_make_non_resident() where the runlist was not freed in all error cases. - Add fs/ntfs/runlist.[hc]::ntfs_rl_find_vcn_nolock(). Signed-off-by: Anton Altaparmakov --- fs/ntfs/attrib.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'fs/ntfs/attrib.c') diff --git a/fs/ntfs/attrib.c b/fs/ntfs/attrib.c index 97e6fb047aa..1b95f39234a 100644 --- a/fs/ntfs/attrib.c +++ b/fs/ntfs/attrib.c @@ -1057,6 +1057,8 @@ void ntfs_attr_put_search_ctx(ntfs_attr_search_ctx *ctx) return; } +#ifdef NTFS_RW + /** * ntfs_attr_find_in_attrdef - find an attribute in the $AttrDef system file * @vol: ntfs volume to which the attribute belongs @@ -1243,6 +1245,13 @@ int ntfs_attr_record_resize(MFT_RECORD *m, ATTR_RECORD *a, u32 new_size) * -ENOSPC - Not enough disk space. * -EINVAL - Attribute not defined on the volume. * -EIO - I/o error or other error. + * Note that -ENOSPC is also returned in the case that there is not enough + * space in the mft record to do the conversion. This can happen when the mft + * record is already very full. The caller is responsible for trying to make + * space in the mft record and trying again. FIXME: Do we need a separate + * error return code for this kind of -ENOSPC or is it always worth trying + * again in case the attribute may then fit in a resident state so no need to + * make it non-resident at all? Ho-hum... (AIA) * * NOTE to self: No changes in the attribute list are required to move from * a resident to a non-resident attribute. @@ -1520,13 +1529,13 @@ err_out: rl_err_out: if (rl) { if (ntfs_cluster_free_from_rl(vol, rl) < 0) { - ntfs_free(rl); ntfs_error(vol->sb, "Failed to release allocated " "cluster(s) in error code path. Run " "chkdsk to recover the lost " "cluster(s)."); NVolSetErrors(vol); } + ntfs_free(rl); page_err_out: unlock_page(page); page_cache_release(page); @@ -1680,3 +1689,5 @@ done: ntfs_debug("Done."); return 0; } + +#endif /* NTFS_RW */ -- cgit v1.2.3