Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Macros | Functions
wl.c File Reference
#include <linux/slab.h>
#include <linux/crc32.h>
#include <linux/freezer.h>
#include <linux/kthread.h>
#include "ubi.h"

Go to the source code of this file.

Macros

#define WL_RESERVED_PEBS   1
 
#define UBI_WL_THRESHOLD   CONFIG_MTD_UBI_WL_THRESHOLD
 
#define WL_FREE_MAX_DIFF   (2*UBI_WL_THRESHOLD)
 
#define WL_MAX_FAILURES   32
 

Functions

int ubi_wl_get_peb (struct ubi_device *ubi)
 
int ubi_wl_put_peb (struct ubi_device *ubi, int vol_id, int lnum, int pnum, int torture)
 
int ubi_wl_scrub_peb (struct ubi_device *ubi, int pnum)
 
int ubi_wl_flush (struct ubi_device *ubi, int vol_id, int lnum)
 
int ubi_thread (void *u)
 
int ubi_wl_init (struct ubi_device *ubi, struct ubi_attach_info *ai)
 
void ubi_wl_close (struct ubi_device *ubi)
 

Macro Definition Documentation

#define UBI_WL_THRESHOLD   CONFIG_MTD_UBI_WL_THRESHOLD

Definition at line 117 of file wl.c.

#define WL_FREE_MAX_DIFF   (2*UBI_WL_THRESHOLD)

Definition at line 130 of file wl.c.

#define WL_MAX_FAILURES   32

Definition at line 136 of file wl.c.

#define WL_RESERVED_PEBS   1

Definition at line 109 of file wl.c.

Function Documentation

int ubi_thread ( void u)

ubi_thread - UBI background thread. : the UBI device description object pointer

Definition at line 1790 of file wl.c.

void ubi_wl_close ( struct ubi_device ubi)

ubi_wl_close - close the wear-leveling sub-system. : UBI device description object

Definition at line 2025 of file wl.c.

int ubi_wl_flush ( struct ubi_device ubi,
int  vol_id,
int  lnum 
)

ubi_wl_flush - flush all pending works. : UBI device description object : the volume id to flush for : the logical eraseblock number to flush for

This function executes all pending works for a particular volume id / logical eraseblock number pair. If either value is set to UBI_ALL, then it acts as a wildcard for all of the corresponding volume numbers or logical eraseblock numbers. It returns zero in case of success and a negative error code in case of failure.

Definition at line 1704 of file wl.c.

int ubi_wl_get_peb ( struct ubi_device ubi)

Definition at line 684 of file wl.c.

int ubi_wl_init ( struct ubi_device ubi,
struct ubi_attach_info ai 
)

ubi_wl_init - initialize the WL sub-system using attaching information. : UBI device description object : attaching information

This function returns zero in case of success, and a negative error code in case of failure.

Definition at line 1868 of file wl.c.

int ubi_wl_put_peb ( struct ubi_device ubi,
int  vol_id,
int  lnum,
int  pnum,
int  torture 
)

ubi_wl_put_peb - return a PEB to the wear-leveling sub-system. : UBI device description object : the volume ID that last used this PEB : the last used logical eraseblock number for the PEB : physical eraseblock to return : if this physical eraseblock has to be tortured

This function is called to return physical eraseblock to the pool of free physical eraseblocks. The flag has to be set if an I/O error occurred to this and it has to be tested. This function returns zero in case of success, and a negative error code in case of failure.

Definition at line 1552 of file wl.c.

int ubi_wl_scrub_peb ( struct ubi_device ubi,
int  pnum 
)

ubi_wl_scrub_peb - schedule a physical eraseblock for scrubbing. : UBI device description object : the physical eraseblock to schedule

If a bit-flip in a physical eraseblock is detected, this physical eraseblock needs scrubbing. This function schedules a physical eraseblock for scrubbing which is done in background. This function returns zero in case of success and a negative error code in case of failure.

Definition at line 1639 of file wl.c.