Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Functions
index.c File Reference
#include <linux/slab.h>
#include "aops.h"
#include "collate.h"
#include "debug.h"
#include "index.h"
#include "ntfs.h"

Go to the source code of this file.

Functions

ntfs_index_contextntfs_index_ctx_get (ntfs_inode *idx_ni)
 
void ntfs_index_ctx_put (ntfs_index_context *ictx)
 
int ntfs_index_lookup (const void *key, const int key_len, ntfs_index_context *ictx)
 

Function Documentation

ntfs_index_context* ntfs_index_ctx_get ( ntfs_inode idx_ni)

ntfs_index_ctx_get - allocate and initialize a new index context : ntfs index inode with which to initialize the context

Allocate a new index context, initialize it with and return it. Return NULL if allocation failed.

Locking: Caller must hold i_mutex on the index inode.

Definition at line 39 of file index.c.

void ntfs_index_ctx_put ( ntfs_index_context ictx)

ntfs_index_ctx_put - release an index context : index context to free

Release the index context , releasing all associated resources.

Locking: Caller must hold i_mutex on the index inode.

Definition at line 57 of file index.c.

int ntfs_index_lookup ( const void key,
const int  key_len,
ntfs_index_context ictx 
)

ntfs_index_lookup - find a key in an index and return its index entry : [IN] key for which to search in the index : [IN] length of in bytes : [IN/OUT] context describing the index and the returned entry

Before calling ntfs_index_lookup(), must have been obtained from a call to ntfs_index_ctx_get().

Look for the in the index specified by the index lookup context . ntfs_index_lookup() walks the contents of the index looking for the .

If the is found in the index, 0 is returned and is setup to describe the index entry containing the matching . ->entry is the index entry and ->data and ->data_len are the index entry data and its length in bytes, respectively.

If the is not found in the index, -ENOENT is returned and is setup to describe the index entry whose key collates immediately after the search , i.e. this is the position in the index at which an index entry with a key of would need to be inserted.

If an error occurs return the negative error code and is left untouched.

When finished with the entry and its data, call ntfs_index_ctx_put() to free the context and other associated resources.

If the index entry was modified, call flush_dcache_index_entry_page() immediately after the modification and either ntfs_index_entry_mark_dirty() or ntfs_index_entry_write() before the call to ntfs_index_ctx_put() to ensure that the changes are written to disk.

Locking: - Caller must hold i_mutex on the index inode.

  • Each page cache page in the index allocation mapping must be locked whilst being accessed otherwise we may find a corrupt page due to it being under ->writepage at the moment which applies the mst protection fixups before writing out and then removes them again after the write is complete after which it unlocks the page.

Definition at line 119 of file index.c.