mirror of
https://github.com/linux-msm/laptops-kernel.git
synced 2026-08-13 14:19:53 -07:00
[JFFS2] Clean up trailing white spaces
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
This commit is contained in:
committed by
Thomas Gleixner
parent
97894cda57
commit
182ec4eee3
+5
-5
@@ -1084,10 +1084,10 @@ config JFFS2_ZLIB
|
||||
default y
|
||||
help
|
||||
Zlib is designed to be a free, general-purpose, legally unencumbered,
|
||||
lossless data-compression library for use on virtually any computer
|
||||
lossless data-compression library for use on virtually any computer
|
||||
hardware and operating system. See <http://www.gzip.org/zlib/> for
|
||||
further information.
|
||||
|
||||
|
||||
Say 'Y' if unsure.
|
||||
|
||||
config JFFS2_RTIME
|
||||
@@ -1109,7 +1109,7 @@ choice
|
||||
default JFFS2_CMODE_PRIORITY
|
||||
depends on JFFS2_FS
|
||||
help
|
||||
You can set here the default compression mode of JFFS2 from
|
||||
You can set here the default compression mode of JFFS2 from
|
||||
the available compression modes. Don't touch if unsure.
|
||||
|
||||
config JFFS2_CMODE_NONE
|
||||
@@ -1120,13 +1120,13 @@ config JFFS2_CMODE_NONE
|
||||
config JFFS2_CMODE_PRIORITY
|
||||
bool "priority"
|
||||
help
|
||||
Tries the compressors in a predefinied order and chooses the first
|
||||
Tries the compressors in a predefinied order and chooses the first
|
||||
successful one.
|
||||
|
||||
config JFFS2_CMODE_SIZE
|
||||
bool "size (EXPERIMENTAL)"
|
||||
help
|
||||
Tries all compressors and chooses the one which has the smallest
|
||||
Tries all compressors and chooses the one which has the smallest
|
||||
result.
|
||||
|
||||
endchoice
|
||||
|
||||
@@ -51,7 +51,7 @@ int jffs2_start_garbage_collect_thread(struct jffs2_sb_info *c)
|
||||
D1(printk(KERN_DEBUG "JFFS2: Garbage collect thread is pid %d\n", pid));
|
||||
wait_for_completion(&c->gc_thread_start);
|
||||
}
|
||||
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -101,7 +101,7 @@ static int jffs2_garbage_collect_thread(void *_c)
|
||||
|
||||
cond_resched();
|
||||
|
||||
/* Put_super will send a SIGKILL and then wait on the sem.
|
||||
/* Put_super will send a SIGKILL and then wait on the sem.
|
||||
*/
|
||||
while (signal_pending(current)) {
|
||||
siginfo_t info;
|
||||
|
||||
+14
-14
@@ -7,7 +7,7 @@
|
||||
*
|
||||
* For licensing information, see the file 'LICENCE' in this directory.
|
||||
*
|
||||
* $Id: build.c,v 1.84 2005/09/27 13:40:49 dedekind Exp $
|
||||
* $Id: build.c,v 1.85 2005/11/07 11:14:38 gleixner Exp $
|
||||
*
|
||||
*/
|
||||
|
||||
@@ -129,10 +129,10 @@ static int jffs2_build_filesystem(struct jffs2_sb_info *c)
|
||||
for_each_inode(i, c, ic) {
|
||||
if (ic->nlink)
|
||||
continue;
|
||||
|
||||
|
||||
jffs2_build_remove_unlinked_inode(c, ic, &dead_fds);
|
||||
cond_resched();
|
||||
}
|
||||
}
|
||||
|
||||
dbg_fsbuild("pass 2a starting\n");
|
||||
|
||||
@@ -149,7 +149,7 @@ static int jffs2_build_filesystem(struct jffs2_sb_info *c)
|
||||
|
||||
dbg_fsbuild("pass 2a complete\n");
|
||||
dbg_fsbuild("freeing temporary data structures\n");
|
||||
|
||||
|
||||
/* Finally, we can scan again and free the dirent structs */
|
||||
for_each_inode(i, c, ic) {
|
||||
while(ic->scan_dents) {
|
||||
@@ -161,7 +161,7 @@ static int jffs2_build_filesystem(struct jffs2_sb_info *c)
|
||||
cond_resched();
|
||||
}
|
||||
c->flags &= ~JFFS2_SB_FLAG_BUILDING;
|
||||
|
||||
|
||||
dbg_fsbuild("FS build complete\n");
|
||||
|
||||
/* Rotate the lists by some number to ensure wear levelling */
|
||||
@@ -191,7 +191,7 @@ static void jffs2_build_remove_unlinked_inode(struct jffs2_sb_info *c,
|
||||
struct jffs2_full_dirent *fd;
|
||||
|
||||
dbg_fsbuild("removing ino #%u with nlink == zero.\n", ic->ino);
|
||||
|
||||
|
||||
raw = ic->nodes;
|
||||
while (raw != (void *)ic) {
|
||||
struct jffs2_raw_node_ref *next = raw->next_in_ino;
|
||||
@@ -220,7 +220,7 @@ static void jffs2_build_remove_unlinked_inode(struct jffs2_sb_info *c,
|
||||
whinged = 1;
|
||||
|
||||
dbg_fsbuild("removing child \"%s\", ino #%u\n", fd->name, fd->ino);
|
||||
|
||||
|
||||
child_ic = jffs2_get_ino_cache(c, fd->ino);
|
||||
if (!child_ic) {
|
||||
dbg_fsbuild("cannot remove child \"%s\", ino #%u, because it doesn't exist\n",
|
||||
@@ -229,11 +229,11 @@ static void jffs2_build_remove_unlinked_inode(struct jffs2_sb_info *c,
|
||||
continue;
|
||||
}
|
||||
|
||||
/* Reduce nlink of the child. If it's now zero, stick it on the
|
||||
/* Reduce nlink of the child. If it's now zero, stick it on the
|
||||
dead_fds list to be cleaned up later. Else just free the fd */
|
||||
|
||||
child_ic->nlink--;
|
||||
|
||||
|
||||
if (!child_ic->nlink) {
|
||||
dbg_fsbuild("inode #%u (\"%s\") has now got zero nlink, adding to dead_fds list.\n",
|
||||
fd->ino, fd->name);
|
||||
@@ -248,7 +248,7 @@ static void jffs2_build_remove_unlinked_inode(struct jffs2_sb_info *c,
|
||||
}
|
||||
|
||||
/*
|
||||
We don't delete the inocache from the hash list and free it yet.
|
||||
We don't delete the inocache from the hash list and free it yet.
|
||||
The erase code will do that, when all the nodes are completely gone.
|
||||
*/
|
||||
}
|
||||
@@ -262,7 +262,7 @@ static void jffs2_calc_trigger_levels(struct jffs2_sb_info *c)
|
||||
because there's not enough free space... */
|
||||
c->resv_blocks_deletion = 2;
|
||||
|
||||
/* Be conservative about how much space we need before we allow writes.
|
||||
/* Be conservative about how much space we need before we allow writes.
|
||||
On top of that which is required for deletia, require an extra 2%
|
||||
of the medium to be available, for overhead caused by nodes being
|
||||
split across blocks, etc. */
|
||||
@@ -277,7 +277,7 @@ static void jffs2_calc_trigger_levels(struct jffs2_sb_info *c)
|
||||
|
||||
c->resv_blocks_gctrigger = c->resv_blocks_write + 1;
|
||||
|
||||
/* When do we allow garbage collection to merge nodes to make
|
||||
/* When do we allow garbage collection to merge nodes to make
|
||||
long-term progress at the expense of short-term space exhaustion? */
|
||||
c->resv_blocks_gcmerge = c->resv_blocks_deletion + 1;
|
||||
|
||||
@@ -303,7 +303,7 @@ static void jffs2_calc_trigger_levels(struct jffs2_sb_info *c)
|
||||
c->resv_blocks_gcbad, c->resv_blocks_gcbad*c->sector_size/1024);
|
||||
dbg_fsbuild("Amount of dirty space required to GC: %d bytes\n",
|
||||
c->nospc_dirty_size);
|
||||
}
|
||||
}
|
||||
|
||||
int jffs2_do_mount_fs(struct jffs2_sb_info *c)
|
||||
{
|
||||
@@ -355,7 +355,7 @@ int jffs2_do_mount_fs(struct jffs2_sb_info *c)
|
||||
#ifndef __ECOS
|
||||
if (jffs2_blocks_use_vmalloc(c))
|
||||
vfree(c->blocks);
|
||||
else
|
||||
else
|
||||
#endif
|
||||
kfree(c->blocks);
|
||||
|
||||
|
||||
+14
-14
@@ -9,7 +9,7 @@
|
||||
*
|
||||
* For licensing information, see the file 'LICENCE' in this directory.
|
||||
*
|
||||
* $Id: compr.c,v 1.45 2005/07/26 13:24:40 havasi Exp $
|
||||
* $Id: compr.c,v 1.46 2005/11/07 11:14:38 gleixner Exp $
|
||||
*
|
||||
*/
|
||||
|
||||
@@ -36,16 +36,16 @@ static uint32_t none_stat_compr_blocks=0,none_stat_decompr_blocks=0,none_stat_co
|
||||
* data.
|
||||
*
|
||||
* Returns: Lower byte to be stored with data indicating compression type used.
|
||||
* Zero is used to show that the data could not be compressed - the
|
||||
* Zero is used to show that the data could not be compressed - the
|
||||
* compressed version was actually larger than the original.
|
||||
* Upper byte will be used later. (soon)
|
||||
*
|
||||
* If the cdata buffer isn't large enough to hold all the uncompressed data,
|
||||
* jffs2_compress should compress as much as will fit, and should set
|
||||
* jffs2_compress should compress as much as will fit, and should set
|
||||
* *datalen accordingly to show the amount of data which were compressed.
|
||||
*/
|
||||
uint16_t jffs2_compress(struct jffs2_sb_info *c, struct jffs2_inode_info *f,
|
||||
unsigned char *data_in, unsigned char **cpage_out,
|
||||
unsigned char *data_in, unsigned char **cpage_out,
|
||||
uint32_t *datalen, uint32_t *cdatalen)
|
||||
{
|
||||
int ret = JFFS2_COMPR_NONE;
|
||||
@@ -164,7 +164,7 @@ uint16_t jffs2_compress(struct jffs2_sb_info *c, struct jffs2_inode_info *f,
|
||||
}
|
||||
|
||||
int jffs2_decompress(struct jffs2_sb_info *c, struct jffs2_inode_info *f,
|
||||
uint16_t comprtype, unsigned char *cdata_in,
|
||||
uint16_t comprtype, unsigned char *cdata_in,
|
||||
unsigned char *data_out, uint32_t cdatalen, uint32_t datalen)
|
||||
{
|
||||
struct jffs2_compressor *this;
|
||||
@@ -298,7 +298,7 @@ char *jffs2_stats(void)
|
||||
|
||||
act_buf += sprintf(act_buf,"JFFS2 compressor statistics:\n");
|
||||
act_buf += sprintf(act_buf,"%10s ","none");
|
||||
act_buf += sprintf(act_buf,"compr: %d blocks (%d) decompr: %d blocks\n", none_stat_compr_blocks,
|
||||
act_buf += sprintf(act_buf,"compr: %d blocks (%d) decompr: %d blocks\n", none_stat_compr_blocks,
|
||||
none_stat_compr_size, none_stat_decompr_blocks);
|
||||
spin_lock(&jffs2_compressor_list_lock);
|
||||
list_for_each_entry(this, &jffs2_compressor_list, list) {
|
||||
@@ -307,8 +307,8 @@ char *jffs2_stats(void)
|
||||
act_buf += sprintf(act_buf,"- ");
|
||||
else
|
||||
act_buf += sprintf(act_buf,"+ ");
|
||||
act_buf += sprintf(act_buf,"compr: %d blocks (%d/%d) decompr: %d blocks ", this->stat_compr_blocks,
|
||||
this->stat_compr_new_size, this->stat_compr_orig_size,
|
||||
act_buf += sprintf(act_buf,"compr: %d blocks (%d/%d) decompr: %d blocks ", this->stat_compr_blocks,
|
||||
this->stat_compr_new_size, this->stat_compr_orig_size,
|
||||
this->stat_decompr_blocks);
|
||||
act_buf += sprintf(act_buf,"\n");
|
||||
}
|
||||
@@ -317,7 +317,7 @@ char *jffs2_stats(void)
|
||||
return buf;
|
||||
}
|
||||
|
||||
char *jffs2_get_compression_mode_name(void)
|
||||
char *jffs2_get_compression_mode_name(void)
|
||||
{
|
||||
switch (jffs2_compression_mode) {
|
||||
case JFFS2_COMPR_MODE_NONE:
|
||||
@@ -330,7 +330,7 @@ char *jffs2_get_compression_mode_name(void)
|
||||
return "unkown";
|
||||
}
|
||||
|
||||
int jffs2_set_compression_mode_name(const char *name)
|
||||
int jffs2_set_compression_mode_name(const char *name)
|
||||
{
|
||||
if (!strcmp("none",name)) {
|
||||
jffs2_compression_mode = JFFS2_COMPR_MODE_NONE;
|
||||
@@ -355,7 +355,7 @@ static int jffs2_compressor_Xable(const char *name, int disabled)
|
||||
if (!strcmp(this->name, name)) {
|
||||
this->disabled = disabled;
|
||||
spin_unlock(&jffs2_compressor_list_lock);
|
||||
return 0;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
spin_unlock(&jffs2_compressor_list_lock);
|
||||
@@ -385,7 +385,7 @@ int jffs2_set_compressor_priority(const char *name, int priority)
|
||||
}
|
||||
}
|
||||
spin_unlock(&jffs2_compressor_list_lock);
|
||||
printk(KERN_WARNING "JFFS2: compressor %s not found.\n",name);
|
||||
printk(KERN_WARNING "JFFS2: compressor %s not found.\n",name);
|
||||
return 1;
|
||||
reinsert:
|
||||
/* list is sorted in the order of priority, so if
|
||||
@@ -412,7 +412,7 @@ void jffs2_free_comprbuf(unsigned char *comprbuf, unsigned char *orig)
|
||||
kfree(comprbuf);
|
||||
}
|
||||
|
||||
int jffs2_compressors_init(void)
|
||||
int jffs2_compressors_init(void)
|
||||
{
|
||||
/* Registering compressors */
|
||||
#ifdef CONFIG_JFFS2_ZLIB
|
||||
@@ -440,7 +440,7 @@ int jffs2_compressors_init(void)
|
||||
return 0;
|
||||
}
|
||||
|
||||
int jffs2_compressors_exit(void)
|
||||
int jffs2_compressors_exit(void)
|
||||
{
|
||||
/* Unregistering compressors */
|
||||
#ifdef CONFIG_JFFS2_RUBIN
|
||||
|
||||
+2
-2
@@ -4,10 +4,10 @@
|
||||
* Copyright (C) 2004 Ferenc Havasi <havasi@inf.u-szeged.hu>,
|
||||
* University of Szeged, Hungary
|
||||
*
|
||||
* For licensing information, see the file 'LICENCE' in the
|
||||
* For licensing information, see the file 'LICENCE' in the
|
||||
* jffs2 directory.
|
||||
*
|
||||
* $Id: compr.h,v 1.8 2005/07/26 13:24:40 havasi Exp $
|
||||
* $Id: compr.h,v 1.9 2005/11/07 11:14:38 gleixner Exp $
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
+16
-16
@@ -24,8 +24,8 @@
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/types.h>
|
||||
#include <linux/errno.h>
|
||||
#include <linux/string.h>
|
||||
#include <linux/jffs2.h>
|
||||
#include <linux/string.h>
|
||||
#include <linux/jffs2.h>
|
||||
#include "compr.h"
|
||||
|
||||
/* _compress returns the compressed size, -1 if bigger */
|
||||
@@ -38,19 +38,19 @@ static int jffs2_rtime_compress(unsigned char *data_in,
|
||||
int outpos = 0;
|
||||
int pos=0;
|
||||
|
||||
memset(positions,0,sizeof(positions));
|
||||
|
||||
memset(positions,0,sizeof(positions));
|
||||
|
||||
while (pos < (*sourcelen) && outpos <= (*dstlen)-2) {
|
||||
int backpos, runlen=0;
|
||||
unsigned char value;
|
||||
|
||||
|
||||
value = data_in[pos];
|
||||
|
||||
cpage_out[outpos++] = data_in[pos++];
|
||||
|
||||
|
||||
backpos = positions[value];
|
||||
positions[value]=pos;
|
||||
|
||||
|
||||
while ((backpos < pos) && (pos < (*sourcelen)) &&
|
||||
(data_in[pos]==data_in[backpos++]) && (runlen<255)) {
|
||||
pos++;
|
||||
@@ -63,12 +63,12 @@ static int jffs2_rtime_compress(unsigned char *data_in,
|
||||
/* We failed */
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
/* Tell the caller how much we managed to compress, and how much space it took */
|
||||
*sourcelen = pos;
|
||||
*dstlen = outpos;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static int jffs2_rtime_decompress(unsigned char *data_in,
|
||||
@@ -79,19 +79,19 @@ static int jffs2_rtime_decompress(unsigned char *data_in,
|
||||
short positions[256];
|
||||
int outpos = 0;
|
||||
int pos=0;
|
||||
|
||||
memset(positions,0,sizeof(positions));
|
||||
|
||||
|
||||
memset(positions,0,sizeof(positions));
|
||||
|
||||
while (outpos<destlen) {
|
||||
unsigned char value;
|
||||
int backoffs;
|
||||
int repeat;
|
||||
|
||||
|
||||
value = data_in[pos++];
|
||||
cpage_out[outpos++] = value; /* first the verbatim copied byte */
|
||||
repeat = data_in[pos++];
|
||||
backoffs = positions[value];
|
||||
|
||||
|
||||
positions[value]=outpos;
|
||||
if (repeat) {
|
||||
if (backoffs + repeat >= outpos) {
|
||||
@@ -101,12 +101,12 @@ static int jffs2_rtime_decompress(unsigned char *data_in,
|
||||
}
|
||||
} else {
|
||||
memcpy(&cpage_out[outpos],&cpage_out[backoffs],repeat);
|
||||
outpos+=repeat;
|
||||
outpos+=repeat;
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
static struct jffs2_compressor jffs2_rtime_comp = {
|
||||
.priority = JFFS2_RTIME_PRIORITY,
|
||||
|
||||
+18
-19
@@ -11,7 +11,6 @@
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#include <linux/string.h>
|
||||
#include <linux/types.h>
|
||||
#include <linux/jffs2.h>
|
||||
@@ -20,7 +19,7 @@
|
||||
#include "compr.h"
|
||||
|
||||
static void init_rubin(struct rubin_state *rs, int div, int *bits)
|
||||
{
|
||||
{
|
||||
int c;
|
||||
|
||||
rs->q = 0;
|
||||
@@ -40,7 +39,7 @@ static int encode(struct rubin_state *rs, long A, long B, int symbol)
|
||||
|
||||
while ((rs->q >= UPPER_BIT_RUBIN) || ((rs->p + rs->q) <= UPPER_BIT_RUBIN)) {
|
||||
rs->bit_number++;
|
||||
|
||||
|
||||
ret = pushbit(&rs->pp, (rs->q & UPPER_BIT_RUBIN) ? 1 : 0, 0);
|
||||
if (ret)
|
||||
return ret;
|
||||
@@ -68,7 +67,7 @@ static int encode(struct rubin_state *rs, long A, long B, int symbol)
|
||||
|
||||
|
||||
static void end_rubin(struct rubin_state *rs)
|
||||
{
|
||||
{
|
||||
|
||||
int i;
|
||||
|
||||
@@ -82,7 +81,7 @@ static void end_rubin(struct rubin_state *rs)
|
||||
|
||||
static void init_decode(struct rubin_state *rs, int div, int *bits)
|
||||
{
|
||||
init_rubin(rs, div, bits);
|
||||
init_rubin(rs, div, bits);
|
||||
|
||||
/* behalve lower */
|
||||
rs->rec_q = 0;
|
||||
@@ -188,7 +187,7 @@ static int in_byte(struct rubin_state *rs)
|
||||
|
||||
|
||||
|
||||
static int rubin_do_compress(int bit_divider, int *bits, unsigned char *data_in,
|
||||
static int rubin_do_compress(int bit_divider, int *bits, unsigned char *data_in,
|
||||
unsigned char *cpage_out, uint32_t *sourcelen, uint32_t *dstlen)
|
||||
{
|
||||
int outpos = 0;
|
||||
@@ -198,31 +197,31 @@ static int rubin_do_compress(int bit_divider, int *bits, unsigned char *data_in,
|
||||
init_pushpull(&rs.pp, cpage_out, *dstlen * 8, 0, 32);
|
||||
|
||||
init_rubin(&rs, bit_divider, bits);
|
||||
|
||||
|
||||
while (pos < (*sourcelen) && !out_byte(&rs, data_in[pos]))
|
||||
pos++;
|
||||
|
||||
|
||||
end_rubin(&rs);
|
||||
|
||||
if (outpos > pos) {
|
||||
/* We failed */
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* Tell the caller how much we managed to compress,
|
||||
|
||||
/* Tell the caller how much we managed to compress,
|
||||
* and how much space it took */
|
||||
|
||||
|
||||
outpos = (pushedbits(&rs.pp)+7)/8;
|
||||
|
||||
|
||||
if (outpos >= pos)
|
||||
return -1; /* We didn't actually compress */
|
||||
*sourcelen = pos;
|
||||
*dstlen = outpos;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
#if 0
|
||||
/* _compress returns the compressed size, -1 if bigger */
|
||||
int jffs2_rubinmips_compress(unsigned char *data_in, unsigned char *cpage_out,
|
||||
int jffs2_rubinmips_compress(unsigned char *data_in, unsigned char *cpage_out,
|
||||
uint32_t *sourcelen, uint32_t *dstlen, void *model)
|
||||
{
|
||||
return rubin_do_compress(BIT_DIVIDER_MIPS, bits_mips, data_in, cpage_out, sourcelen, dstlen);
|
||||
@@ -277,7 +276,7 @@ static int jffs2_dynrubin_compress(unsigned char *data_in,
|
||||
}
|
||||
|
||||
ret = rubin_do_compress(256, bits, data_in, cpage_out+8, &mysrclen, &mydstlen);
|
||||
if (ret)
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
/* Add back the 8 bytes we took for the probabilities */
|
||||
@@ -293,19 +292,19 @@ static int jffs2_dynrubin_compress(unsigned char *data_in,
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void rubin_do_decompress(int bit_divider, int *bits, unsigned char *cdata_in,
|
||||
static void rubin_do_decompress(int bit_divider, int *bits, unsigned char *cdata_in,
|
||||
unsigned char *page_out, uint32_t srclen, uint32_t destlen)
|
||||
{
|
||||
int outpos = 0;
|
||||
struct rubin_state rs;
|
||||
|
||||
|
||||
init_pushpull(&rs.pp, cdata_in, srclen, 0, 0);
|
||||
init_decode(&rs, bit_divider, bits);
|
||||
|
||||
|
||||
while (outpos < destlen) {
|
||||
page_out[outpos++] = in_byte(&rs);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static int jffs2_rubinmips_decompress(unsigned char *data_in,
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/* Rubin encoder/decoder header */
|
||||
/* work started at : aug 3, 1994 */
|
||||
/* last modification : aug 15, 1994 */
|
||||
/* $Id: compr_rubin.h,v 1.6 2002/01/25 01:49:26 dwmw2 Exp $ */
|
||||
/* $Id: compr_rubin.h,v 1.7 2005/11/07 11:14:38 gleixner Exp $ */
|
||||
|
||||
#include "pushpull.h"
|
||||
|
||||
@@ -11,8 +11,8 @@
|
||||
|
||||
|
||||
struct rubin_state {
|
||||
unsigned long p;
|
||||
unsigned long q;
|
||||
unsigned long p;
|
||||
unsigned long q;
|
||||
unsigned long rec_q;
|
||||
long bit_number;
|
||||
struct pushpull pp;
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
*
|
||||
* For licensing information, see the file 'LICENCE' in this directory.
|
||||
*
|
||||
* $Id: compr_zlib.c,v 1.31 2005/05/20 19:30:06 gleixner Exp $
|
||||
* $Id: compr_zlib.c,v 1.32 2005/11/07 11:14:38 gleixner Exp $
|
||||
*
|
||||
*/
|
||||
|
||||
@@ -24,11 +24,11 @@
|
||||
#include "nodelist.h"
|
||||
#include "compr.h"
|
||||
|
||||
/* Plan: call deflate() with avail_in == *sourcelen,
|
||||
avail_out = *dstlen - 12 and flush == Z_FINISH.
|
||||
/* Plan: call deflate() with avail_in == *sourcelen,
|
||||
avail_out = *dstlen - 12 and flush == Z_FINISH.
|
||||
If it doesn't manage to finish, call it again with
|
||||
avail_in == 0 and avail_out set to the remaining 12
|
||||
bytes for it to clean up.
|
||||
bytes for it to clean up.
|
||||
Q: Is 12 bytes sufficient?
|
||||
*/
|
||||
#define STREAM_END_SPACE 12
|
||||
@@ -89,7 +89,7 @@ static int jffs2_zlib_compress(unsigned char *data_in,
|
||||
|
||||
def_strm.next_in = data_in;
|
||||
def_strm.total_in = 0;
|
||||
|
||||
|
||||
def_strm.next_out = cpage_out;
|
||||
def_strm.total_out = 0;
|
||||
|
||||
@@ -99,7 +99,7 @@ static int jffs2_zlib_compress(unsigned char *data_in,
|
||||
D1(printk(KERN_DEBUG "calling deflate with avail_in %d, avail_out %d\n",
|
||||
def_strm.avail_in, def_strm.avail_out));
|
||||
ret = zlib_deflate(&def_strm, Z_PARTIAL_FLUSH);
|
||||
D1(printk(KERN_DEBUG "deflate returned with avail_in %d, avail_out %d, total_in %ld, total_out %ld\n",
|
||||
D1(printk(KERN_DEBUG "deflate returned with avail_in %d, avail_out %d, total_in %ld, total_out %ld\n",
|
||||
def_strm.avail_in, def_strm.avail_out, def_strm.total_in, def_strm.total_out));
|
||||
if (ret != Z_OK) {
|
||||
D1(printk(KERN_DEBUG "deflate in loop returned %d\n", ret));
|
||||
@@ -150,7 +150,7 @@ static int jffs2_zlib_decompress(unsigned char *data_in,
|
||||
inf_strm.next_in = data_in;
|
||||
inf_strm.avail_in = srclen;
|
||||
inf_strm.total_in = 0;
|
||||
|
||||
|
||||
inf_strm.next_out = cpage_out;
|
||||
inf_strm.avail_out = destlen;
|
||||
inf_strm.total_out = 0;
|
||||
|
||||
+15
-15
@@ -1,4 +1,4 @@
|
||||
/* $Id: comprtest.c,v 1.5 2002/01/03 15:20:44 dwmw2 Exp $ */
|
||||
/* $Id: comprtest.c,v 1.6 2005/11/07 11:14:38 gleixner Exp $ */
|
||||
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/string.h>
|
||||
@@ -265,9 +265,9 @@ static unsigned char testdata[TESTDATA_LEN] = {
|
||||
static unsigned char comprbuf[TESTDATA_LEN];
|
||||
static unsigned char decomprbuf[TESTDATA_LEN];
|
||||
|
||||
int jffs2_decompress(unsigned char comprtype, unsigned char *cdata_in,
|
||||
int jffs2_decompress(unsigned char comprtype, unsigned char *cdata_in,
|
||||
unsigned char *data_out, uint32_t cdatalen, uint32_t datalen);
|
||||
unsigned char jffs2_compress(unsigned char *data_in, unsigned char *cpage_out,
|
||||
unsigned char jffs2_compress(unsigned char *data_in, unsigned char *cpage_out,
|
||||
uint32_t *datalen, uint32_t *cdatalen);
|
||||
|
||||
int init_module(void ) {
|
||||
@@ -276,10 +276,10 @@ int init_module(void ) {
|
||||
int ret;
|
||||
|
||||
printk("Original data: %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x\n",
|
||||
testdata[0],testdata[1],testdata[2],testdata[3],
|
||||
testdata[4],testdata[5],testdata[6],testdata[7],
|
||||
testdata[8],testdata[9],testdata[10],testdata[11],
|
||||
testdata[12],testdata[13],testdata[14],testdata[15]);
|
||||
testdata[0],testdata[1],testdata[2],testdata[3],
|
||||
testdata[4],testdata[5],testdata[6],testdata[7],
|
||||
testdata[8],testdata[9],testdata[10],testdata[11],
|
||||
testdata[12],testdata[13],testdata[14],testdata[15]);
|
||||
d = TESTDATA_LEN;
|
||||
c = TESTDATA_LEN;
|
||||
comprtype = jffs2_compress(testdata, comprbuf, &d, &c);
|
||||
@@ -287,18 +287,18 @@ int init_module(void ) {
|
||||
printk("jffs2_compress used compression type %d. Compressed size %d, uncompressed size %d\n",
|
||||
comprtype, c, d);
|
||||
printk("Compressed data: %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x\n",
|
||||
comprbuf[0],comprbuf[1],comprbuf[2],comprbuf[3],
|
||||
comprbuf[4],comprbuf[5],comprbuf[6],comprbuf[7],
|
||||
comprbuf[8],comprbuf[9],comprbuf[10],comprbuf[11],
|
||||
comprbuf[12],comprbuf[13],comprbuf[14],comprbuf[15]);
|
||||
comprbuf[0],comprbuf[1],comprbuf[2],comprbuf[3],
|
||||
comprbuf[4],comprbuf[5],comprbuf[6],comprbuf[7],
|
||||
comprbuf[8],comprbuf[9],comprbuf[10],comprbuf[11],
|
||||
comprbuf[12],comprbuf[13],comprbuf[14],comprbuf[15]);
|
||||
|
||||
ret = jffs2_decompress(comprtype, comprbuf, decomprbuf, c, d);
|
||||
printk("jffs2_decompress returned %d\n", ret);
|
||||
printk("Decompressed data: %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x\n",
|
||||
decomprbuf[0],decomprbuf[1],decomprbuf[2],decomprbuf[3],
|
||||
decomprbuf[4],decomprbuf[5],decomprbuf[6],decomprbuf[7],
|
||||
decomprbuf[8],decomprbuf[9],decomprbuf[10],decomprbuf[11],
|
||||
decomprbuf[12],decomprbuf[13],decomprbuf[14],decomprbuf[15]);
|
||||
decomprbuf[0],decomprbuf[1],decomprbuf[2],decomprbuf[3],
|
||||
decomprbuf[4],decomprbuf[5],decomprbuf[6],decomprbuf[7],
|
||||
decomprbuf[8],decomprbuf[9],decomprbuf[10],decomprbuf[11],
|
||||
decomprbuf[12],decomprbuf[13],decomprbuf[14],decomprbuf[15]);
|
||||
if (memcmp(decomprbuf, testdata, d))
|
||||
printk("Compression and decompression corrupted data\n");
|
||||
else
|
||||
|
||||
+15
-15
@@ -7,7 +7,7 @@
|
||||
*
|
||||
* For licensing information, see the file 'LICENCE' in this directory.
|
||||
*
|
||||
* $Id: debug.c,v 1.11 2005/09/21 13:28:35 dedekind Exp $
|
||||
* $Id: debug.c,v 1.12 2005/11/07 11:14:39 gleixner Exp $
|
||||
*
|
||||
*/
|
||||
#include <linux/kernel.h>
|
||||
@@ -67,7 +67,7 @@ __jffs2_dbg_fragtree_paranoia_check(struct jffs2_inode_info *f)
|
||||
__jffs2_dbg_fragtree_paranoia_check_nolock(f);
|
||||
up(&f->sem);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
__jffs2_dbg_fragtree_paranoia_check_nolock(struct jffs2_inode_info *f)
|
||||
{
|
||||
@@ -165,7 +165,7 @@ __jffs2_dbg_acct_paranoia_check(struct jffs2_sb_info *c,
|
||||
__jffs2_dbg_acct_paranoia_check_nolock(c, jeb);
|
||||
spin_unlock(&c->erase_completion_lock);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
__jffs2_dbg_acct_paranoia_check_nolock(struct jffs2_sb_info *c,
|
||||
struct jffs2_eraseblock *jeb)
|
||||
@@ -237,7 +237,7 @@ error:
|
||||
__jffs2_dbg_dump_jeb_nolock(jeb);
|
||||
__jffs2_dbg_dump_block_lists_nolock(c);
|
||||
BUG();
|
||||
|
||||
|
||||
}
|
||||
#endif /* JFFS2_DBG_PARANOIA_CHECKS */
|
||||
|
||||
@@ -321,7 +321,7 @@ void
|
||||
__jffs2_dbg_dump_block_lists_nolock(struct jffs2_sb_info *c)
|
||||
{
|
||||
printk(JFFS2_DBG_MSG_PREFIX " dump JFFS2 blocks lists:\n");
|
||||
|
||||
|
||||
printk(JFFS2_DBG "flash_size: %#08x\n", c->flash_size);
|
||||
printk(JFFS2_DBG "used_size: %#08x\n", c->used_size);
|
||||
printk(JFFS2_DBG "dirty_size: %#08x\n", c->dirty_size);
|
||||
@@ -577,15 +577,15 @@ __jffs2_dbg_dump_buffer(unsigned char *buf, int len, uint32_t offs)
|
||||
{
|
||||
int skip;
|
||||
int i;
|
||||
|
||||
|
||||
printk(JFFS2_DBG_MSG_PREFIX " dump from offset %#08x to offset %#08x (%x bytes).\n",
|
||||
offs, offs + len, len);
|
||||
i = skip = offs % JFFS2_BUFDUMP_BYTES_PER_LINE;
|
||||
offs = offs & ~(JFFS2_BUFDUMP_BYTES_PER_LINE - 1);
|
||||
|
||||
|
||||
if (skip != 0)
|
||||
printk(JFFS2_DBG "%#08x: ", offs);
|
||||
|
||||
|
||||
while (skip--)
|
||||
printk(" ");
|
||||
|
||||
@@ -598,7 +598,7 @@ __jffs2_dbg_dump_buffer(unsigned char *buf, int len, uint32_t offs)
|
||||
}
|
||||
|
||||
printk("%02x ", buf[i]);
|
||||
|
||||
|
||||
i += 1;
|
||||
}
|
||||
|
||||
@@ -616,7 +616,7 @@ __jffs2_dbg_dump_node(struct jffs2_sb_info *c, uint32_t ofs)
|
||||
size_t retlen;
|
||||
uint32_t crc;
|
||||
int ret;
|
||||
|
||||
|
||||
printk(JFFS2_DBG_MSG_PREFIX " dump node at offset %#08x.\n", ofs);
|
||||
|
||||
ret = jffs2_flash_read(c, ofs, len, &retlen, (unsigned char *)&node);
|
||||
@@ -630,13 +630,13 @@ __jffs2_dbg_dump_node(struct jffs2_sb_info *c, uint32_t ofs)
|
||||
printk(JFFS2_DBG "nodetype:\t%#04x\n", je16_to_cpu(node.u.nodetype));
|
||||
printk(JFFS2_DBG "totlen:\t%#08x\n", je32_to_cpu(node.u.totlen));
|
||||
printk(JFFS2_DBG "hdr_crc:\t%#08x\n", je32_to_cpu(node.u.hdr_crc));
|
||||
|
||||
|
||||
crc = crc32(0, &node.u, sizeof(node.u) - 4);
|
||||
if (crc != je32_to_cpu(node.u.hdr_crc)) {
|
||||
JFFS2_ERROR("wrong common header CRC.\n");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (je16_to_cpu(node.u.magic) != JFFS2_MAGIC_BITMASK &&
|
||||
je16_to_cpu(node.u.magic) != JFFS2_OLD_MAGIC_BITMASK)
|
||||
{
|
||||
@@ -668,7 +668,7 @@ __jffs2_dbg_dump_node(struct jffs2_sb_info *c, uint32_t ofs)
|
||||
printk(JFFS2_DBG "data_crc:\t%#08x\n", je32_to_cpu(node.i.data_crc));
|
||||
printk(JFFS2_DBG "node_crc:\t%#08x\n", je32_to_cpu(node.i.node_crc));
|
||||
|
||||
crc = crc32(0, &node.i, sizeof(node.i) - 8);
|
||||
crc = crc32(0, &node.i, sizeof(node.i) - 8);
|
||||
if (crc != je32_to_cpu(node.i.node_crc)) {
|
||||
JFFS2_ERROR("wrong node header CRC.\n");
|
||||
return;
|
||||
@@ -686,11 +686,11 @@ __jffs2_dbg_dump_node(struct jffs2_sb_info *c, uint32_t ofs)
|
||||
printk(JFFS2_DBG "type:\t%#02x\n", node.d.type);
|
||||
printk(JFFS2_DBG "node_crc:\t%#08x\n", je32_to_cpu(node.d.node_crc));
|
||||
printk(JFFS2_DBG "name_crc:\t%#08x\n", je32_to_cpu(node.d.name_crc));
|
||||
|
||||
|
||||
node.d.name[node.d.nsize] = '\0';
|
||||
printk(JFFS2_DBG "name:\t\"%s\"\n", node.d.name);
|
||||
|
||||
crc = crc32(0, &node.d, sizeof(node.d) - 8);
|
||||
crc = crc32(0, &node.d, sizeof(node.d) - 8);
|
||||
if (crc != je32_to_cpu(node.d.node_crc)) {
|
||||
JFFS2_ERROR("wrong node header CRC.\n");
|
||||
return;
|
||||
|
||||
+5
-5
@@ -7,7 +7,7 @@
|
||||
*
|
||||
* For licensing information, see the file 'LICENCE' in this directory.
|
||||
*
|
||||
* $Id: debug.h,v 1.20 2005/10/24 16:22:34 dedekind Exp $
|
||||
* $Id: debug.h,v 1.21 2005/11/07 11:14:39 gleixner Exp $
|
||||
*
|
||||
*/
|
||||
#ifndef _JFFS2_DEBUG_H_
|
||||
@@ -24,7 +24,7 @@
|
||||
#define JFFS2_DBG_PARANOIA_CHECKS
|
||||
#define JFFS2_DBG_DUMPS
|
||||
|
||||
/*
|
||||
/*
|
||||
* By defining/undefining the below macros one may select debugging messages
|
||||
* fro specific JFFS2 subsystems.
|
||||
*/
|
||||
@@ -45,7 +45,7 @@
|
||||
/* Sanity checks are supposed to be light-weight and enabled by default */
|
||||
#define JFFS2_DBG_SANITY_CHECKS
|
||||
|
||||
/*
|
||||
/*
|
||||
* Dx() are mainly used for debugging messages, they must go away and be
|
||||
* superseded by nicer dbg_xxx() macros...
|
||||
*/
|
||||
@@ -91,7 +91,7 @@
|
||||
" (%d) %s: " fmt, current->pid, \
|
||||
__FUNCTION__, ##__VA_ARGS__); \
|
||||
} while(0)
|
||||
|
||||
|
||||
#define JFFS2_NOTICE(fmt, ...) \
|
||||
do { \
|
||||
printk(JFFS2_NOTICE_MSG_PREFIX \
|
||||
@@ -106,7 +106,7 @@
|
||||
__FUNCTION__, ##__VA_ARGS__); \
|
||||
} while(0)
|
||||
|
||||
/*
|
||||
/*
|
||||
* We split our debugging messages on several parts, depending on the JFFS2
|
||||
* subsystem the message belongs to.
|
||||
*/
|
||||
|
||||
+37
-37
@@ -7,7 +7,7 @@
|
||||
*
|
||||
* For licensing information, see the file 'LICENCE' in this directory.
|
||||
*
|
||||
* $Id: dir.c,v 1.89 2005/09/07 08:34:54 havasi Exp $
|
||||
* $Id: dir.c,v 1.90 2005/11/07 11:14:39 gleixner Exp $
|
||||
*
|
||||
*/
|
||||
|
||||
@@ -64,7 +64,7 @@ struct inode_operations jffs2_dir_inode_operations =
|
||||
|
||||
|
||||
/* We keep the dirent list sorted in increasing order of name hash,
|
||||
and we use the same hash function as the dentries. Makes this
|
||||
and we use the same hash function as the dentries. Makes this
|
||||
nice and simple
|
||||
*/
|
||||
static struct dentry *jffs2_lookup(struct inode *dir_i, struct dentry *target,
|
||||
@@ -85,7 +85,7 @@ static struct dentry *jffs2_lookup(struct inode *dir_i, struct dentry *target,
|
||||
|
||||
/* NB: The 2.2 backport will need to explicitly check for '.' and '..' here */
|
||||
for (fd_list = dir_f->dents; fd_list && fd_list->nhash <= target->d_name.hash; fd_list = fd_list->next) {
|
||||
if (fd_list->nhash == target->d_name.hash &&
|
||||
if (fd_list->nhash == target->d_name.hash &&
|
||||
(!fd || fd_list->version > fd->version) &&
|
||||
strlen(fd_list->name) == target->d_name.len &&
|
||||
!strncmp(fd_list->name, target->d_name.name, target->d_name.len)) {
|
||||
@@ -147,7 +147,7 @@ static int jffs2_readdir(struct file *filp, void *dirent, filldir_t filldir)
|
||||
curofs++;
|
||||
/* First loop: curofs = 2; offset = 2 */
|
||||
if (curofs < offset) {
|
||||
D2(printk(KERN_DEBUG "Skipping dirent: \"%s\", ino #%u, type %d, because curofs %ld < offset %ld\n",
|
||||
D2(printk(KERN_DEBUG "Skipping dirent: \"%s\", ino #%u, type %d, because curofs %ld < offset %ld\n",
|
||||
fd->name, fd->ino, fd->type, curofs, offset));
|
||||
continue;
|
||||
}
|
||||
@@ -182,7 +182,7 @@ static int jffs2_create(struct inode *dir_i, struct dentry *dentry, int mode,
|
||||
ri = jffs2_alloc_raw_inode();
|
||||
if (!ri)
|
||||
return -ENOMEM;
|
||||
|
||||
|
||||
c = JFFS2_SB_INFO(dir_i->i_sb);
|
||||
|
||||
D1(printk(KERN_DEBUG "jffs2_create()\n"));
|
||||
@@ -203,7 +203,7 @@ static int jffs2_create(struct inode *dir_i, struct dentry *dentry, int mode,
|
||||
f = JFFS2_INODE_INFO(inode);
|
||||
dir_f = JFFS2_INODE_INFO(dir_i);
|
||||
|
||||
ret = jffs2_do_create(c, dir_f, f, ri,
|
||||
ret = jffs2_do_create(c, dir_f, f, ri,
|
||||
dentry->d_name.name, dentry->d_name.len);
|
||||
|
||||
if (ret) {
|
||||
@@ -234,7 +234,7 @@ static int jffs2_unlink(struct inode *dir_i, struct dentry *dentry)
|
||||
int ret;
|
||||
uint32_t now = get_seconds();
|
||||
|
||||
ret = jffs2_do_unlink(c, dir_f, dentry->d_name.name,
|
||||
ret = jffs2_do_unlink(c, dir_f, dentry->d_name.name,
|
||||
dentry->d_name.len, dead_f, now);
|
||||
if (dead_f->inocache)
|
||||
dentry->d_inode->i_nlink = dead_f->inocache->nlink;
|
||||
@@ -303,11 +303,11 @@ static int jffs2_symlink (struct inode *dir_i, struct dentry *dentry, const char
|
||||
|
||||
if (!ri)
|
||||
return -ENOMEM;
|
||||
|
||||
|
||||
c = JFFS2_SB_INFO(dir_i->i_sb);
|
||||
|
||||
/* Try to reserve enough space for both node and dirent.
|
||||
* Just the node will do for now, though
|
||||
|
||||
/* Try to reserve enough space for both node and dirent.
|
||||
* Just the node will do for now, though
|
||||
*/
|
||||
namelen = dentry->d_name.len;
|
||||
ret = jffs2_reserve_space(c, sizeof(*ri) + targetlen, &phys_ofs, &alloclen,
|
||||
@@ -338,7 +338,7 @@ static int jffs2_symlink (struct inode *dir_i, struct dentry *dentry, const char
|
||||
ri->compr = JFFS2_COMPR_NONE;
|
||||
ri->data_crc = cpu_to_je32(crc32(0, target, targetlen));
|
||||
ri->node_crc = cpu_to_je32(crc32(0, ri, sizeof(*ri)-8));
|
||||
|
||||
|
||||
fn = jffs2_write_dnode(c, f, ri, target, targetlen, phys_ofs, ALLOC_NORMAL);
|
||||
|
||||
jffs2_free_raw_inode(ri);
|
||||
@@ -364,7 +364,7 @@ static int jffs2_symlink (struct inode *dir_i, struct dentry *dentry, const char
|
||||
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
|
||||
/* No data here. Only a metadata node, which will be
|
||||
obsoleted by the first data write
|
||||
*/
|
||||
f->metadata = fn;
|
||||
@@ -407,7 +407,7 @@ static int jffs2_symlink (struct inode *dir_i, struct dentry *dentry, const char
|
||||
fd = jffs2_write_dirent(c, dir_f, rd, dentry->d_name.name, namelen, phys_ofs, ALLOC_NORMAL);
|
||||
|
||||
if (IS_ERR(fd)) {
|
||||
/* dirent failed to write. Delete the inode normally
|
||||
/* dirent failed to write. Delete the inode normally
|
||||
as if it were the final unlink() */
|
||||
jffs2_complete_reservation(c);
|
||||
jffs2_free_raw_dirent(rd);
|
||||
@@ -450,11 +450,11 @@ static int jffs2_mkdir (struct inode *dir_i, struct dentry *dentry, int mode)
|
||||
ri = jffs2_alloc_raw_inode();
|
||||
if (!ri)
|
||||
return -ENOMEM;
|
||||
|
||||
|
||||
c = JFFS2_SB_INFO(dir_i->i_sb);
|
||||
|
||||
/* Try to reserve enough space for both node and dirent.
|
||||
* Just the node will do for now, though
|
||||
/* Try to reserve enough space for both node and dirent.
|
||||
* Just the node will do for now, though
|
||||
*/
|
||||
namelen = dentry->d_name.len;
|
||||
ret = jffs2_reserve_space(c, sizeof(*ri), &phys_ofs, &alloclen, ALLOC_NORMAL,
|
||||
@@ -482,7 +482,7 @@ static int jffs2_mkdir (struct inode *dir_i, struct dentry *dentry, int mode)
|
||||
|
||||
ri->data_crc = cpu_to_je32(0);
|
||||
ri->node_crc = cpu_to_je32(crc32(0, ri, sizeof(*ri)-8));
|
||||
|
||||
|
||||
fn = jffs2_write_dnode(c, f, ri, NULL, 0, phys_ofs, ALLOC_NORMAL);
|
||||
|
||||
jffs2_free_raw_inode(ri);
|
||||
@@ -494,7 +494,7 @@ static int jffs2_mkdir (struct inode *dir_i, struct dentry *dentry, int mode)
|
||||
jffs2_clear_inode(inode);
|
||||
return PTR_ERR(fn);
|
||||
}
|
||||
/* No data here. Only a metadata node, which will be
|
||||
/* No data here. Only a metadata node, which will be
|
||||
obsoleted by the first data write
|
||||
*/
|
||||
f->metadata = fn;
|
||||
@@ -508,7 +508,7 @@ static int jffs2_mkdir (struct inode *dir_i, struct dentry *dentry, int mode)
|
||||
jffs2_clear_inode(inode);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
rd = jffs2_alloc_raw_dirent();
|
||||
if (!rd) {
|
||||
/* Argh. Now we treat it like a normal delete */
|
||||
@@ -535,9 +535,9 @@ static int jffs2_mkdir (struct inode *dir_i, struct dentry *dentry, int mode)
|
||||
rd->name_crc = cpu_to_je32(crc32(0, dentry->d_name.name, namelen));
|
||||
|
||||
fd = jffs2_write_dirent(c, dir_f, rd, dentry->d_name.name, namelen, phys_ofs, ALLOC_NORMAL);
|
||||
|
||||
|
||||
if (IS_ERR(fd)) {
|
||||
/* dirent failed to write. Delete the inode normally
|
||||
/* dirent failed to write. Delete the inode normally
|
||||
as if it were the final unlink() */
|
||||
jffs2_complete_reservation(c);
|
||||
jffs2_free_raw_dirent(rd);
|
||||
@@ -599,16 +599,16 @@ static int jffs2_mknod (struct inode *dir_i, struct dentry *dentry, int mode, de
|
||||
ri = jffs2_alloc_raw_inode();
|
||||
if (!ri)
|
||||
return -ENOMEM;
|
||||
|
||||
|
||||
c = JFFS2_SB_INFO(dir_i->i_sb);
|
||||
|
||||
|
||||
if (S_ISBLK(mode) || S_ISCHR(mode)) {
|
||||
dev = cpu_to_je16(old_encode_dev(rdev));
|
||||
devlen = sizeof(dev);
|
||||
}
|
||||
|
||||
/* Try to reserve enough space for both node and dirent.
|
||||
* Just the node will do for now, though
|
||||
|
||||
/* Try to reserve enough space for both node and dirent.
|
||||
* Just the node will do for now, though
|
||||
*/
|
||||
namelen = dentry->d_name.len;
|
||||
ret = jffs2_reserve_space(c, sizeof(*ri) + devlen, &phys_ofs, &alloclen,
|
||||
@@ -638,7 +638,7 @@ static int jffs2_mknod (struct inode *dir_i, struct dentry *dentry, int mode, de
|
||||
ri->compr = JFFS2_COMPR_NONE;
|
||||
ri->data_crc = cpu_to_je32(crc32(0, &dev, devlen));
|
||||
ri->node_crc = cpu_to_je32(crc32(0, ri, sizeof(*ri)-8));
|
||||
|
||||
|
||||
fn = jffs2_write_dnode(c, f, ri, (char *)&dev, devlen, phys_ofs, ALLOC_NORMAL);
|
||||
|
||||
jffs2_free_raw_inode(ri);
|
||||
@@ -650,7 +650,7 @@ static int jffs2_mknod (struct inode *dir_i, struct dentry *dentry, int mode, de
|
||||
jffs2_clear_inode(inode);
|
||||
return PTR_ERR(fn);
|
||||
}
|
||||
/* No data here. Only a metadata node, which will be
|
||||
/* No data here. Only a metadata node, which will be
|
||||
obsoleted by the first data write
|
||||
*/
|
||||
f->metadata = fn;
|
||||
@@ -694,9 +694,9 @@ static int jffs2_mknod (struct inode *dir_i, struct dentry *dentry, int mode, de
|
||||
rd->name_crc = cpu_to_je32(crc32(0, dentry->d_name.name, namelen));
|
||||
|
||||
fd = jffs2_write_dirent(c, dir_f, rd, dentry->d_name.name, namelen, phys_ofs, ALLOC_NORMAL);
|
||||
|
||||
|
||||
if (IS_ERR(fd)) {
|
||||
/* dirent failed to write. Delete the inode normally
|
||||
/* dirent failed to write. Delete the inode normally
|
||||
as if it were the final unlink() */
|
||||
jffs2_complete_reservation(c);
|
||||
jffs2_free_raw_dirent(rd);
|
||||
@@ -730,7 +730,7 @@ static int jffs2_rename (struct inode *old_dir_i, struct dentry *old_dentry,
|
||||
uint8_t type;
|
||||
uint32_t now;
|
||||
|
||||
/* The VFS will check for us and prevent trying to rename a
|
||||
/* The VFS will check for us and prevent trying to rename a
|
||||
* file over a directory and vice versa, but if it's a directory,
|
||||
* the VFS can't check whether the victim is empty. The filesystem
|
||||
* needs to do that for itself.
|
||||
@@ -752,18 +752,18 @@ static int jffs2_rename (struct inode *old_dir_i, struct dentry *old_dentry,
|
||||
}
|
||||
|
||||
/* XXX: We probably ought to alloc enough space for
|
||||
both nodes at the same time. Writing the new link,
|
||||
both nodes at the same time. Writing the new link,
|
||||
then getting -ENOSPC, is quite bad :)
|
||||
*/
|
||||
|
||||
/* Make a hard link */
|
||||
|
||||
|
||||
/* XXX: This is ugly */
|
||||
type = (old_dentry->d_inode->i_mode & S_IFMT) >> 12;
|
||||
if (!type) type = DT_REG;
|
||||
|
||||
now = get_seconds();
|
||||
ret = jffs2_do_link(c, JFFS2_INODE_INFO(new_dir_i),
|
||||
ret = jffs2_do_link(c, JFFS2_INODE_INFO(new_dir_i),
|
||||
old_dentry->d_inode->i_ino, type,
|
||||
new_dentry->d_name.name, new_dentry->d_name.len, now);
|
||||
|
||||
@@ -782,13 +782,13 @@ static int jffs2_rename (struct inode *old_dir_i, struct dentry *old_dentry,
|
||||
}
|
||||
}
|
||||
|
||||
/* If it was a directory we moved, and there was no victim,
|
||||
/* If it was a directory we moved, and there was no victim,
|
||||
increase i_nlink on its new parent */
|
||||
if (S_ISDIR(old_dentry->d_inode->i_mode) && !victim_f)
|
||||
new_dir_i->i_nlink++;
|
||||
|
||||
/* Unlink the original */
|
||||
ret = jffs2_do_unlink(c, JFFS2_INODE_INFO(old_dir_i),
|
||||
ret = jffs2_do_unlink(c, JFFS2_INODE_INFO(old_dir_i),
|
||||
old_dentry->d_name.name, old_dentry->d_name.len, NULL, now);
|
||||
|
||||
/* We don't touch inode->i_nlink */
|
||||
|
||||
+14
-14
@@ -24,7 +24,7 @@ struct erase_priv_struct {
|
||||
struct jffs2_eraseblock *jeb;
|
||||
struct jffs2_sb_info *c;
|
||||
};
|
||||
|
||||
|
||||
#ifndef __ECOS
|
||||
static void jffs2_erase_callback(struct erase_info *);
|
||||
#endif
|
||||
@@ -71,7 +71,7 @@ static void jffs2_erase_block(struct jffs2_sb_info *c,
|
||||
instr->callback = jffs2_erase_callback;
|
||||
instr->priv = (unsigned long)(&instr[1]);
|
||||
instr->fail_addr = 0xffffffff;
|
||||
|
||||
|
||||
((struct erase_priv_struct *)instr->priv)->jeb = jeb;
|
||||
((struct erase_priv_struct *)instr->priv)->c = c;
|
||||
|
||||
@@ -96,7 +96,7 @@ static void jffs2_erase_block(struct jffs2_sb_info *c,
|
||||
return;
|
||||
}
|
||||
|
||||
if (ret == -EROFS)
|
||||
if (ret == -EROFS)
|
||||
printk(KERN_WARNING "Erase at 0x%08x failed immediately: -EROFS. Is the sector locked?\n", jeb->offset);
|
||||
else
|
||||
printk(KERN_WARNING "Erase at 0x%08x failed immediately: errno %d\n", jeb->offset, ret);
|
||||
@@ -197,7 +197,7 @@ static void jffs2_erase_failed(struct jffs2_sb_info *c, struct jffs2_eraseblock
|
||||
c->nr_erasing_blocks--;
|
||||
spin_unlock(&c->erase_completion_lock);
|
||||
wake_up(&c->erase_wait);
|
||||
}
|
||||
}
|
||||
|
||||
#ifndef __ECOS
|
||||
static void jffs2_erase_callback(struct erase_info *instr)
|
||||
@@ -209,7 +209,7 @@ static void jffs2_erase_callback(struct erase_info *instr)
|
||||
jffs2_erase_failed(priv->c, priv->jeb, instr->fail_addr);
|
||||
} else {
|
||||
jffs2_erase_succeeded(priv->c, priv->jeb);
|
||||
}
|
||||
}
|
||||
kfree(instr);
|
||||
}
|
||||
#endif /* !__ECOS */
|
||||
@@ -227,13 +227,13 @@ static inline void jffs2_remove_node_refs_from_ino_list(struct jffs2_sb_info *c,
|
||||
/* Walk the inode's list once, removing any nodes from this eraseblock */
|
||||
while (1) {
|
||||
if (!(*prev)->next_in_ino) {
|
||||
/* We're looking at the jffs2_inode_cache, which is
|
||||
/* We're looking at the jffs2_inode_cache, which is
|
||||
at the end of the linked list. Stash it and continue
|
||||
from the beginning of the list */
|
||||
ic = (struct jffs2_inode_cache *)(*prev);
|
||||
prev = &ic->nodes;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
if (SECTOR_ADDR((*prev)->flash_offset) == jeb->offset) {
|
||||
/* It's in the block we're erasing */
|
||||
@@ -267,7 +267,7 @@ static inline void jffs2_remove_node_refs_from_ino_list(struct jffs2_sb_info *c,
|
||||
printk(KERN_DEBUG "After remove_node_refs_from_ino_list: \n" KERN_DEBUG);
|
||||
|
||||
this = ic->nodes;
|
||||
|
||||
|
||||
while(this) {
|
||||
printk( "0x%08x(%d)->", ref_offset(this), ref_flags(this));
|
||||
if (++i == 5) {
|
||||
@@ -290,7 +290,7 @@ static void jffs2_free_all_node_refs(struct jffs2_sb_info *c, struct jffs2_erase
|
||||
while(jeb->first_node) {
|
||||
ref = jeb->first_node;
|
||||
jeb->first_node = ref->next_phys;
|
||||
|
||||
|
||||
/* Remove from the inode-list */
|
||||
if (ref->next_in_ino)
|
||||
jffs2_remove_node_refs_from_ino_list(c, ref, jeb);
|
||||
@@ -307,7 +307,7 @@ static int jffs2_block_check_erase(struct jffs2_sb_info *c, struct jffs2_erasebl
|
||||
uint32_t ofs;
|
||||
size_t retlen;
|
||||
int ret = -EIO;
|
||||
|
||||
|
||||
ebuf = kmalloc(PAGE_SIZE, GFP_KERNEL);
|
||||
if (!ebuf) {
|
||||
printk(KERN_WARNING "Failed to allocate page buffer for verifying erase at 0x%08x. Refiling\n", jeb->offset);
|
||||
@@ -361,7 +361,7 @@ static void jffs2_mark_erased_block(struct jffs2_sb_info *c, struct jffs2_eraseb
|
||||
case -EIO: goto filebad;
|
||||
}
|
||||
|
||||
/* Write the erase complete marker */
|
||||
/* Write the erase complete marker */
|
||||
D1(printk(KERN_DEBUG "Writing erased marker to block at 0x%08x\n", jeb->offset));
|
||||
bad_offset = jeb->offset;
|
||||
|
||||
@@ -399,7 +399,7 @@ static void jffs2_mark_erased_block(struct jffs2_sb_info *c, struct jffs2_eraseb
|
||||
vecs[0].iov_base = (unsigned char *) ▮
|
||||
vecs[0].iov_len = sizeof(marker);
|
||||
ret = jffs2_flash_direct_writev(c, vecs, 1, jeb->offset, &retlen);
|
||||
|
||||
|
||||
if (ret || retlen != sizeof(marker)) {
|
||||
if (ret)
|
||||
printk(KERN_WARNING "Write clean marker to block at 0x%08x failed: %d\n",
|
||||
@@ -416,9 +416,9 @@ static void jffs2_mark_erased_block(struct jffs2_sb_info *c, struct jffs2_eraseb
|
||||
marker_ref->next_phys = NULL;
|
||||
marker_ref->flash_offset = jeb->offset | REF_NORMAL;
|
||||
marker_ref->__totlen = c->cleanmarker_size;
|
||||
|
||||
|
||||
jeb->first_node = jeb->last_node = marker_ref;
|
||||
|
||||
|
||||
jeb->free_size = c->sector_size - c->cleanmarker_size;
|
||||
jeb->used_size = c->cleanmarker_size;
|
||||
jeb->dirty_size = 0;
|
||||
|
||||
+10
-10
@@ -34,8 +34,8 @@ int jffs2_fsync(struct file *filp, struct dentry *dentry, int datasync)
|
||||
|
||||
/* Trigger GC to flush any pending writes for this inode */
|
||||
jffs2_flush_wbuf_gc(c, inode->i_ino);
|
||||
|
||||
return 0;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
struct file_operations jffs2_file_operations =
|
||||
@@ -107,7 +107,7 @@ static int jffs2_readpage (struct file *filp, struct page *pg)
|
||||
{
|
||||
struct jffs2_inode_info *f = JFFS2_INODE_INFO(pg->mapping->host);
|
||||
int ret;
|
||||
|
||||
|
||||
down(&f->sem);
|
||||
ret = jffs2_do_readpage_unlock(pg->mapping->host, pg);
|
||||
up(&f->sem);
|
||||
@@ -130,7 +130,7 @@ static int jffs2_prepare_write (struct file *filp, struct page *pg,
|
||||
struct jffs2_raw_inode ri;
|
||||
struct jffs2_full_dnode *fn;
|
||||
uint32_t phys_ofs, alloc_len;
|
||||
|
||||
|
||||
D1(printk(KERN_DEBUG "Writing new hole frag 0x%x-0x%x between current EOF and new page\n",
|
||||
(unsigned int)inode->i_size, pageofs));
|
||||
|
||||
@@ -160,7 +160,7 @@ static int jffs2_prepare_write (struct file *filp, struct page *pg,
|
||||
ri.compr = JFFS2_COMPR_ZERO;
|
||||
ri.node_crc = cpu_to_je32(crc32(0, &ri, sizeof(ri)-8));
|
||||
ri.data_crc = cpu_to_je32(0);
|
||||
|
||||
|
||||
fn = jffs2_write_dnode(c, f, &ri, NULL, 0, phys_ofs, ALLOC_NORMAL);
|
||||
|
||||
if (IS_ERR(fn)) {
|
||||
@@ -187,7 +187,7 @@ static int jffs2_prepare_write (struct file *filp, struct page *pg,
|
||||
inode->i_size = pageofs;
|
||||
up(&f->sem);
|
||||
}
|
||||
|
||||
|
||||
/* Read in the page if it wasn't already present, unless it's a whole page */
|
||||
if (!PageUptodate(pg) && (start || end < PAGE_CACHE_SIZE)) {
|
||||
down(&f->sem);
|
||||
@@ -218,7 +218,7 @@ static int jffs2_commit_write (struct file *filp, struct page *pg,
|
||||
if (!start && end == PAGE_CACHE_SIZE) {
|
||||
/* We need to avoid deadlock with page_cache_read() in
|
||||
jffs2_garbage_collect_pass(). So we have to mark the
|
||||
page up to date, to prevent page_cache_read() from
|
||||
page up to date, to prevent page_cache_read() from
|
||||
trying to re-lock it. */
|
||||
SetPageUptodate(pg);
|
||||
}
|
||||
@@ -252,7 +252,7 @@ static int jffs2_commit_write (struct file *filp, struct page *pg,
|
||||
/* There was an error writing. */
|
||||
SetPageError(pg);
|
||||
}
|
||||
|
||||
|
||||
/* Adjust writtenlen for the padding we did, so we don't confuse our caller */
|
||||
if (writtenlen < (start&3))
|
||||
writtenlen = 0;
|
||||
@@ -263,7 +263,7 @@ static int jffs2_commit_write (struct file *filp, struct page *pg,
|
||||
if (inode->i_size < (pg->index << PAGE_CACHE_SHIFT) + start + writtenlen) {
|
||||
inode->i_size = (pg->index << PAGE_CACHE_SHIFT) + start + writtenlen;
|
||||
inode->i_blocks = (inode->i_size + 511) >> 9;
|
||||
|
||||
|
||||
inode->i_ctime = inode->i_mtime = ITIME(je32_to_cpu(ri->ctime));
|
||||
}
|
||||
}
|
||||
@@ -272,7 +272,7 @@ static int jffs2_commit_write (struct file *filp, struct page *pg,
|
||||
|
||||
if (start+writtenlen < end) {
|
||||
/* generic_file_write has written more to the page cache than we've
|
||||
actually written to the medium. Mark the page !Uptodate so that
|
||||
actually written to the medium. Mark the page !Uptodate so that
|
||||
it gets reread */
|
||||
D1(printk(KERN_DEBUG "jffs2_commit_write(): Not all bytes written. Marking page !uptodate\n"));
|
||||
SetPageError(pg);
|
||||
|
||||
+28
-28
@@ -40,7 +40,7 @@ static int jffs2_do_setattr (struct inode *inode, struct iattr *iattr)
|
||||
int ret;
|
||||
D1(printk(KERN_DEBUG "jffs2_setattr(): ino #%lu\n", inode->i_ino));
|
||||
ret = inode_change_ok(inode, iattr);
|
||||
if (ret)
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
/* Special cases - we don't want more than one data node
|
||||
@@ -73,7 +73,7 @@ static int jffs2_do_setattr (struct inode *inode, struct iattr *iattr)
|
||||
kfree(mdata);
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
|
||||
ret = jffs2_reserve_space(c, sizeof(*ri) + mdatalen, &phys_ofs, &alloclen,
|
||||
ALLOC_NORMAL, JFFS2_SUMMARY_INODE_SIZE);
|
||||
if (ret) {
|
||||
@@ -84,7 +84,7 @@ static int jffs2_do_setattr (struct inode *inode, struct iattr *iattr)
|
||||
}
|
||||
down(&f->sem);
|
||||
ivalid = iattr->ia_valid;
|
||||
|
||||
|
||||
ri->magic = cpu_to_je16(JFFS2_MAGIC_BITMASK);
|
||||
ri->nodetype = cpu_to_je16(JFFS2_NODETYPE_INODE);
|
||||
ri->totlen = cpu_to_je32(sizeof(*ri) + mdatalen);
|
||||
@@ -100,7 +100,7 @@ static int jffs2_do_setattr (struct inode *inode, struct iattr *iattr)
|
||||
if (iattr->ia_mode & S_ISGID &&
|
||||
!in_group_p(je16_to_cpu(ri->gid)) && !capable(CAP_FSETID))
|
||||
ri->mode = cpu_to_jemode(iattr->ia_mode & ~S_ISGID);
|
||||
else
|
||||
else
|
||||
ri->mode = cpu_to_jemode(iattr->ia_mode);
|
||||
else
|
||||
ri->mode = cpu_to_jemode(inode->i_mode);
|
||||
@@ -129,7 +129,7 @@ static int jffs2_do_setattr (struct inode *inode, struct iattr *iattr)
|
||||
new_metadata = jffs2_write_dnode(c, f, ri, mdata, mdatalen, phys_ofs, ALLOC_NORMAL);
|
||||
if (S_ISLNK(inode->i_mode))
|
||||
kfree(mdata);
|
||||
|
||||
|
||||
if (IS_ERR(new_metadata)) {
|
||||
jffs2_complete_reservation(c);
|
||||
jffs2_free_raw_inode(ri);
|
||||
@@ -167,7 +167,7 @@ static int jffs2_do_setattr (struct inode *inode, struct iattr *iattr)
|
||||
jffs2_complete_reservation(c);
|
||||
|
||||
/* We have to do the vmtruncate() without f->sem held, since
|
||||
some pages may be locked and waiting for it in readpage().
|
||||
some pages may be locked and waiting for it in readpage().
|
||||
We are protected from a simultaneous write() extending i_size
|
||||
back past iattr->ia_size, because do_truncate() holds the
|
||||
generic inode semaphore. */
|
||||
@@ -210,12 +210,12 @@ int jffs2_statfs(struct super_block *sb, struct kstatfs *buf)
|
||||
|
||||
void jffs2_clear_inode (struct inode *inode)
|
||||
{
|
||||
/* We can forget about this inode for now - drop all
|
||||
/* We can forget about this inode for now - drop all
|
||||
* the nodelists associated with it, etc.
|
||||
*/
|
||||
struct jffs2_sb_info *c = JFFS2_SB_INFO(inode->i_sb);
|
||||
struct jffs2_inode_info *f = JFFS2_INODE_INFO(inode);
|
||||
|
||||
|
||||
D1(printk(KERN_DEBUG "jffs2_clear_inode(): ino #%lu mode %o\n", inode->i_ino, inode->i_mode));
|
||||
|
||||
jffs2_do_clear_inode(c, f);
|
||||
@@ -234,7 +234,7 @@ void jffs2_read_inode (struct inode *inode)
|
||||
c = JFFS2_SB_INFO(inode->i_sb);
|
||||
|
||||
jffs2_init_inode_info(f);
|
||||
|
||||
|
||||
ret = jffs2_do_read_inode(c, f, inode->i_ino, &latest_node);
|
||||
|
||||
if (ret) {
|
||||
@@ -254,14 +254,14 @@ void jffs2_read_inode (struct inode *inode)
|
||||
|
||||
inode->i_blksize = PAGE_SIZE;
|
||||
inode->i_blocks = (inode->i_size + 511) >> 9;
|
||||
|
||||
|
||||
switch (inode->i_mode & S_IFMT) {
|
||||
jint16_t rdev;
|
||||
|
||||
case S_IFLNK:
|
||||
inode->i_op = &jffs2_symlink_inode_operations;
|
||||
break;
|
||||
|
||||
|
||||
case S_IFDIR:
|
||||
{
|
||||
struct jffs2_full_dirent *fd;
|
||||
@@ -298,7 +298,7 @@ void jffs2_read_inode (struct inode *inode)
|
||||
jffs2_do_clear_inode(c, f);
|
||||
make_bad_inode(inode);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
case S_IFSOCK:
|
||||
case S_IFIFO:
|
||||
@@ -354,11 +354,11 @@ int jffs2_remount_fs (struct super_block *sb, int *flags, char *data)
|
||||
down(&c->alloc_sem);
|
||||
jffs2_flush_wbuf_pad(c);
|
||||
up(&c->alloc_sem);
|
||||
}
|
||||
}
|
||||
|
||||
if (!(*flags & MS_RDONLY))
|
||||
jffs2_start_garbage_collect_thread(c);
|
||||
|
||||
|
||||
*flags |= MS_NOATIME;
|
||||
|
||||
return 0;
|
||||
@@ -392,9 +392,9 @@ struct inode *jffs2_new_inode (struct inode *dir_i, int mode, struct jffs2_raw_i
|
||||
D1(printk(KERN_DEBUG "jffs2_new_inode(): dir_i %ld, mode 0x%x\n", dir_i->i_ino, mode));
|
||||
|
||||
c = JFFS2_SB_INFO(sb);
|
||||
|
||||
|
||||
inode = new_inode(sb);
|
||||
|
||||
|
||||
if (!inode)
|
||||
return ERR_PTR(-ENOMEM);
|
||||
|
||||
@@ -458,14 +458,14 @@ int jffs2_do_fill_super(struct super_block *sb, void *data, int silent)
|
||||
#endif
|
||||
|
||||
c->flash_size = c->mtd->size;
|
||||
c->sector_size = c->mtd->erasesize;
|
||||
c->sector_size = c->mtd->erasesize;
|
||||
blocks = c->flash_size / c->sector_size;
|
||||
|
||||
/*
|
||||
* Size alignment check
|
||||
*/
|
||||
if ((c->sector_size * blocks) != c->flash_size) {
|
||||
c->flash_size = c->sector_size * blocks;
|
||||
c->flash_size = c->sector_size * blocks;
|
||||
printk(KERN_INFO "jffs2: Flash size not aligned to erasesize, reducing to %dKiB\n",
|
||||
c->flash_size / 1024);
|
||||
}
|
||||
@@ -543,16 +543,16 @@ struct jffs2_inode_info *jffs2_gc_fetch_inode(struct jffs2_sb_info *c,
|
||||
struct jffs2_inode_cache *ic;
|
||||
if (!nlink) {
|
||||
/* The inode has zero nlink but its nodes weren't yet marked
|
||||
obsolete. This has to be because we're still waiting for
|
||||
obsolete. This has to be because we're still waiting for
|
||||
the final (close() and) iput() to happen.
|
||||
|
||||
There's a possibility that the final iput() could have
|
||||
There's a possibility that the final iput() could have
|
||||
happened while we were contemplating. In order to ensure
|
||||
that we don't cause a new read_inode() (which would fail)
|
||||
for the inode in question, we use ilookup() in this case
|
||||
instead of iget().
|
||||
|
||||
The nlink can't _become_ zero at this point because we're
|
||||
The nlink can't _become_ zero at this point because we're
|
||||
holding the alloc_sem, and jffs2_do_unlink() would also
|
||||
need that while decrementing nlink on any inode.
|
||||
*/
|
||||
@@ -599,19 +599,19 @@ struct jffs2_inode_info *jffs2_gc_fetch_inode(struct jffs2_sb_info *c,
|
||||
return JFFS2_INODE_INFO(inode);
|
||||
}
|
||||
|
||||
unsigned char *jffs2_gc_fetch_page(struct jffs2_sb_info *c,
|
||||
struct jffs2_inode_info *f,
|
||||
unsigned char *jffs2_gc_fetch_page(struct jffs2_sb_info *c,
|
||||
struct jffs2_inode_info *f,
|
||||
unsigned long offset,
|
||||
unsigned long *priv)
|
||||
{
|
||||
struct inode *inode = OFNI_EDONI_2SFFJ(f);
|
||||
struct page *pg;
|
||||
|
||||
pg = read_cache_page(inode->i_mapping, offset >> PAGE_CACHE_SHIFT,
|
||||
pg = read_cache_page(inode->i_mapping, offset >> PAGE_CACHE_SHIFT,
|
||||
(void *)jffs2_do_readpage_unlock, inode);
|
||||
if (IS_ERR(pg))
|
||||
return (void *)pg;
|
||||
|
||||
|
||||
*priv = (unsigned long)pg;
|
||||
return kmap(pg);
|
||||
}
|
||||
@@ -628,7 +628,7 @@ void jffs2_gc_release_page(struct jffs2_sb_info *c,
|
||||
|
||||
static int jffs2_flash_setup(struct jffs2_sb_info *c) {
|
||||
int ret = 0;
|
||||
|
||||
|
||||
if (jffs2_cleanmarker_oob(c)) {
|
||||
/* NAND flash... do setup accordingly */
|
||||
ret = jffs2_nand_flash_setup(c);
|
||||
@@ -642,7 +642,7 @@ static int jffs2_flash_setup(struct jffs2_sb_info *c) {
|
||||
if (ret)
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
/* and Dataflash */
|
||||
if (jffs2_dataflash(c)) {
|
||||
ret = jffs2_dataflash_setup(c);
|
||||
@@ -670,7 +670,7 @@ void jffs2_flash_cleanup(struct jffs2_sb_info *c) {
|
||||
if (jffs2_nor_ecc(c)) {
|
||||
jffs2_nor_ecc_flash_cleanup(c);
|
||||
}
|
||||
|
||||
|
||||
/* and DataFlash */
|
||||
if (jffs2_dataflash(c)) {
|
||||
jffs2_dataflash_cleanup(c);
|
||||
|
||||
+56
-56
@@ -7,7 +7,7 @@
|
||||
*
|
||||
* For licensing information, see the file 'LICENCE' in this directory.
|
||||
*
|
||||
* $Id: gc.c,v 1.154 2005/09/07 08:34:54 havasi Exp $
|
||||
* $Id: gc.c,v 1.155 2005/11/07 11:14:39 gleixner Exp $
|
||||
*
|
||||
*/
|
||||
|
||||
@@ -21,14 +21,14 @@
|
||||
#include "nodelist.h"
|
||||
#include "compr.h"
|
||||
|
||||
static int jffs2_garbage_collect_pristine(struct jffs2_sb_info *c,
|
||||
static int jffs2_garbage_collect_pristine(struct jffs2_sb_info *c,
|
||||
struct jffs2_inode_cache *ic,
|
||||
struct jffs2_raw_node_ref *raw);
|
||||
static int jffs2_garbage_collect_metadata(struct jffs2_sb_info *c, struct jffs2_eraseblock *jeb,
|
||||
static int jffs2_garbage_collect_metadata(struct jffs2_sb_info *c, struct jffs2_eraseblock *jeb,
|
||||
struct jffs2_inode_info *f, struct jffs2_full_dnode *fd);
|
||||
static int jffs2_garbage_collect_dirent(struct jffs2_sb_info *c, struct jffs2_eraseblock *jeb,
|
||||
static int jffs2_garbage_collect_dirent(struct jffs2_sb_info *c, struct jffs2_eraseblock *jeb,
|
||||
struct jffs2_inode_info *f, struct jffs2_full_dirent *fd);
|
||||
static int jffs2_garbage_collect_deletion_dirent(struct jffs2_sb_info *c, struct jffs2_eraseblock *jeb,
|
||||
static int jffs2_garbage_collect_deletion_dirent(struct jffs2_sb_info *c, struct jffs2_eraseblock *jeb,
|
||||
struct jffs2_inode_info *f, struct jffs2_full_dirent *fd);
|
||||
static int jffs2_garbage_collect_hole(struct jffs2_sb_info *c, struct jffs2_eraseblock *jeb,
|
||||
struct jffs2_inode_info *f, struct jffs2_full_dnode *fn,
|
||||
@@ -55,7 +55,7 @@ again:
|
||||
D1(printk(KERN_DEBUG "Picking block from bad_used_list to GC next\n"));
|
||||
nextlist = &c->bad_used_list;
|
||||
} else if (n < 50 && !list_empty(&c->erasable_list)) {
|
||||
/* Note that most of them will have gone directly to be erased.
|
||||
/* Note that most of them will have gone directly to be erased.
|
||||
So don't favour the erasable_list _too_ much. */
|
||||
D1(printk(KERN_DEBUG "Picking block from erasable_list to GC next\n"));
|
||||
nextlist = &c->erasable_list;
|
||||
@@ -101,7 +101,7 @@ again:
|
||||
printk(KERN_WARNING "Eep. ret->gc_node for block at 0x%08x is NULL\n", ret->offset);
|
||||
BUG();
|
||||
}
|
||||
|
||||
|
||||
/* Have we accidentally picked a clean block with wasted space ? */
|
||||
if (ret->wasted_size) {
|
||||
D1(printk(KERN_DEBUG "Converting wasted_size %08x to dirty_size\n", ret->wasted_size));
|
||||
@@ -136,7 +136,7 @@ int jffs2_garbage_collect_pass(struct jffs2_sb_info *c)
|
||||
|
||||
/* We can't start doing GC yet. We haven't finished checking
|
||||
the node CRCs etc. Do it now. */
|
||||
|
||||
|
||||
/* checked_ino is protected by the alloc_sem */
|
||||
if (c->checked_ino > c->highest_ino) {
|
||||
printk(KERN_CRIT "Checked all inodes but still 0x%x bytes of unchecked space?\n",
|
||||
@@ -178,7 +178,7 @@ int jffs2_garbage_collect_pass(struct jffs2_sb_info *c)
|
||||
|
||||
case INO_STATE_READING:
|
||||
/* We need to wait for it to finish, lest we move on
|
||||
and trigger the BUG() above while we haven't yet
|
||||
and trigger the BUG() above while we haven't yet
|
||||
finished checking all its nodes */
|
||||
D1(printk(KERN_DEBUG "Waiting for ino #%u to finish reading\n", ic->ino));
|
||||
up(&c->alloc_sem);
|
||||
@@ -228,13 +228,13 @@ int jffs2_garbage_collect_pass(struct jffs2_sb_info *c)
|
||||
}
|
||||
|
||||
raw = jeb->gc_node;
|
||||
|
||||
|
||||
while(ref_obsolete(raw)) {
|
||||
D1(printk(KERN_DEBUG "Node at 0x%08x is obsolete... skipping\n", ref_offset(raw)));
|
||||
raw = raw->next_phys;
|
||||
if (unlikely(!raw)) {
|
||||
printk(KERN_WARNING "eep. End of raw list while still supposedly nodes to GC\n");
|
||||
printk(KERN_WARNING "erase block at 0x%08x. free_size 0x%08x, dirty_size 0x%08x, used_size 0x%08x\n",
|
||||
printk(KERN_WARNING "erase block at 0x%08x. free_size 0x%08x, dirty_size 0x%08x, used_size 0x%08x\n",
|
||||
jeb->offset, jeb->free_size, jeb->dirty_size, jeb->used_size);
|
||||
jeb->gc_node = raw;
|
||||
spin_unlock(&c->erase_completion_lock);
|
||||
@@ -259,7 +259,7 @@ int jffs2_garbage_collect_pass(struct jffs2_sb_info *c)
|
||||
ic = jffs2_raw_ref_to_ic(raw);
|
||||
|
||||
/* We need to hold the inocache. Either the erase_completion_lock or
|
||||
the inocache_lock are sufficient; we trade down since the inocache_lock
|
||||
the inocache_lock are sufficient; we trade down since the inocache_lock
|
||||
causes less contention. */
|
||||
spin_lock(&c->inocache_lock);
|
||||
|
||||
@@ -278,14 +278,14 @@ int jffs2_garbage_collect_pass(struct jffs2_sb_info *c)
|
||||
|
||||
switch(ic->state) {
|
||||
case INO_STATE_CHECKEDABSENT:
|
||||
/* It's been checked, but it's not currently in-core.
|
||||
/* It's been checked, but it's not currently in-core.
|
||||
We can just copy any pristine nodes, but have
|
||||
to prevent anyone else from doing read_inode() while
|
||||
we're at it, so we set the state accordingly */
|
||||
if (ref_flags(raw) == REF_PRISTINE)
|
||||
ic->state = INO_STATE_GC;
|
||||
else {
|
||||
D1(printk(KERN_DEBUG "Ino #%u is absent but node not REF_PRISTINE. Reading.\n",
|
||||
D1(printk(KERN_DEBUG "Ino #%u is absent but node not REF_PRISTINE. Reading.\n",
|
||||
ic->ino));
|
||||
}
|
||||
break;
|
||||
@@ -298,8 +298,8 @@ int jffs2_garbage_collect_pass(struct jffs2_sb_info *c)
|
||||
case INO_STATE_CHECKING:
|
||||
case INO_STATE_GC:
|
||||
/* Should never happen. We should have finished checking
|
||||
by the time we actually start doing any GC, and since
|
||||
we're holding the alloc_sem, no other garbage collection
|
||||
by the time we actually start doing any GC, and since
|
||||
we're holding the alloc_sem, no other garbage collection
|
||||
can happen.
|
||||
*/
|
||||
printk(KERN_CRIT "Inode #%u already in state %d in jffs2_garbage_collect_pass()!\n",
|
||||
@@ -319,21 +319,21 @@ int jffs2_garbage_collect_pass(struct jffs2_sb_info *c)
|
||||
D1(printk(KERN_DEBUG "jffs2_garbage_collect_pass() waiting for ino #%u in state %d\n",
|
||||
ic->ino, ic->state));
|
||||
sleep_on_spinunlock(&c->inocache_wq, &c->inocache_lock);
|
||||
/* And because we dropped the alloc_sem we must start again from the
|
||||
/* And because we dropped the alloc_sem we must start again from the
|
||||
beginning. Ponder chance of livelock here -- we're returning success
|
||||
without actually making any progress.
|
||||
|
||||
Q: What are the chances that the inode is back in INO_STATE_READING
|
||||
Q: What are the chances that the inode is back in INO_STATE_READING
|
||||
again by the time we next enter this function? And that this happens
|
||||
enough times to cause a real delay?
|
||||
|
||||
A: Small enough that I don't care :)
|
||||
A: Small enough that I don't care :)
|
||||
*/
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* OK. Now if the inode is in state INO_STATE_GC, we are going to copy the
|
||||
node intact, and we don't have to muck about with the fragtree etc.
|
||||
node intact, and we don't have to muck about with the fragtree etc.
|
||||
because we know it's not in-core. If it _was_ in-core, we go through
|
||||
all the iget() crap anyway */
|
||||
|
||||
@@ -453,7 +453,7 @@ static int jffs2_garbage_collect_live(struct jffs2_sb_info *c, struct jffs2_era
|
||||
if (!ret) {
|
||||
/* Urgh. Return it sensibly. */
|
||||
frag->node->raw = f->inocache->nodes;
|
||||
}
|
||||
}
|
||||
if (ret != -EBADFD)
|
||||
goto upnout;
|
||||
}
|
||||
@@ -467,7 +467,7 @@ static int jffs2_garbage_collect_live(struct jffs2_sb_info *c, struct jffs2_era
|
||||
}
|
||||
goto upnout;
|
||||
}
|
||||
|
||||
|
||||
/* Wasn't a dnode. Try dirent */
|
||||
for (fd = f->dents; fd; fd=fd->next) {
|
||||
if (fd->raw == raw)
|
||||
@@ -494,7 +494,7 @@ static int jffs2_garbage_collect_live(struct jffs2_sb_info *c, struct jffs2_era
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int jffs2_garbage_collect_pristine(struct jffs2_sb_info *c,
|
||||
static int jffs2_garbage_collect_pristine(struct jffs2_sb_info *c,
|
||||
struct jffs2_inode_cache *ic,
|
||||
struct jffs2_raw_node_ref *raw)
|
||||
{
|
||||
@@ -580,7 +580,7 @@ static int jffs2_garbage_collect_pristine(struct jffs2_sb_info *c,
|
||||
}
|
||||
break;
|
||||
default:
|
||||
printk(KERN_WARNING "Unknown node type for REF_PRISTINE node at 0x%08x: 0x%04x\n",
|
||||
printk(KERN_WARNING "Unknown node type for REF_PRISTINE node at 0x%08x: 0x%04x\n",
|
||||
ref_offset(raw), je16_to_cpu(node->u.nodetype));
|
||||
goto bail;
|
||||
}
|
||||
@@ -621,7 +621,7 @@ static int jffs2_garbage_collect_pristine(struct jffs2_sb_info *c,
|
||||
retried = 1;
|
||||
|
||||
D1(printk(KERN_DEBUG "Retrying failed write of REF_PRISTINE node.\n"));
|
||||
|
||||
|
||||
jffs2_dbg_acct_sanity_check(c,jeb);
|
||||
jffs2_dbg_acct_paranoia_check(c, jeb);
|
||||
|
||||
@@ -669,7 +669,7 @@ static int jffs2_garbage_collect_pristine(struct jffs2_sb_info *c,
|
||||
goto out_node;
|
||||
}
|
||||
|
||||
static int jffs2_garbage_collect_metadata(struct jffs2_sb_info *c, struct jffs2_eraseblock *jeb,
|
||||
static int jffs2_garbage_collect_metadata(struct jffs2_sb_info *c, struct jffs2_eraseblock *jeb,
|
||||
struct jffs2_inode_info *f, struct jffs2_full_dnode *fn)
|
||||
{
|
||||
struct jffs2_full_dnode *new_fn;
|
||||
@@ -684,7 +684,7 @@ static int jffs2_garbage_collect_metadata(struct jffs2_sb_info *c, struct jffs2_
|
||||
S_ISCHR(JFFS2_F_I_MODE(f)) ) {
|
||||
/* For these, we don't actually need to read the old node */
|
||||
/* FIXME: for minor or major > 255. */
|
||||
dev = cpu_to_je16(((JFFS2_F_I_RDEV_MAJ(f) << 8) |
|
||||
dev = cpu_to_je16(((JFFS2_F_I_RDEV_MAJ(f) << 8) |
|
||||
JFFS2_F_I_RDEV_MIN(f)));
|
||||
mdata = (char *)&dev;
|
||||
mdatalen = sizeof(dev);
|
||||
@@ -705,7 +705,7 @@ static int jffs2_garbage_collect_metadata(struct jffs2_sb_info *c, struct jffs2_
|
||||
D1(printk(KERN_DEBUG "jffs2_garbage_collect_metadata(): Writing %d bites of symlink target\n", mdatalen));
|
||||
|
||||
}
|
||||
|
||||
|
||||
ret = jffs2_reserve_space_gc(c, sizeof(ri) + mdatalen, &phys_ofs, &alloclen,
|
||||
JFFS2_SUMMARY_INODE_SIZE);
|
||||
if (ret) {
|
||||
@@ -713,7 +713,7 @@ static int jffs2_garbage_collect_metadata(struct jffs2_sb_info *c, struct jffs2_
|
||||
sizeof(ri)+ mdatalen, ret);
|
||||
goto out;
|
||||
}
|
||||
|
||||
|
||||
last_frag = frag_last(&f->fragtree);
|
||||
if (last_frag)
|
||||
/* Fetch the inode length from the fragtree rather then
|
||||
@@ -721,7 +721,7 @@ static int jffs2_garbage_collect_metadata(struct jffs2_sb_info *c, struct jffs2_
|
||||
ilen = last_frag->ofs + last_frag->size;
|
||||
else
|
||||
ilen = JFFS2_F_I_SIZE(f);
|
||||
|
||||
|
||||
memset(&ri, 0, sizeof(ri));
|
||||
ri.magic = cpu_to_je16(JFFS2_MAGIC_BITMASK);
|
||||
ri.nodetype = cpu_to_je16(JFFS2_NODETYPE_INODE);
|
||||
@@ -760,7 +760,7 @@ static int jffs2_garbage_collect_metadata(struct jffs2_sb_info *c, struct jffs2_
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int jffs2_garbage_collect_dirent(struct jffs2_sb_info *c, struct jffs2_eraseblock *jeb,
|
||||
static int jffs2_garbage_collect_dirent(struct jffs2_sb_info *c, struct jffs2_eraseblock *jeb,
|
||||
struct jffs2_inode_info *f, struct jffs2_full_dirent *fd)
|
||||
{
|
||||
struct jffs2_full_dirent *new_fd;
|
||||
@@ -781,12 +781,12 @@ static int jffs2_garbage_collect_dirent(struct jffs2_sb_info *c, struct jffs2_er
|
||||
so refrain from splatting them. */
|
||||
if (JFFS2_F_I_MTIME(f) == JFFS2_F_I_CTIME(f))
|
||||
rd.mctime = cpu_to_je32(JFFS2_F_I_MTIME(f));
|
||||
else
|
||||
else
|
||||
rd.mctime = cpu_to_je32(0);
|
||||
rd.type = fd->type;
|
||||
rd.node_crc = cpu_to_je32(crc32(0, &rd, sizeof(rd)-8));
|
||||
rd.name_crc = cpu_to_je32(crc32(0, fd->name, rd.nsize));
|
||||
|
||||
|
||||
ret = jffs2_reserve_space_gc(c, sizeof(rd)+rd.nsize, &phys_ofs, &alloclen,
|
||||
JFFS2_SUMMARY_DIRENT_SIZE(rd.nsize));
|
||||
if (ret) {
|
||||
@@ -804,7 +804,7 @@ static int jffs2_garbage_collect_dirent(struct jffs2_sb_info *c, struct jffs2_er
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int jffs2_garbage_collect_deletion_dirent(struct jffs2_sb_info *c, struct jffs2_eraseblock *jeb,
|
||||
static int jffs2_garbage_collect_deletion_dirent(struct jffs2_sb_info *c, struct jffs2_eraseblock *jeb,
|
||||
struct jffs2_inode_info *f, struct jffs2_full_dirent *fd)
|
||||
{
|
||||
struct jffs2_full_dirent **fdp = &f->dents;
|
||||
@@ -843,7 +843,7 @@ static int jffs2_garbage_collect_deletion_dirent(struct jffs2_sb_info *c, struct
|
||||
if (ref_totlen(c, NULL, raw) != rawlen)
|
||||
continue;
|
||||
|
||||
/* Doesn't matter if there's one in the same erase block. We're going to
|
||||
/* Doesn't matter if there's one in the same erase block. We're going to
|
||||
delete it too at the same time. */
|
||||
if (SECTOR_ADDR(raw->flash_offset) == SECTOR_ADDR(fd->raw->flash_offset))
|
||||
continue;
|
||||
@@ -895,7 +895,7 @@ static int jffs2_garbage_collect_deletion_dirent(struct jffs2_sb_info *c, struct
|
||||
kfree(rd);
|
||||
}
|
||||
|
||||
/* FIXME: If we're deleting a dirent which contains the current mtime and ctime,
|
||||
/* FIXME: If we're deleting a dirent which contains the current mtime and ctime,
|
||||
we should update the metadata node with those times accordingly */
|
||||
|
||||
/* No need for it any more. Just mark it obsolete and remove it from the list */
|
||||
@@ -927,13 +927,13 @@ static int jffs2_garbage_collect_hole(struct jffs2_sb_info *c, struct jffs2_eras
|
||||
|
||||
D1(printk(KERN_DEBUG "Writing replacement hole node for ino #%u from offset 0x%x to 0x%x\n",
|
||||
f->inocache->ino, start, end));
|
||||
|
||||
|
||||
memset(&ri, 0, sizeof(ri));
|
||||
|
||||
if(fn->frags > 1) {
|
||||
size_t readlen;
|
||||
uint32_t crc;
|
||||
/* It's partially obsoleted by a later write. So we have to
|
||||
/* It's partially obsoleted by a later write. So we have to
|
||||
write it out again with the _same_ version as before */
|
||||
ret = jffs2_flash_read(c, ref_offset(fn->raw), sizeof(ri), &readlen, (char *)&ri);
|
||||
if (readlen != sizeof(ri) || ret) {
|
||||
@@ -955,16 +955,16 @@ static int jffs2_garbage_collect_hole(struct jffs2_sb_info *c, struct jffs2_eras
|
||||
crc = crc32(0, &ri, sizeof(ri)-8);
|
||||
if (crc != je32_to_cpu(ri.node_crc)) {
|
||||
printk(KERN_WARNING "jffs2_garbage_collect_hole: Node at 0x%08x had CRC 0x%08x which doesn't match calculated CRC 0x%08x\n",
|
||||
ref_offset(fn->raw),
|
||||
ref_offset(fn->raw),
|
||||
je32_to_cpu(ri.node_crc), crc);
|
||||
/* FIXME: We could possibly deal with this by writing new holes for each frag */
|
||||
printk(KERN_WARNING "Data in the range 0x%08x to 0x%08x of inode #%u will be lost\n",
|
||||
printk(KERN_WARNING "Data in the range 0x%08x to 0x%08x of inode #%u will be lost\n",
|
||||
start, end, f->inocache->ino);
|
||||
goto fill;
|
||||
}
|
||||
if (ri.compr != JFFS2_COMPR_ZERO) {
|
||||
printk(KERN_WARNING "jffs2_garbage_collect_hole: Node 0x%08x wasn't a hole node!\n", ref_offset(fn->raw));
|
||||
printk(KERN_WARNING "Data in the range 0x%08x to 0x%08x of inode #%u will be lost\n",
|
||||
printk(KERN_WARNING "Data in the range 0x%08x to 0x%08x of inode #%u will be lost\n",
|
||||
start, end, f->inocache->ino);
|
||||
goto fill;
|
||||
}
|
||||
@@ -982,7 +982,7 @@ static int jffs2_garbage_collect_hole(struct jffs2_sb_info *c, struct jffs2_eras
|
||||
ri.csize = cpu_to_je32(0);
|
||||
ri.compr = JFFS2_COMPR_ZERO;
|
||||
}
|
||||
|
||||
|
||||
frag = frag_last(&f->fragtree);
|
||||
if (frag)
|
||||
/* Fetch the inode length from the fragtree rather then
|
||||
@@ -1024,10 +1024,10 @@ static int jffs2_garbage_collect_hole(struct jffs2_sb_info *c, struct jffs2_eras
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
/*
|
||||
* We should only get here in the case where the node we are
|
||||
* replacing had more than one frag, so we kept the same version
|
||||
* number as before. (Except in case of error -- see 'goto fill;'
|
||||
* number as before. (Except in case of error -- see 'goto fill;'
|
||||
* above.)
|
||||
*/
|
||||
D1(if(unlikely(fn->frags <= 1)) {
|
||||
@@ -1039,7 +1039,7 @@ static int jffs2_garbage_collect_hole(struct jffs2_sb_info *c, struct jffs2_eras
|
||||
/* This is a partially-overlapped hole node. Mark it REF_NORMAL not REF_PRISTINE */
|
||||
mark_ref_normal(new_fn->raw);
|
||||
|
||||
for (frag = jffs2_lookup_node_frag(&f->fragtree, fn->ofs);
|
||||
for (frag = jffs2_lookup_node_frag(&f->fragtree, fn->ofs);
|
||||
frag; frag = frag_next(frag)) {
|
||||
if (frag->ofs > fn->size + fn->ofs)
|
||||
break;
|
||||
@@ -1057,10 +1057,10 @@ static int jffs2_garbage_collect_hole(struct jffs2_sb_info *c, struct jffs2_eras
|
||||
printk(KERN_WARNING "jffs2_garbage_collect_hole: New node has no frags!\n");
|
||||
BUG();
|
||||
}
|
||||
|
||||
|
||||
jffs2_mark_node_obsolete(c, fn->raw);
|
||||
jffs2_free_full_dnode(fn);
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -1070,12 +1070,12 @@ static int jffs2_garbage_collect_dnode(struct jffs2_sb_info *c, struct jffs2_era
|
||||
{
|
||||
struct jffs2_full_dnode *new_fn;
|
||||
struct jffs2_raw_inode ri;
|
||||
uint32_t alloclen, phys_ofs, offset, orig_end, orig_start;
|
||||
uint32_t alloclen, phys_ofs, offset, orig_end, orig_start;
|
||||
int ret = 0;
|
||||
unsigned char *comprbuf = NULL, *writebuf;
|
||||
unsigned long pg;
|
||||
unsigned char *pg_ptr;
|
||||
|
||||
|
||||
memset(&ri, 0, sizeof(ri));
|
||||
|
||||
D1(printk(KERN_DEBUG "Writing replacement dnode for ino #%u from offset 0x%x to 0x%x\n",
|
||||
@@ -1087,8 +1087,8 @@ static int jffs2_garbage_collect_dnode(struct jffs2_sb_info *c, struct jffs2_era
|
||||
if (c->nr_free_blocks + c->nr_erasing_blocks > c->resv_blocks_gcmerge) {
|
||||
/* Attempt to do some merging. But only expand to cover logically
|
||||
adjacent frags if the block containing them is already considered
|
||||
to be dirty. Otherwise we end up with GC just going round in
|
||||
circles dirtying the nodes it already wrote out, especially
|
||||
to be dirty. Otherwise we end up with GC just going round in
|
||||
circles dirtying the nodes it already wrote out, especially
|
||||
on NAND where we have small eraseblocks and hence a much higher
|
||||
chance of nodes having to be split to cross boundaries. */
|
||||
|
||||
@@ -1122,7 +1122,7 @@ static int jffs2_garbage_collect_dnode(struct jffs2_sb_info *c, struct jffs2_era
|
||||
break;
|
||||
} else {
|
||||
|
||||
/* OK, it's a frag which extends to the beginning of the page. Does it live
|
||||
/* OK, it's a frag which extends to the beginning of the page. Does it live
|
||||
in a block which is still considered clean? If so, don't obsolete it.
|
||||
If not, cover it anyway. */
|
||||
|
||||
@@ -1172,7 +1172,7 @@ static int jffs2_garbage_collect_dnode(struct jffs2_sb_info *c, struct jffs2_era
|
||||
break;
|
||||
} else {
|
||||
|
||||
/* OK, it's a frag which extends to the beginning of the page. Does it live
|
||||
/* OK, it's a frag which extends to the beginning of the page. Does it live
|
||||
in a block which is still considered clean? If so, don't obsolete it.
|
||||
If not, cover it anyway. */
|
||||
|
||||
@@ -1199,14 +1199,14 @@ static int jffs2_garbage_collect_dnode(struct jffs2_sb_info *c, struct jffs2_era
|
||||
break;
|
||||
}
|
||||
}
|
||||
D1(printk(KERN_DEBUG "Expanded dnode to write from (0x%x-0x%x) to (0x%x-0x%x)\n",
|
||||
D1(printk(KERN_DEBUG "Expanded dnode to write from (0x%x-0x%x) to (0x%x-0x%x)\n",
|
||||
orig_start, orig_end, start, end));
|
||||
|
||||
D1(BUG_ON(end > frag_last(&f->fragtree)->ofs + frag_last(&f->fragtree)->size));
|
||||
BUG_ON(end < orig_end);
|
||||
BUG_ON(start > orig_start);
|
||||
}
|
||||
|
||||
|
||||
/* First, use readpage() to read the appropriate page into the page cache */
|
||||
/* Q: What happens if we actually try to GC the _same_ page for which commit_write()
|
||||
* triggered garbage collection in the first place?
|
||||
@@ -1263,7 +1263,7 @@ static int jffs2_garbage_collect_dnode(struct jffs2_sb_info *c, struct jffs2_era
|
||||
ri.usercompr = (comprtype >> 8) & 0xff;
|
||||
ri.node_crc = cpu_to_je32(crc32(0, &ri, sizeof(ri)-8));
|
||||
ri.data_crc = cpu_to_je32(crc32(0, comprbuf, cdatalen));
|
||||
|
||||
|
||||
new_fn = jffs2_write_dnode(c, f, &ri, comprbuf, cdatalen, phys_ofs, ALLOC_GC);
|
||||
|
||||
jffs2_free_comprbuf(comprbuf, writebuf);
|
||||
|
||||
+1
-1
@@ -1,3 +1,3 @@
|
||||
/* This file provides the bit-probabilities for the input file */
|
||||
#define BIT_DIVIDER 629
|
||||
#define BIT_DIVIDER 629
|
||||
static int bits[9] = { 179,167,183,165,159,198,178,119,}; /* ia32 .so files */
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
#define BIT_DIVIDER_MIPS 1043
|
||||
#define BIT_DIVIDER_MIPS 1043
|
||||
static int bits_mips[8] = { 277,249,290,267,229,341,212,241}; /* mips32 */
|
||||
|
||||
+3
-3
@@ -7,17 +7,17 @@
|
||||
*
|
||||
* For licensing information, see the file 'LICENCE' in this directory.
|
||||
*
|
||||
* $Id: ioctl.c,v 1.9 2004/11/16 20:36:11 dwmw2 Exp $
|
||||
* $Id: ioctl.c,v 1.10 2005/11/07 11:14:40 gleixner Exp $
|
||||
*
|
||||
*/
|
||||
|
||||
#include <linux/fs.h>
|
||||
|
||||
int jffs2_ioctl(struct inode *inode, struct file *filp, unsigned int cmd,
|
||||
int jffs2_ioctl(struct inode *inode, struct file *filp, unsigned int cmd,
|
||||
unsigned long arg)
|
||||
{
|
||||
/* Later, this will provide for lsattr.jffs2 and chattr.jffs2, which
|
||||
will include compression support etc. */
|
||||
return -ENOTTY;
|
||||
}
|
||||
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user