Merge git://git.infradead.org/mtd-2.6
* git://git.infradead.org/mtd-2.6: (82 commits) mtd: fix build error in m25p80.c mtd: Remove redundant mutex from mtd_blkdevs.c MTD: Fix wrong check register_blkdev return value Revert "mtd: cleanup Kconfig dependencies" mtd: cfi_cmdset_0002: make sector erase command variable mtd: cfi_cmdset_0002: add CFI detection for SST 38VF640x chips mtd: cfi_util: add support for switching SST 39VF640xB chips into QRY mode mtd: cfi_cmdset_0001: use defined value of P_ID_INTEL_PERFORMANCE instead of hardcoded one block2mtd: dubious assignment P4080/mtd: Fix the freescale lbc issue with 36bit mode P4080/eLBC: Make Freescale elbc interrupt common to elbc devices mtd: phram: use KBUILD_MODNAME mtd: OneNAND: S5PC110: Fix double call suspend & resume function mtd: nand: fix MTD_MODE_RAW writes jffs2: use kmemdup mtd: sm_ftl: cosmetic, use bool when possible mtd: r852: remove useless pci powerup/down from suspend/resume routines mtd: blktrans: fix a race vs kthread_stop mtd: blktrans: kill BKL mtd: allow to unload the mtdtrans module if its block devices aren't open ... Fix up trivial whitespace-introduced conflict in drivers/mtd/mtdchar.c
This commit is contained in:
@@ -23,7 +23,7 @@ static void jffs2_build_remove_unlinked_inode(struct jffs2_sb_info *,
|
||||
static inline struct jffs2_inode_cache *
|
||||
first_inode_chain(int *i, struct jffs2_sb_info *c)
|
||||
{
|
||||
for (; *i < INOCACHE_HASHSIZE; (*i)++) {
|
||||
for (; *i < c->inocache_hashsize; (*i)++) {
|
||||
if (c->inocache_list[*i])
|
||||
return c->inocache_list[*i];
|
||||
}
|
||||
|
@@ -103,7 +103,7 @@ uint16_t jffs2_compress(struct jffs2_sb_info *c, struct jffs2_inode_info *f,
|
||||
spin_unlock(&jffs2_compressor_list_lock);
|
||||
*datalen = orig_slen;
|
||||
*cdatalen = orig_dlen;
|
||||
compr_ret = this->compress(data_in, output_buf, datalen, cdatalen, NULL);
|
||||
compr_ret = this->compress(data_in, output_buf, datalen, cdatalen);
|
||||
spin_lock(&jffs2_compressor_list_lock);
|
||||
this->usecount--;
|
||||
if (!compr_ret) {
|
||||
@@ -152,7 +152,7 @@ uint16_t jffs2_compress(struct jffs2_sb_info *c, struct jffs2_inode_info *f,
|
||||
spin_unlock(&jffs2_compressor_list_lock);
|
||||
*datalen = orig_slen;
|
||||
*cdatalen = orig_dlen;
|
||||
compr_ret = this->compress(data_in, this->compr_buf, datalen, cdatalen, NULL);
|
||||
compr_ret = this->compress(data_in, this->compr_buf, datalen, cdatalen);
|
||||
spin_lock(&jffs2_compressor_list_lock);
|
||||
this->usecount--;
|
||||
if (!compr_ret) {
|
||||
@@ -220,7 +220,7 @@ int jffs2_decompress(struct jffs2_sb_info *c, struct jffs2_inode_info *f,
|
||||
if (comprtype == this->compr) {
|
||||
this->usecount++;
|
||||
spin_unlock(&jffs2_compressor_list_lock);
|
||||
ret = this->decompress(cdata_in, data_out, cdatalen, datalen, NULL);
|
||||
ret = this->decompress(cdata_in, data_out, cdatalen, datalen);
|
||||
spin_lock(&jffs2_compressor_list_lock);
|
||||
if (ret) {
|
||||
printk(KERN_WARNING "Decompressor \"%s\" returned %d\n", this->name, ret);
|
||||
|
@@ -49,9 +49,9 @@ struct jffs2_compressor {
|
||||
char *name;
|
||||
char compr; /* JFFS2_COMPR_XXX */
|
||||
int (*compress)(unsigned char *data_in, unsigned char *cpage_out,
|
||||
uint32_t *srclen, uint32_t *destlen, void *model);
|
||||
uint32_t *srclen, uint32_t *destlen);
|
||||
int (*decompress)(unsigned char *cdata_in, unsigned char *data_out,
|
||||
uint32_t cdatalen, uint32_t datalen, void *model);
|
||||
uint32_t cdatalen, uint32_t datalen);
|
||||
int usecount;
|
||||
int disabled; /* if set the compressor won't compress */
|
||||
unsigned char *compr_buf; /* used by size compr. mode */
|
||||
|
@@ -42,7 +42,7 @@ static int __init alloc_workspace(void)
|
||||
}
|
||||
|
||||
static int jffs2_lzo_compress(unsigned char *data_in, unsigned char *cpage_out,
|
||||
uint32_t *sourcelen, uint32_t *dstlen, void *model)
|
||||
uint32_t *sourcelen, uint32_t *dstlen)
|
||||
{
|
||||
size_t compress_size;
|
||||
int ret;
|
||||
@@ -67,7 +67,7 @@ static int jffs2_lzo_compress(unsigned char *data_in, unsigned char *cpage_out,
|
||||
}
|
||||
|
||||
static int jffs2_lzo_decompress(unsigned char *data_in, unsigned char *cpage_out,
|
||||
uint32_t srclen, uint32_t destlen, void *model)
|
||||
uint32_t srclen, uint32_t destlen)
|
||||
{
|
||||
size_t dl = destlen;
|
||||
int ret;
|
||||
|
@@ -31,8 +31,7 @@
|
||||
/* _compress returns the compressed size, -1 if bigger */
|
||||
static int jffs2_rtime_compress(unsigned char *data_in,
|
||||
unsigned char *cpage_out,
|
||||
uint32_t *sourcelen, uint32_t *dstlen,
|
||||
void *model)
|
||||
uint32_t *sourcelen, uint32_t *dstlen)
|
||||
{
|
||||
short positions[256];
|
||||
int outpos = 0;
|
||||
@@ -73,8 +72,7 @@ static int jffs2_rtime_compress(unsigned char *data_in,
|
||||
|
||||
static int jffs2_rtime_decompress(unsigned char *data_in,
|
||||
unsigned char *cpage_out,
|
||||
uint32_t srclen, uint32_t destlen,
|
||||
void *model)
|
||||
uint32_t srclen, uint32_t destlen)
|
||||
{
|
||||
short positions[256];
|
||||
int outpos = 0;
|
||||
|
@@ -298,7 +298,7 @@ static int rubin_do_compress(int bit_divider, int *bits, unsigned char *data_in,
|
||||
#if 0
|
||||
/* _compress returns the compressed size, -1 if bigger */
|
||||
int jffs2_rubinmips_compress(unsigned char *data_in, unsigned char *cpage_out,
|
||||
uint32_t *sourcelen, uint32_t *dstlen, void *model)
|
||||
uint32_t *sourcelen, uint32_t *dstlen)
|
||||
{
|
||||
return rubin_do_compress(BIT_DIVIDER_MIPS, bits_mips, data_in,
|
||||
cpage_out, sourcelen, dstlen);
|
||||
@@ -306,8 +306,7 @@ int jffs2_rubinmips_compress(unsigned char *data_in, unsigned char *cpage_out,
|
||||
#endif
|
||||
static int jffs2_dynrubin_compress(unsigned char *data_in,
|
||||
unsigned char *cpage_out,
|
||||
uint32_t *sourcelen, uint32_t *dstlen,
|
||||
void *model)
|
||||
uint32_t *sourcelen, uint32_t *dstlen)
|
||||
{
|
||||
int bits[8];
|
||||
unsigned char histo[256];
|
||||
@@ -387,8 +386,7 @@ static void rubin_do_decompress(int bit_divider, int *bits,
|
||||
|
||||
static int jffs2_rubinmips_decompress(unsigned char *data_in,
|
||||
unsigned char *cpage_out,
|
||||
uint32_t sourcelen, uint32_t dstlen,
|
||||
void *model)
|
||||
uint32_t sourcelen, uint32_t dstlen)
|
||||
{
|
||||
rubin_do_decompress(BIT_DIVIDER_MIPS, bits_mips, data_in,
|
||||
cpage_out, sourcelen, dstlen);
|
||||
@@ -397,8 +395,7 @@ static int jffs2_rubinmips_decompress(unsigned char *data_in,
|
||||
|
||||
static int jffs2_dynrubin_decompress(unsigned char *data_in,
|
||||
unsigned char *cpage_out,
|
||||
uint32_t sourcelen, uint32_t dstlen,
|
||||
void *model)
|
||||
uint32_t sourcelen, uint32_t dstlen)
|
||||
{
|
||||
int bits[8];
|
||||
int c;
|
||||
|
@@ -68,8 +68,7 @@ static void free_workspaces(void)
|
||||
|
||||
static int jffs2_zlib_compress(unsigned char *data_in,
|
||||
unsigned char *cpage_out,
|
||||
uint32_t *sourcelen, uint32_t *dstlen,
|
||||
void *model)
|
||||
uint32_t *sourcelen, uint32_t *dstlen)
|
||||
{
|
||||
int ret;
|
||||
|
||||
@@ -136,8 +135,7 @@ static int jffs2_zlib_compress(unsigned char *data_in,
|
||||
|
||||
static int jffs2_zlib_decompress(unsigned char *data_in,
|
||||
unsigned char *cpage_out,
|
||||
uint32_t srclen, uint32_t destlen,
|
||||
void *model)
|
||||
uint32_t srclen, uint32_t destlen)
|
||||
{
|
||||
int ret;
|
||||
int wbits = MAX_WBITS;
|
||||
|
@@ -367,7 +367,7 @@ static int jffs2_symlink (struct inode *dir_i, struct dentry *dentry, const char
|
||||
}
|
||||
|
||||
/* We use f->target field to store the target path. */
|
||||
f->target = kmalloc(targetlen + 1, GFP_KERNEL);
|
||||
f->target = kmemdup(target, targetlen + 1, GFP_KERNEL);
|
||||
if (!f->target) {
|
||||
printk(KERN_WARNING "Can't allocate %d bytes of memory\n", targetlen + 1);
|
||||
mutex_unlock(&f->sem);
|
||||
@@ -376,7 +376,6 @@ static int jffs2_symlink (struct inode *dir_i, struct dentry *dentry, const char
|
||||
goto fail;
|
||||
}
|
||||
|
||||
memcpy(f->target, target, targetlen + 1);
|
||||
D1(printk(KERN_DEBUG "jffs2_symlink: symlink's target '%s' cached\n", (char *)f->target));
|
||||
|
||||
/* No data here. Only a metadata node, which will be
|
||||
|
@@ -151,7 +151,7 @@ int jffs2_erase_pending_blocks(struct jffs2_sb_info *c, int count)
|
||||
}
|
||||
|
||||
/* Be nice */
|
||||
yield();
|
||||
cond_resched();
|
||||
mutex_lock(&c->erase_free_sem);
|
||||
spin_lock(&c->erase_completion_lock);
|
||||
}
|
||||
|
@@ -474,6 +474,25 @@ struct inode *jffs2_new_inode (struct inode *dir_i, int mode, struct jffs2_raw_i
|
||||
return inode;
|
||||
}
|
||||
|
||||
static int calculate_inocache_hashsize(uint32_t flash_size)
|
||||
{
|
||||
/*
|
||||
* Pick a inocache hash size based on the size of the medium.
|
||||
* Count how many megabytes we're dealing with, apply a hashsize twice
|
||||
* that size, but rounding down to the usual big powers of 2. And keep
|
||||
* to sensible bounds.
|
||||
*/
|
||||
|
||||
int size_mb = flash_size / 1024 / 1024;
|
||||
int hashsize = (size_mb * 2) & ~0x3f;
|
||||
|
||||
if (hashsize < INOCACHE_HASHSIZE_MIN)
|
||||
return INOCACHE_HASHSIZE_MIN;
|
||||
if (hashsize > INOCACHE_HASHSIZE_MAX)
|
||||
return INOCACHE_HASHSIZE_MAX;
|
||||
|
||||
return hashsize;
|
||||
}
|
||||
|
||||
int jffs2_do_fill_super(struct super_block *sb, void *data, int silent)
|
||||
{
|
||||
@@ -520,7 +539,8 @@ int jffs2_do_fill_super(struct super_block *sb, void *data, int silent)
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
c->inocache_list = kcalloc(INOCACHE_HASHSIZE, sizeof(struct jffs2_inode_cache *), GFP_KERNEL);
|
||||
c->inocache_hashsize = calculate_inocache_hashsize(c->flash_size);
|
||||
c->inocache_list = kcalloc(c->inocache_hashsize, sizeof(struct jffs2_inode_cache *), GFP_KERNEL);
|
||||
if (!c->inocache_list) {
|
||||
ret = -ENOMEM;
|
||||
goto out_wbuf;
|
||||
|
@@ -219,13 +219,14 @@ int jffs2_garbage_collect_pass(struct jffs2_sb_info *c)
|
||||
if (!list_empty(&c->erase_complete_list) ||
|
||||
!list_empty(&c->erase_pending_list)) {
|
||||
spin_unlock(&c->erase_completion_lock);
|
||||
mutex_unlock(&c->alloc_sem);
|
||||
D1(printk(KERN_DEBUG "jffs2_garbage_collect_pass() erasing pending blocks\n"));
|
||||
if (jffs2_erase_pending_blocks(c, 1)) {
|
||||
mutex_unlock(&c->alloc_sem);
|
||||
if (jffs2_erase_pending_blocks(c, 1))
|
||||
return 0;
|
||||
}
|
||||
|
||||
D1(printk(KERN_DEBUG "No progress from erasing blocks; doing GC anyway\n"));
|
||||
spin_lock(&c->erase_completion_lock);
|
||||
mutex_lock(&c->alloc_sem);
|
||||
}
|
||||
|
||||
/* First, work out which block we're garbage-collecting */
|
||||
|
@@ -100,6 +100,7 @@ struct jffs2_sb_info {
|
||||
wait_queue_head_t erase_wait; /* For waiting for erases to complete */
|
||||
|
||||
wait_queue_head_t inocache_wq;
|
||||
int inocache_hashsize;
|
||||
struct jffs2_inode_cache **inocache_list;
|
||||
spinlock_t inocache_lock;
|
||||
|
||||
|
@@ -420,7 +420,7 @@ struct jffs2_inode_cache *jffs2_get_ino_cache(struct jffs2_sb_info *c, uint32_t
|
||||
{
|
||||
struct jffs2_inode_cache *ret;
|
||||
|
||||
ret = c->inocache_list[ino % INOCACHE_HASHSIZE];
|
||||
ret = c->inocache_list[ino % c->inocache_hashsize];
|
||||
while (ret && ret->ino < ino) {
|
||||
ret = ret->next;
|
||||
}
|
||||
@@ -441,7 +441,7 @@ void jffs2_add_ino_cache (struct jffs2_sb_info *c, struct jffs2_inode_cache *new
|
||||
|
||||
dbg_inocache("add %p (ino #%u)\n", new, new->ino);
|
||||
|
||||
prev = &c->inocache_list[new->ino % INOCACHE_HASHSIZE];
|
||||
prev = &c->inocache_list[new->ino % c->inocache_hashsize];
|
||||
|
||||
while ((*prev) && (*prev)->ino < new->ino) {
|
||||
prev = &(*prev)->next;
|
||||
@@ -462,7 +462,7 @@ void jffs2_del_ino_cache(struct jffs2_sb_info *c, struct jffs2_inode_cache *old)
|
||||
dbg_inocache("del %p (ino #%u)\n", old, old->ino);
|
||||
spin_lock(&c->inocache_lock);
|
||||
|
||||
prev = &c->inocache_list[old->ino % INOCACHE_HASHSIZE];
|
||||
prev = &c->inocache_list[old->ino % c->inocache_hashsize];
|
||||
|
||||
while ((*prev) && (*prev)->ino < old->ino) {
|
||||
prev = &(*prev)->next;
|
||||
@@ -487,7 +487,7 @@ void jffs2_free_ino_caches(struct jffs2_sb_info *c)
|
||||
int i;
|
||||
struct jffs2_inode_cache *this, *next;
|
||||
|
||||
for (i=0; i<INOCACHE_HASHSIZE; i++) {
|
||||
for (i=0; i < c->inocache_hashsize; i++) {
|
||||
this = c->inocache_list[i];
|
||||
while (this) {
|
||||
next = this->next;
|
||||
|
@@ -199,7 +199,8 @@ struct jffs2_inode_cache {
|
||||
#define RAWNODE_CLASS_XATTR_DATUM 1
|
||||
#define RAWNODE_CLASS_XATTR_REF 2
|
||||
|
||||
#define INOCACHE_HASHSIZE 128
|
||||
#define INOCACHE_HASHSIZE_MIN 128
|
||||
#define INOCACHE_HASHSIZE_MAX 1024
|
||||
|
||||
#define write_ofs(c) ((c)->nextblock->offset + (c)->sector_size - (c)->nextblock->free_size)
|
||||
|
||||
|
@@ -20,7 +20,7 @@
|
||||
#include "summary.h"
|
||||
#include "debug.h"
|
||||
|
||||
#define DEFAULT_EMPTY_SCAN_SIZE 1024
|
||||
#define DEFAULT_EMPTY_SCAN_SIZE 256
|
||||
|
||||
#define noisy_printk(noise, args...) do { \
|
||||
if (*(noise)) { \
|
||||
@@ -435,7 +435,7 @@ static int jffs2_scan_eraseblock (struct jffs2_sb_info *c, struct jffs2_eraseblo
|
||||
unsigned char *buf, uint32_t buf_size, struct jffs2_summary *s) {
|
||||
struct jffs2_unknown_node *node;
|
||||
struct jffs2_unknown_node crcnode;
|
||||
uint32_t ofs, prevofs;
|
||||
uint32_t ofs, prevofs, max_ofs;
|
||||
uint32_t hdr_crc, buf_ofs, buf_len;
|
||||
int err;
|
||||
int noise = 0;
|
||||
@@ -550,12 +550,12 @@ static int jffs2_scan_eraseblock (struct jffs2_sb_info *c, struct jffs2_eraseblo
|
||||
|
||||
/* We temporarily use 'ofs' as a pointer into the buffer/jeb */
|
||||
ofs = 0;
|
||||
|
||||
/* Scan only 4KiB of 0xFF before declaring it's empty */
|
||||
while(ofs < EMPTY_SCAN_SIZE(c->sector_size) && *(uint32_t *)(&buf[ofs]) == 0xFFFFFFFF)
|
||||
max_ofs = EMPTY_SCAN_SIZE(c->sector_size);
|
||||
/* Scan only EMPTY_SCAN_SIZE of 0xFF before declaring it's empty */
|
||||
while(ofs < max_ofs && *(uint32_t *)(&buf[ofs]) == 0xFFFFFFFF)
|
||||
ofs += 4;
|
||||
|
||||
if (ofs == EMPTY_SCAN_SIZE(c->sector_size)) {
|
||||
if (ofs == max_ofs) {
|
||||
#ifdef CONFIG_JFFS2_FS_WRITEBUFFER
|
||||
if (jffs2_cleanmarker_oob(c)) {
|
||||
/* scan oob, take care of cleanmarker */
|
||||
|
Verwijs in nieuw issue
Block a user