aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ubifs/sb.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2012-05-22 22:30:27 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2012-05-22 22:30:27 -0400
commit6133308ad1a386e7e7f776003a1c44e8b54e2166 (patch)
treeb2102f3bd3b25e0f105cd91b6a22bd96a351c5d7 /fs/ubifs/sb.c
parente8650a08232e75274304b812ff04cfce9af9671c (diff)
parent62f384552b6756cf1ea71f8762d1e97dc77dbd90 (diff)
Merge tag 'upstream-3.5-rc1' of git://git.infradead.org/linux-ubifs
Pull UBI and UBIFS updates from Artem Bityutskiy: UBIFS: * Always support xattrs (remove the Kconfig option) * Always support debugging (remove the Kconfig option) * A fix for a memory leak on error path * A number of clean-ups UBI: * Always support debugging (remove the Kconfig option) * Remove "data type" hint support * Huge amount of renames to prepare for the fastmap wor * A lot of clean-ups * tag 'upstream-3.5-rc1' of git://git.infradead.org/linux-ubifs: (54 commits) UBI: modify ubi_wl_flush function to clear work queue for a lnum UBI: introduce UBI_ALL constant UBI: add lnum and vol_id to struct ubi_work UBI: add volume id struct ubi_ainf_peb UBI: add in hex the value for UBI_INTERNAL_VOL_START to comment UBI: rename scan.c to attach.c UBI: remove scan.h UBI: rename UBI_SCAN_UNKNOWN_EC UBI: move and rename attach_by_scanning UBI: rename _init_scan functions UBI: amend comments after all the renamings UBI: rename ubi_scan_leb_slab UBI: rename ubi_scan_move_to_list UBI: rename ubi_scan_destroy_ai UBI: rename ubi_scan_get_free_peb UBI: rename ubi_scan_rm_volume UBI: rename ubi_scan_find_av UBI: rename ubi_scan_add_used UBI: remove unused function UBI: make ubi_scan_erase_peb static and rename ...
Diffstat (limited to 'fs/ubifs/sb.c')
-rw-r--r--fs/ubifs/sb.c26
1 files changed, 10 insertions, 16 deletions
diff --git a/fs/ubifs/sb.c b/fs/ubifs/sb.c
index 771f7fb6ce92..ef3d1ba6d992 100644
--- a/fs/ubifs/sb.c
+++ b/fs/ubifs/sb.c
@@ -130,7 +130,6 @@ static int create_default_filesystem(struct ubifs_info *c)
130 * orphan node. 130 * orphan node.
131 */ 131 */
132 orph_lebs = UBIFS_MIN_ORPH_LEBS; 132 orph_lebs = UBIFS_MIN_ORPH_LEBS;
133#ifdef CONFIG_UBIFS_FS_DEBUG
134 if (c->leb_cnt - min_leb_cnt > 1) 133 if (c->leb_cnt - min_leb_cnt > 1)
135 /* 134 /*
136 * For debugging purposes it is better to have at least 2 135 * For debugging purposes it is better to have at least 2
@@ -138,7 +137,6 @@ static int create_default_filesystem(struct ubifs_info *c)
138 * consolidations and would be stressed more. 137 * consolidations and would be stressed more.
139 */ 138 */
140 orph_lebs += 1; 139 orph_lebs += 1;
141#endif
142 140
143 main_lebs = c->leb_cnt - UBIFS_SB_LEBS - UBIFS_MST_LEBS - log_lebs; 141 main_lebs = c->leb_cnt - UBIFS_SB_LEBS - UBIFS_MST_LEBS - log_lebs;
144 main_lebs -= orph_lebs; 142 main_lebs -= orph_lebs;
@@ -196,7 +194,7 @@ static int create_default_filesystem(struct ubifs_info *c)
196 sup->rp_size = cpu_to_le64(tmp64); 194 sup->rp_size = cpu_to_le64(tmp64);
197 sup->ro_compat_version = cpu_to_le32(UBIFS_RO_COMPAT_VERSION); 195 sup->ro_compat_version = cpu_to_le32(UBIFS_RO_COMPAT_VERSION);
198 196
199 err = ubifs_write_node(c, sup, UBIFS_SB_NODE_SZ, 0, 0, UBI_LONGTERM); 197 err = ubifs_write_node(c, sup, UBIFS_SB_NODE_SZ, 0, 0);
200 kfree(sup); 198 kfree(sup);
201 if (err) 199 if (err)
202 return err; 200 return err;
@@ -252,14 +250,13 @@ static int create_default_filesystem(struct ubifs_info *c)
252 250
253 mst->total_used = cpu_to_le64(UBIFS_INO_NODE_SZ); 251 mst->total_used = cpu_to_le64(UBIFS_INO_NODE_SZ);
254 252
255 err = ubifs_write_node(c, mst, UBIFS_MST_NODE_SZ, UBIFS_MST_LNUM, 0, 253 err = ubifs_write_node(c, mst, UBIFS_MST_NODE_SZ, UBIFS_MST_LNUM, 0);
256 UBI_UNKNOWN);
257 if (err) { 254 if (err) {
258 kfree(mst); 255 kfree(mst);
259 return err; 256 return err;
260 } 257 }
261 err = ubifs_write_node(c, mst, UBIFS_MST_NODE_SZ, UBIFS_MST_LNUM + 1, 0, 258 err = ubifs_write_node(c, mst, UBIFS_MST_NODE_SZ, UBIFS_MST_LNUM + 1,
262 UBI_UNKNOWN); 259 0);
263 kfree(mst); 260 kfree(mst);
264 if (err) 261 if (err)
265 return err; 262 return err;
@@ -282,8 +279,7 @@ static int create_default_filesystem(struct ubifs_info *c)
282 key_write_idx(c, &key, &br->key); 279 key_write_idx(c, &key, &br->key);
283 br->lnum = cpu_to_le32(main_first + DEFAULT_DATA_LEB); 280 br->lnum = cpu_to_le32(main_first + DEFAULT_DATA_LEB);
284 br->len = cpu_to_le32(UBIFS_INO_NODE_SZ); 281 br->len = cpu_to_le32(UBIFS_INO_NODE_SZ);
285 err = ubifs_write_node(c, idx, tmp, main_first + DEFAULT_IDX_LEB, 0, 282 err = ubifs_write_node(c, idx, tmp, main_first + DEFAULT_IDX_LEB, 0);
286 UBI_UNKNOWN);
287 kfree(idx); 283 kfree(idx);
288 if (err) 284 if (err)
289 return err; 285 return err;
@@ -315,8 +311,7 @@ static int create_default_filesystem(struct ubifs_info *c)
315 ino->flags = cpu_to_le32(UBIFS_COMPR_FL); 311 ino->flags = cpu_to_le32(UBIFS_COMPR_FL);
316 312
317 err = ubifs_write_node(c, ino, UBIFS_INO_NODE_SZ, 313 err = ubifs_write_node(c, ino, UBIFS_INO_NODE_SZ,
318 main_first + DEFAULT_DATA_LEB, 0, 314 main_first + DEFAULT_DATA_LEB, 0);
319 UBI_UNKNOWN);
320 kfree(ino); 315 kfree(ino);
321 if (err) 316 if (err)
322 return err; 317 return err;
@@ -335,8 +330,7 @@ static int create_default_filesystem(struct ubifs_info *c)
335 return -ENOMEM; 330 return -ENOMEM;
336 331
337 cs->ch.node_type = UBIFS_CS_NODE; 332 cs->ch.node_type = UBIFS_CS_NODE;
338 err = ubifs_write_node(c, cs, UBIFS_CS_NODE_SZ, UBIFS_LOG_LNUM, 333 err = ubifs_write_node(c, cs, UBIFS_CS_NODE_SZ, UBIFS_LOG_LNUM, 0);
339 0, UBI_UNKNOWN);
340 kfree(cs); 334 kfree(cs);
341 335
342 ubifs_msg("default file-system created"); 336 ubifs_msg("default file-system created");
@@ -475,7 +469,7 @@ static int validate_sb(struct ubifs_info *c, struct ubifs_sb_node *sup)
475 469
476failed: 470failed:
477 ubifs_err("bad superblock, error %d", err); 471 ubifs_err("bad superblock, error %d", err);
478 dbg_dump_node(c, sup); 472 ubifs_dump_node(c, sup);
479 return -EINVAL; 473 return -EINVAL;
480} 474}
481 475
@@ -518,7 +512,7 @@ int ubifs_write_sb_node(struct ubifs_info *c, struct ubifs_sb_node *sup)
518 int len = ALIGN(UBIFS_SB_NODE_SZ, c->min_io_size); 512 int len = ALIGN(UBIFS_SB_NODE_SZ, c->min_io_size);
519 513
520 ubifs_prepare_node(c, sup, UBIFS_SB_NODE_SZ, 1); 514 ubifs_prepare_node(c, sup, UBIFS_SB_NODE_SZ, 1);
521 return ubifs_leb_change(c, UBIFS_SB_LNUM, sup, len, UBI_LONGTERM); 515 return ubifs_leb_change(c, UBIFS_SB_LNUM, sup, len);
522} 516}
523 517
524/** 518/**
@@ -691,7 +685,7 @@ static int fixup_leb(struct ubifs_info *c, int lnum, int len)
691 if (err) 685 if (err)
692 return err; 686 return err;
693 687
694 return ubifs_leb_change(c, lnum, c->sbuf, len, UBI_UNKNOWN); 688 return ubifs_leb_change(c, lnum, c->sbuf, len);
695} 689}
696 690
697/** 691/**