ntfs_attr_search_ctx old_ctx; 
ntfs_attr_search_ctx old_ctx = { NULL, }; 
int ntfs_map_runlist_nolock(ntfs_inode *ni, VCN vcn, ntfs_attr_search_ctx *ctx){	VCN end_vcn;	unsigned long flags;	ntfs_inode *base_ni;	MFT_RECORD *m;	ATTR_RECORD *a;	runlist_element *rl;	struct page *put_this_page = NULL;	int err = 0;	BOOL ctx_is_temporary, ctx_needs_reset;	ntfs_attr_search_ctx old_ctx;	ntfs_debug("Mapping runlist part containing vcn 0x%llx.",			(unsigned long long)vcn);	if (!NInoAttr(ni))		base_ni = ni;	else		base_ni = ni->ext.base_ntfs_ino;	if (!ctx) {		ctx_is_temporary = ctx_needs_reset = TRUE;		m = map_mft_record(base_ni);		if (IS_ERR(m))			return PTR_ERR(m);		ctx = ntfs_attr_get_search_ctx(base_ni, m);		if (unlikely(!ctx)) {			err = -ENOMEM;			goto err_out;		}	} else {		VCN allocated_size_vcn;		BUG_ON(IS_ERR(ctx->mrec));		a = ctx->attr;		BUG_ON(!a->non_resident);		ctx_is_temporary = FALSE;		end_vcn = sle64_to_cpu(a->data.non_resident.highest_vcn);		read_lock_irqsave(&ni->size_lock, flags);		allocated_size_vcn = ni->allocated_size >>				ni->vol->cluster_size_bits;		read_unlock_irqrestore(&ni->size_lock, flags);		if (!a->data.non_resident.lowest_vcn && end_vcn <= 0)			end_vcn = allocated_size_vcn - 1;		/*		 * If we already have the attribute extent containing @vcn in		 * @ctx, no need to look it up again.  We slightly cheat in		 * that if vcn exceeds the allocated size, we will refuse to		 * map the runlist below, so there is definitely no need to get		 * the right attribute extent.		 */		if (vcn >= allocated_size_vcn || (a->type == ni->type &&				a->name_length == ni->name_len &&				!memcmp((u8*)a + le16_to_cpu(a->name_offset),				ni->name, ni->name_len) &&				sle64_to_cpu(a->data.non_resident.lowest_vcn)				<= vcn && end_vcn >= vcn))			ctx_needs_reset = FALSE;		else {			/* Save the old search context. */			old_ctx = *ctx;			/*			 * If the currently mapped (extent) inode is not the			 * base inode we will unmap it when we reinitialize the			 * search context which means we need to get a			 * reference to the page containing the mapped mft			 * record so we do not accidentally drop changes to the			 * mft record when it has not been marked dirty yet.			 */			if (old_ctx.base_ntfs_ino && old_ctx.ntfs_ino !=					old_ctx.base_ntfs_ino) {				put_this_page = old_ctx.ntfs_ino->page;				page_cache_get(put_this_page);			}			/*			 * Reinitialize the search context so we can lookup the			 * needed attribute extent.			 */			ntfs_attr_reinit_search_ctx(ctx);			ctx_needs_reset = TRUE;		}	}	if (ctx_needs_reset) {		err = ntfs_attr_lookup(ni->type, ni->name, ni->name_len,				CASE_SENSITIVE, vcn, NULL, 0, ctx);		if (unlikely(err)) {			if (err == -ENOENT)				err = -EIO;			goto err_out;		}		BUG_ON(!ctx->attr->non_resident);	}	a = ctx->attr;	/*	 * Only decompress the mapping pairs if @vcn is inside it.  Otherwise	 * we get into problems when we try to map an out of bounds vcn because	 * we then try to map the already mapped runlist fragment and	 * ntfs_mapping_pairs_decompress() fails.	 */	end_vcn = sle64_to_cpu(a->data.non_resident.highest_vcn) + 1;	if (!a->data.non_resident.lowest_vcn && end_vcn == 1)		end_vcn = sle64_to_cpu(a->data.non_resident.allocated_size) >>				ni->vol->cluster_size_bits;	if (unlikely(vcn >= end_vcn)) {		err = -ENOENT;		goto err_out;	}	rl = ntfs_mapping_pairs_decompress(ni->vol, a, ni->runlist.rl);	if (IS_ERR(rl))		err = PTR_ERR(rl);	else		ni->runlist.rl = rl;err_out:	if (ctx_is_temporary) {		if (likely(ctx))			ntfs_attr_put_search_ctx(ctx);		unmap_mft_record(base_ni);	} else if (ctx_needs_reset) {		/*		 * If there is no attribute list, restoring the search context		 * is acomplished simply by copying the saved context back over		 * the caller supplied context.  If there is an attribute list,		 * things are more complicated as we need to deal with mapping		 * of mft records and resulting potential changes in pointers.		 */		if (NInoAttrList(base_ni)) {			/*			 * If the currently mapped (extent) inode is not the			 * one we had before, we need to unmap it and map the			 * old one.			 */			if (ctx->ntfs_ino != old_ctx.ntfs_ino) {				/*				 * If the currently mapped inode is not the				 * base inode, unmap it.				 */				if (ctx->base_ntfs_ino && ctx->ntfs_ino !=						ctx->base_ntfs_ino) {					unmap_extent_mft_record(ctx->ntfs_ino);					ctx->mrec = ctx->base_mrec;					BUG_ON(!ctx->mrec);				}				/*				 * If the old mapped inode is not the base				 * inode, map it.				 */				if (old_ctx.base_ntfs_ino &&						old_ctx.ntfs_ino !=						old_ctx.base_ntfs_ino) {retry_map:					ctx->mrec = map_mft_record(							old_ctx.ntfs_ino);					/*					 * Something bad has happened.  If out					 * of memory retry till it succeeds.					 * Any other errors are fatal and we					 * return the error code in ctx->mrec.					 * Let the caller deal with it...  We					 * just need to fudge things so the					 * caller can reinit and/or put the					 * search context safely.					 */					if (IS_ERR(ctx->mrec)) {						if (PTR_ERR(ctx->mrec) ==								-ENOMEM) {							schedule();							goto retry_map;						} else							old_ctx.ntfs_ino =								old_ctx.								base_ntfs_ino;					}				}			}			/* Update the changed pointers in the saved context. */			if (ctx->mrec != old_ctx.mrec) {				if (!IS_ERR(ctx->mrec))					old_ctx.attr = (ATTR_RECORD*)(							(u8*)ctx->mrec +							((u8*)old_ctx.attr -							(u8*)old_ctx.mrec));				old_ctx.mrec = ctx->mrec;			}		}		/* Restore the search context to the saved one. */		*ctx = old_ctx;		/*		 * We drop the reference on the page we took earlier.  In the		 * case that IS_ERR(ctx->mrec) is true this means we might lose		 * some changes to the mft record that had been made between		 * the last time it was marked dirty/written out and now.  This		 * at this stage is not a problem as the mapping error is fatal		 * enough that the mft record cannot be written out anyway and		 * the caller is very likely to shutdown the whole inode		 * immediately and mark the volume dirty for chkdsk to pick up		 * the pieces anyway.		 */		if (put_this_page)			page_cache_release(put_this_page);	}	return err;}
10457	/local/tlutelli/issta_data/temp/c/2005_temp/2005/10457/dda65b941f992ab10fda3d9f09539c68206b7114/attrib.c/clean/fs/ntfs/attrib.c