Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge git://git.infradead.org/mtd-2.6

* git://git.infradead.org/mtd-2.6:
[MTD][NOR] Add physical address to point() method
[JFFS2] Track parent inode for directories (for NFS export)
[JFFS2] Invert last argument of jffs2_gc_fetch_inode(), make it boolean.
[JFFS2] Quiet lockdep false positive.
[JFFS2] Clean up jffs2_alloc_inode() and jffs2_i_init_once()
[MTD] Delete long-unused jedec.h header file.
[MTD] [NAND] at91_nand: use at91_nand_{en,dis}able consistently.

+193 -196
+8 -6
drivers/mtd/chips/cfi_cmdset_0001.c
··· 82 82 static int cfi_intelext_partition_fixup(struct mtd_info *, struct cfi_private **); 83 83 84 84 static int cfi_intelext_point (struct mtd_info *mtd, loff_t from, size_t len, 85 - size_t *retlen, u_char **mtdbuf); 86 - static void cfi_intelext_unpoint (struct mtd_info *mtd, u_char *addr, loff_t from, 87 - size_t len); 85 + size_t *retlen, void **virt, resource_size_t *phys); 86 + static void cfi_intelext_unpoint(struct mtd_info *mtd, loff_t from, size_t len); 88 87 89 88 static int chip_ready (struct map_info *map, struct flchip *chip, unsigned long adr, int mode); 90 89 static int get_chip(struct map_info *map, struct flchip *chip, unsigned long adr, int mode); ··· 1239 1240 return ret; 1240 1241 } 1241 1242 1242 - static int cfi_intelext_point (struct mtd_info *mtd, loff_t from, size_t len, size_t *retlen, u_char **mtdbuf) 1243 + static int cfi_intelext_point(struct mtd_info *mtd, loff_t from, size_t len, 1244 + size_t *retlen, void **virt, resource_size_t *phys) 1243 1245 { 1244 1246 struct map_info *map = mtd->priv; 1245 1247 struct cfi_private *cfi = map->fldrv_priv; ··· 1257 1257 chipnum = (from >> cfi->chipshift); 1258 1258 ofs = from - (chipnum << cfi->chipshift); 1259 1259 1260 - *mtdbuf = (void *)map->virt + cfi->chips[chipnum].start + ofs; 1260 + *virt = map->virt + cfi->chips[chipnum].start + ofs; 1261 1261 *retlen = 0; 1262 + if (phys) 1263 + *phys = map->phys + cfi->chips[chipnum].start + ofs; 1262 1264 1263 1265 while (len) { 1264 1266 unsigned long thislen; ··· 1293 1291 return 0; 1294 1292 } 1295 1293 1296 - static void cfi_intelext_unpoint (struct mtd_info *mtd, u_char *addr, loff_t from, size_t len) 1294 + static void cfi_intelext_unpoint(struct mtd_info *mtd, loff_t from, size_t len) 1297 1295 { 1298 1296 struct map_info *map = mtd->priv; 1299 1297 struct cfi_private *cfi = map->fldrv_priv;
+7 -4
drivers/mtd/devices/mtdram.c
··· 48 48 } 49 49 50 50 static int ram_point(struct mtd_info *mtd, loff_t from, size_t len, 51 - size_t *retlen, u_char **mtdbuf) 51 + size_t *retlen, void **virt, resource_size_t *phys) 52 52 { 53 53 if (from + len > mtd->size) 54 54 return -EINVAL; 55 55 56 - *mtdbuf = mtd->priv + from; 56 + /* can we return a physical address with this driver? */ 57 + if (phys) 58 + return -EINVAL; 59 + 60 + *virt = mtd->priv + from; 57 61 *retlen = len; 58 62 return 0; 59 63 } 60 64 61 - static void ram_unpoint(struct mtd_info *mtd, u_char * addr, loff_t from, 62 - size_t len) 65 + static void ram_unpoint(struct mtd_info *mtd, loff_t from, size_t len) 63 66 { 64 67 } 65 68
+7 -6
drivers/mtd/devices/phram.c
··· 57 57 } 58 58 59 59 static int phram_point(struct mtd_info *mtd, loff_t from, size_t len, 60 - size_t *retlen, u_char **mtdbuf) 60 + size_t *retlen, void **virt, resource_size_t *phys) 61 61 { 62 - u_char *start = mtd->priv; 63 - 64 62 if (from + len > mtd->size) 65 63 return -EINVAL; 66 64 67 - *mtdbuf = start + from; 65 + /* can we return a physical address with this driver? */ 66 + if (phys) 67 + return -EINVAL; 68 + 69 + *virt = mtd->priv + from; 68 70 *retlen = len; 69 71 return 0; 70 72 } 71 73 72 - static void phram_unpoint(struct mtd_info *mtd, u_char *addr, loff_t from, 73 - size_t len) 74 + static void phram_unpoint(struct mtd_info *mtd, loff_t from, size_t len) 74 75 { 75 76 } 76 77
+17 -10
drivers/mtd/devices/pmc551.c
··· 134 134 eoff_lo = end & (priv->asize - 1); 135 135 soff_lo = instr->addr & (priv->asize - 1); 136 136 137 - pmc551_point(mtd, instr->addr, instr->len, &retlen, &ptr); 137 + pmc551_point(mtd, instr->addr, instr->len, &retlen, 138 + (void **)&ptr, NULL); 138 139 139 140 if (soff_hi == eoff_hi || mtd->size == priv->asize) { 140 141 /* The whole thing fits within one access, so just one shot ··· 155 154 } 156 155 soff_hi += priv->asize; 157 156 pmc551_point(mtd, (priv->base_map0 | soff_hi), 158 - priv->asize, &retlen, &ptr); 157 + priv->asize, &retlen, 158 + (void **)&ptr, NULL); 159 159 } 160 160 memset(ptr, 0xff, eoff_lo); 161 161 } ··· 172 170 } 173 171 174 172 static int pmc551_point(struct mtd_info *mtd, loff_t from, size_t len, 175 - size_t * retlen, u_char ** mtdbuf) 173 + size_t *retlen, void **virt, resource_size_t *phys) 176 174 { 177 175 struct mypriv *priv = mtd->priv; 178 176 u32 soff_hi; ··· 190 188 return -EINVAL; 191 189 } 192 190 191 + /* can we return a physical address with this driver? */ 192 + if (phys) 193 + return -EINVAL; 194 + 193 195 soff_hi = from & ~(priv->asize - 1); 194 196 soff_lo = from & (priv->asize - 1); 195 197 ··· 204 198 priv->curr_map0 = soff_hi; 205 199 } 206 200 207 - *mtdbuf = priv->start + soff_lo; 201 + *virt = priv->start + soff_lo; 208 202 *retlen = len; 209 203 return 0; 210 204 } 211 205 212 - static void pmc551_unpoint(struct mtd_info *mtd, u_char * addr, loff_t from, 213 - size_t len) 206 + static void pmc551_unpoint(struct mtd_info *mtd, loff_t from, size_t len) 214 207 { 215 208 #ifdef CONFIG_MTD_PMC551_DEBUG 216 209 printk(KERN_DEBUG "pmc551_unpoint()\n"); ··· 247 242 soff_lo = from & (priv->asize - 1); 248 243 eoff_lo = end & (priv->asize - 1); 249 244 250 - pmc551_point(mtd, from, len, retlen, &ptr); 245 + pmc551_point(mtd, from, len, retlen, (void **)&ptr, NULL); 251 246 252 247 if (soff_hi == eoff_hi) { 253 248 /* The whole thing fits within one access, so just one shot ··· 268 263 goto out; 269 264 } 270 265 soff_hi += priv->asize; 271 - pmc551_point(mtd, soff_hi, priv->asize, retlen, &ptr); 266 + pmc551_point(mtd, soff_hi, priv->asize, retlen, 267 + (void **)&ptr, NULL); 272 268 } 273 269 memcpy(copyto, ptr, eoff_lo); 274 270 copyto += eoff_lo; ··· 314 308 soff_lo = to & (priv->asize - 1); 315 309 eoff_lo = end & (priv->asize - 1); 316 310 317 - pmc551_point(mtd, to, len, retlen, &ptr); 311 + pmc551_point(mtd, to, len, retlen, (void **)&ptr, NULL); 318 312 319 313 if (soff_hi == eoff_hi) { 320 314 /* The whole thing fits within one access, so just one shot ··· 335 329 goto out; 336 330 } 337 331 soff_hi += priv->asize; 338 - pmc551_point(mtd, soff_hi, priv->asize, retlen, &ptr); 332 + pmc551_point(mtd, soff_hi, priv->asize, retlen, 333 + (void **)&ptr, NULL); 339 334 } 340 335 memcpy(ptr, copyfrom, eoff_lo); 341 336 copyfrom += eoff_lo;
+10 -5
drivers/mtd/devices/slram.c
··· 76 76 static slram_mtd_list_t *slram_mtdlist = NULL; 77 77 78 78 static int slram_erase(struct mtd_info *, struct erase_info *); 79 - static int slram_point(struct mtd_info *, loff_t, size_t, size_t *, u_char **); 80 - static void slram_unpoint(struct mtd_info *, u_char *, loff_t, size_t); 79 + static int slram_point(struct mtd_info *, loff_t, size_t, size_t *, void **, 80 + resource_size_t *); 81 + static void slram_unpoint(struct mtd_info *, loff_t, size_t); 81 82 static int slram_read(struct mtd_info *, loff_t, size_t, size_t *, u_char *); 82 83 static int slram_write(struct mtd_info *, loff_t, size_t, size_t *, const u_char *); 83 84 ··· 105 104 } 106 105 107 106 static int slram_point(struct mtd_info *mtd, loff_t from, size_t len, 108 - size_t *retlen, u_char **mtdbuf) 107 + size_t *retlen, void **virt, resource_size_t *phys) 109 108 { 110 109 slram_priv_t *priv = mtd->priv; 110 + 111 + /* can we return a physical address with this driver? */ 112 + if (phys) 113 + return -EINVAL; 111 114 112 115 if (from + len > mtd->size) 113 116 return -EINVAL; 114 117 115 - *mtdbuf = priv->start + from; 118 + *virt = priv->start + from; 116 119 *retlen = len; 117 120 return(0); 118 121 } 119 122 120 - static void slram_unpoint(struct mtd_info *mtd, u_char *addr, loff_t from, size_t len) 123 + static void slram_unpoint(struct mtd_info *mtd, loff_t from, size_t len) 121 124 { 122 125 } 123 126
+4 -2
drivers/mtd/maps/uclinux.c
··· 40 40 /****************************************************************************/ 41 41 42 42 int uclinux_point(struct mtd_info *mtd, loff_t from, size_t len, 43 - size_t *retlen, u_char **mtdbuf) 43 + size_t *retlen, void **virt, resource_size_t *phys) 44 44 { 45 45 struct map_info *map = mtd->priv; 46 - *mtdbuf = (u_char *) (map->virt + ((int) from)); 46 + *virt = map->virt + from; 47 + if (phys) 48 + *phys = map->phys + from; 47 49 *retlen = len; 48 50 return(0); 49 51 }
+4 -4
drivers/mtd/mtdpart.c
··· 68 68 } 69 69 70 70 static int part_point (struct mtd_info *mtd, loff_t from, size_t len, 71 - size_t *retlen, u_char **buf) 71 + size_t *retlen, void **virt, resource_size_t *phys) 72 72 { 73 73 struct mtd_part *part = PART(mtd); 74 74 if (from >= mtd->size) ··· 76 76 else if (from + len > mtd->size) 77 77 len = mtd->size - from; 78 78 return part->master->point (part->master, from + part->offset, 79 - len, retlen, buf); 79 + len, retlen, virt, phys); 80 80 } 81 81 82 - static void part_unpoint (struct mtd_info *mtd, u_char *addr, loff_t from, size_t len) 82 + static void part_unpoint(struct mtd_info *mtd, loff_t from, size_t len) 83 83 { 84 84 struct mtd_part *part = PART(mtd); 85 85 86 - part->master->unpoint (part->master, addr, from + part->offset, len); 86 + part->master->unpoint(part->master, from + part->offset, len); 87 87 } 88 88 89 89 static int part_read_oob(struct mtd_info *mtd, loff_t from,
+21 -21
drivers/mtd/nand/at91_nand.c
··· 94 94 }; 95 95 96 96 /* 97 + * Enable NAND. 98 + */ 99 + static void at91_nand_enable(struct at91_nand_host *host) 100 + { 101 + if (host->board->enable_pin) 102 + at91_set_gpio_value(host->board->enable_pin, 0); 103 + } 104 + 105 + /* 106 + * Disable NAND. 107 + */ 108 + static void at91_nand_disable(struct at91_nand_host *host) 109 + { 110 + if (host->board->enable_pin) 111 + at91_set_gpio_value(host->board->enable_pin, 1); 112 + } 113 + 114 + /* 97 115 * Hardware specific access to control-lines 98 116 */ 99 117 static void at91_nand_cmd_ctrl(struct mtd_info *mtd, int cmd, unsigned int ctrl) ··· 119 101 struct nand_chip *nand_chip = mtd->priv; 120 102 struct at91_nand_host *host = nand_chip->priv; 121 103 122 - if (host->board->enable_pin && (ctrl & NAND_CTRL_CHANGE)) { 104 + if (ctrl & NAND_CTRL_CHANGE) { 123 105 if (ctrl & NAND_NCE) 124 - at91_set_gpio_value(host->board->enable_pin, 0); 106 + at91_nand_enable(host); 125 107 else 126 - at91_set_gpio_value(host->board->enable_pin, 1); 108 + at91_nand_disable(host); 127 109 } 128 110 if (cmd == NAND_CMD_NONE) 129 111 return; ··· 143 125 struct at91_nand_host *host = nand_chip->priv; 144 126 145 127 return at91_get_gpio_value(host->board->rdy_pin); 146 - } 147 - 148 - /* 149 - * Enable NAND. 150 - */ 151 - static void at91_nand_enable(struct at91_nand_host *host) 152 - { 153 - if (host->board->enable_pin) 154 - at91_set_gpio_value(host->board->enable_pin, 0); 155 - } 156 - 157 - /* 158 - * Disable NAND. 159 - */ 160 - static void at91_nand_disable(struct at91_nand_host *host) 161 - { 162 - if (host->board->enable_pin) 163 - at91_set_gpio_value(host->board->enable_pin, 1); 164 128 } 165 129 166 130 /*
+20 -11
fs/jffs2/build.c
··· 46 46 47 47 48 48 static void jffs2_build_inode_pass1(struct jffs2_sb_info *c, 49 - struct jffs2_inode_cache *ic) 49 + struct jffs2_inode_cache *ic) 50 50 { 51 51 struct jffs2_full_dirent *fd; 52 52 ··· 68 68 continue; 69 69 } 70 70 71 - if (child_ic->nlink++ && fd->type == DT_DIR) { 72 - JFFS2_ERROR("child dir \"%s\" (ino #%u) of dir ino #%u appears to be a hard link\n", 73 - fd->name, fd->ino, ic->ino); 74 - /* TODO: What do we do about it? */ 75 - } 71 + if (fd->type == DT_DIR) { 72 + if (child_ic->pino_nlink) { 73 + JFFS2_ERROR("child dir \"%s\" (ino #%u) of dir ino #%u appears to be a hard link\n", 74 + fd->name, fd->ino, ic->ino); 75 + /* TODO: What do we do about it? */ 76 + } else { 77 + child_ic->pino_nlink = ic->ino; 78 + } 79 + } else 80 + child_ic->pino_nlink++; 81 + 76 82 dbg_fsbuild("increased nlink for child \"%s\" (ino #%u)\n", fd->name, fd->ino); 77 83 /* Can't free scan_dents so far. We might need them in pass 2 */ 78 84 } ··· 131 125 dbg_fsbuild("pass 2 starting\n"); 132 126 133 127 for_each_inode(i, c, ic) { 134 - if (ic->nlink) 128 + if (ic->pino_nlink) 135 129 continue; 136 130 137 131 jffs2_build_remove_unlinked_inode(c, ic, &dead_fds); ··· 238 232 /* Reduce nlink of the child. If it's now zero, stick it on the 239 233 dead_fds list to be cleaned up later. Else just free the fd */ 240 234 241 - child_ic->nlink--; 235 + if (fd->type == DT_DIR) 236 + child_ic->pino_nlink = 0; 237 + else 238 + child_ic->pino_nlink--; 242 239 243 - if (!child_ic->nlink) { 244 - dbg_fsbuild("inode #%u (\"%s\") has now got zero nlink, adding to dead_fds list.\n", 240 + if (!child_ic->pino_nlink) { 241 + dbg_fsbuild("inode #%u (\"%s\") now has no links; adding to dead_fds list.\n", 245 242 fd->ino, fd->name); 246 243 fd->next = *dead_fds; 247 244 *dead_fds = fd; 248 245 } else { 249 246 dbg_fsbuild("inode #%u (\"%s\") has now got nlink %d. Ignoring.\n", 250 - fd->ino, fd->name, child_ic->nlink); 247 + fd->ino, fd->name, child_ic->pino_nlink); 251 248 jffs2_free_full_dirent(fd); 252 249 } 253 250 }
+32 -10
fs/jffs2/dir.c
··· 208 208 f = JFFS2_INODE_INFO(inode); 209 209 dir_f = JFFS2_INODE_INFO(dir_i); 210 210 211 + /* jffs2_do_create() will want to lock it, _after_ reserving 212 + space and taking c-alloc_sem. If we keep it locked here, 213 + lockdep gets unhappy (although it's a false positive; 214 + nothing else will be looking at this inode yet so there's 215 + no chance of AB-BA deadlock involving its f->sem). */ 216 + mutex_unlock(&f->sem); 217 + 211 218 ret = jffs2_do_create(c, dir_f, f, ri, 212 219 dentry->d_name.name, dentry->d_name.len); 213 220 if (ret) ··· 226 219 d_instantiate(dentry, inode); 227 220 228 221 D1(printk(KERN_DEBUG "jffs2_create: Created ino #%lu with mode %o, nlink %d(%d). nrpages %ld\n", 229 - inode->i_ino, inode->i_mode, inode->i_nlink, f->inocache->nlink, inode->i_mapping->nrpages)); 222 + inode->i_ino, inode->i_mode, inode->i_nlink, 223 + f->inocache->pino_nlink, inode->i_mapping->nrpages)); 230 224 return 0; 231 225 232 226 fail: ··· 251 243 ret = jffs2_do_unlink(c, dir_f, dentry->d_name.name, 252 244 dentry->d_name.len, dead_f, now); 253 245 if (dead_f->inocache) 254 - dentry->d_inode->i_nlink = dead_f->inocache->nlink; 246 + dentry->d_inode->i_nlink = dead_f->inocache->pino_nlink; 255 247 if (!ret) 256 248 dir_i->i_mtime = dir_i->i_ctime = ITIME(now); 257 249 return ret; ··· 284 276 285 277 if (!ret) { 286 278 mutex_lock(&f->sem); 287 - old_dentry->d_inode->i_nlink = ++f->inocache->nlink; 279 + old_dentry->d_inode->i_nlink = ++f->inocache->pino_nlink; 288 280 mutex_unlock(&f->sem); 289 281 d_instantiate(dentry, old_dentry->d_inode); 290 282 dir_i->i_mtime = dir_i->i_ctime = ITIME(now); ··· 501 493 502 494 inode->i_op = &jffs2_dir_inode_operations; 503 495 inode->i_fop = &jffs2_dir_operations; 504 - /* Directories get nlink 2 at start */ 505 - inode->i_nlink = 2; 506 496 507 497 f = JFFS2_INODE_INFO(inode); 498 + 499 + /* Directories get nlink 2 at start */ 500 + inode->i_nlink = 2; 501 + /* but ic->pino_nlink is the parent ino# */ 502 + f->inocache->pino_nlink = dir_i->i_ino; 508 503 509 504 ri->data_crc = cpu_to_je32(0); 510 505 ri->node_crc = cpu_to_je32(crc32(0, ri, sizeof(*ri)-8)); ··· 605 594 606 595 static int jffs2_rmdir (struct inode *dir_i, struct dentry *dentry) 607 596 { 597 + struct jffs2_sb_info *c = JFFS2_SB_INFO(dir_i->i_sb); 598 + struct jffs2_inode_info *dir_f = JFFS2_INODE_INFO(dir_i); 608 599 struct jffs2_inode_info *f = JFFS2_INODE_INFO(dentry->d_inode); 609 600 struct jffs2_full_dirent *fd; 610 601 int ret; 602 + uint32_t now = get_seconds(); 611 603 612 604 for (fd = f->dents ; fd; fd = fd->next) { 613 605 if (fd->ino) 614 606 return -ENOTEMPTY; 615 607 } 616 - ret = jffs2_unlink(dir_i, dentry); 617 - if (!ret) 608 + 609 + ret = jffs2_do_unlink(c, dir_f, dentry->d_name.name, 610 + dentry->d_name.len, f, now); 611 + if (!ret) { 612 + dir_i->i_mtime = dir_i->i_ctime = ITIME(now); 613 + clear_nlink(dentry->d_inode); 618 614 drop_nlink(dir_i); 615 + } 619 616 return ret; 620 617 } 621 618 ··· 836 817 inode which didn't exist. */ 837 818 if (victim_f->inocache) { 838 819 mutex_lock(&victim_f->sem); 839 - victim_f->inocache->nlink--; 820 + if (S_ISDIR(new_dentry->d_inode->i_mode)) 821 + victim_f->inocache->pino_nlink = 0; 822 + else 823 + victim_f->inocache->pino_nlink--; 840 824 mutex_unlock(&victim_f->sem); 841 825 } 842 826 } ··· 860 838 struct jffs2_inode_info *f = JFFS2_INODE_INFO(old_dentry->d_inode); 861 839 mutex_lock(&f->sem); 862 840 inc_nlink(old_dentry->d_inode); 863 - if (f->inocache) 864 - f->inocache->nlink++; 841 + if (f->inocache && !S_ISDIR(old_dentry->d_inode->i_mode)) 842 + f->inocache->pino_nlink++; 865 843 mutex_unlock(&f->sem); 866 844 867 845 printk(KERN_NOTICE "jffs2_rename(): Link succeeded, unlink failed (err %d). You now have a hard link\n", ret);
+5 -4
fs/jffs2/erase.c
··· 294 294 break; 295 295 #endif 296 296 default: 297 - if (ic->nodes == (void *)ic && ic->nlink == 0) 297 + if (ic->nodes == (void *)ic && ic->pino_nlink == 0) 298 298 jffs2_del_ino_cache(c, ic); 299 299 } 300 300 } ··· 332 332 if (c->mtd->point) { 333 333 unsigned long *wordebuf; 334 334 335 - ret = c->mtd->point(c->mtd, jeb->offset, c->sector_size, &retlen, (unsigned char **)&ebuf); 335 + ret = c->mtd->point(c->mtd, jeb->offset, c->sector_size, 336 + &retlen, &ebuf, NULL); 336 337 if (ret) { 337 338 D1(printk(KERN_DEBUG "MTD point failed %d\n", ret)); 338 339 goto do_flash_read; ··· 341 340 if (retlen < c->sector_size) { 342 341 /* Don't muck about if it won't let us point to the whole erase sector */ 343 342 D1(printk(KERN_DEBUG "MTD point returned len too short: 0x%zx\n", retlen)); 344 - c->mtd->unpoint(c->mtd, ebuf, jeb->offset, retlen); 343 + c->mtd->unpoint(c->mtd, jeb->offset, retlen); 345 344 goto do_flash_read; 346 345 } 347 346 wordebuf = ebuf-sizeof(*wordebuf); ··· 350 349 if (*++wordebuf != ~0) 351 350 break; 352 351 } while(--retlen); 353 - c->mtd->unpoint(c->mtd, ebuf, jeb->offset, c->sector_size); 352 + c->mtd->unpoint(c->mtd, jeb->offset, c->sector_size); 354 353 if (retlen) { 355 354 printk(KERN_WARNING "Newly-erased block contained word 0x%lx at offset 0x%08tx\n", 356 355 *wordebuf, jeb->offset + c->sector_size-retlen*sizeof(*wordebuf));
+7 -7
fs/jffs2/fs.c
··· 273 273 inode->i_mtime = ITIME(je32_to_cpu(latest_node.mtime)); 274 274 inode->i_ctime = ITIME(je32_to_cpu(latest_node.ctime)); 275 275 276 - inode->i_nlink = f->inocache->nlink; 276 + inode->i_nlink = f->inocache->pino_nlink; 277 277 278 278 inode->i_blocks = (inode->i_size + 511) >> 9; 279 279 ··· 286 286 case S_IFDIR: 287 287 { 288 288 struct jffs2_full_dirent *fd; 289 + inode->i_nlink = 2; /* parent and '.' */ 289 290 290 291 for (fd=f->dents; fd; fd = fd->next) { 291 292 if (fd->type == DT_DIR && fd->ino) 292 293 inc_nlink(inode); 293 294 } 294 - /* and '..' */ 295 - inc_nlink(inode); 296 295 /* Root dir gets i_nlink 3 for some reason */ 297 296 if (inode->i_ino == 1) 298 297 inc_nlink(inode); ··· 585 586 } 586 587 587 588 struct jffs2_inode_info *jffs2_gc_fetch_inode(struct jffs2_sb_info *c, 588 - int inum, int nlink) 589 + int inum, int unlinked) 589 590 { 590 591 struct inode *inode; 591 592 struct jffs2_inode_cache *ic; 592 - if (!nlink) { 593 + 594 + if (unlinked) { 593 595 /* The inode has zero nlink but its nodes weren't yet marked 594 596 obsolete. This has to be because we're still waiting for 595 597 the final (close() and) iput() to happen. ··· 638 638 return ERR_CAST(inode); 639 639 } 640 640 if (is_bad_inode(inode)) { 641 - printk(KERN_NOTICE "Eep. read_inode() failed for ino #%u. nlink %d\n", 642 - inum, nlink); 641 + printk(KERN_NOTICE "Eep. read_inode() failed for ino #%u. unlinked %d\n", 642 + inum, unlinked); 643 643 /* NB. This will happen again. We need to do something appropriate here. */ 644 644 iput(inode); 645 645 return ERR_PTR(-EIO);
+4 -4
fs/jffs2/gc.c
··· 161 161 continue; 162 162 } 163 163 164 - if (!ic->nlink) { 165 - D1(printk(KERN_DEBUG "Skipping check of ino #%d with nlink zero\n", 164 + if (!ic->pino_nlink) { 165 + D1(printk(KERN_DEBUG "Skipping check of ino #%d with nlink/pino zero\n", 166 166 ic->ino)); 167 167 spin_unlock(&c->inocache_lock); 168 168 jffs2_xattr_delete_inode(c, ic); ··· 398 398 it's vaguely possible. */ 399 399 400 400 inum = ic->ino; 401 - nlink = ic->nlink; 401 + nlink = ic->pino_nlink; 402 402 spin_unlock(&c->inocache_lock); 403 403 404 - f = jffs2_gc_fetch_inode(c, inum, nlink); 404 + f = jffs2_gc_fetch_inode(c, inum, !nlink); 405 405 if (IS_ERR(f)) { 406 406 ret = PTR_ERR(f); 407 407 goto release_sem;
+4 -1
fs/jffs2/nodelist.h
··· 177 177 #ifdef CONFIG_JFFS2_FS_XATTR 178 178 struct jffs2_xattr_ref *xref; 179 179 #endif 180 - int nlink; 180 + uint32_t pino_nlink; /* Directories store parent inode 181 + here; other inodes store nlink. 182 + Zero always means that it's 183 + completely unlinked. */ 181 184 }; 182 185 183 186 /* Inode states for 'state' above. We need the 'GC' state to prevent
+1 -1
fs/jffs2/nodemgmt.c
··· 709 709 break; 710 710 #endif 711 711 default: 712 - if (ic->nodes == (void *)ic && ic->nlink == 0) 712 + if (ic->nodes == (void *)ic && ic->pino_nlink == 0) 713 713 jffs2_del_ino_cache(c, ic); 714 714 break; 715 715 }
+1 -1
fs/jffs2/os-linux.h
··· 187 187 void jffs2_gc_release_inode(struct jffs2_sb_info *c, 188 188 struct jffs2_inode_info *f); 189 189 struct jffs2_inode_info *jffs2_gc_fetch_inode(struct jffs2_sb_info *c, 190 - int inum, int nlink); 190 + int inum, int unlinked); 191 191 192 192 unsigned char *jffs2_gc_fetch_page(struct jffs2_sb_info *c, 193 193 struct jffs2_inode_info *f,
+9 -7
fs/jffs2/readinode.c
··· 63 63 /* TODO: instead, incapsulate point() stuff to jffs2_flash_read(), 64 64 * adding and jffs2_flash_read_end() interface. */ 65 65 if (c->mtd->point) { 66 - err = c->mtd->point(c->mtd, ofs, len, &retlen, &buffer); 66 + err = c->mtd->point(c->mtd, ofs, len, &retlen, 67 + (void **)&buffer, NULL); 67 68 if (!err && retlen < len) { 68 69 JFFS2_WARNING("MTD point returned len too short: %zu instead of %u.\n", retlen, tn->csize); 69 - c->mtd->unpoint(c->mtd, buffer, ofs, retlen); 70 + c->mtd->unpoint(c->mtd, ofs, retlen); 70 71 } else if (err) 71 72 JFFS2_WARNING("MTD point failed: error code %d.\n", err); 72 73 else ··· 101 100 kfree(buffer); 102 101 #ifndef __ECOS 103 102 else 104 - c->mtd->unpoint(c->mtd, buffer, ofs, len); 103 + c->mtd->unpoint(c->mtd, ofs, len); 105 104 #endif 106 105 107 106 if (crc != tn->data_crc) { ··· 137 136 kfree(buffer); 138 137 #ifndef __ECOS 139 138 else 140 - c->mtd->unpoint(c->mtd, buffer, ofs, len); 139 + c->mtd->unpoint(c->mtd, ofs, len); 141 140 #endif 142 141 return err; 143 142 } ··· 1124 1123 size_t retlen; 1125 1124 int ret; 1126 1125 1127 - dbg_readinode("ino #%u nlink is %d\n", f->inocache->ino, f->inocache->nlink); 1126 + dbg_readinode("ino #%u pino/nlink is %d\n", f->inocache->ino, 1127 + f->inocache->pino_nlink); 1128 1128 1129 1129 memset(&rii, 0, sizeof(rii)); 1130 1130 ··· 1360 1358 } 1361 1359 dbg_readinode("creating inocache for root inode\n"); 1362 1360 memset(f->inocache, 0, sizeof(struct jffs2_inode_cache)); 1363 - f->inocache->ino = f->inocache->nlink = 1; 1361 + f->inocache->ino = f->inocache->pino_nlink = 1; 1364 1362 f->inocache->nodes = (struct jffs2_raw_node_ref *)f->inocache; 1365 1363 f->inocache->state = INO_STATE_READING; 1366 1364 jffs2_add_ino_cache(c, f->inocache); ··· 1403 1401 jffs2_clear_acl(f); 1404 1402 jffs2_xattr_delete_inode(c, f->inocache); 1405 1403 mutex_lock(&f->sem); 1406 - deleted = f->inocache && !f->inocache->nlink; 1404 + deleted = f->inocache && !f->inocache->pino_nlink; 1407 1405 1408 1406 if (f->inocache && f->inocache->state != INO_STATE_CHECKING) 1409 1407 jffs2_set_inocache_state(c, f->inocache, INO_STATE_CLEARING);
+5 -4
fs/jffs2/scan.c
··· 97 97 size_t pointlen; 98 98 99 99 if (c->mtd->point) { 100 - ret = c->mtd->point (c->mtd, 0, c->mtd->size, &pointlen, &flashbuf); 100 + ret = c->mtd->point(c->mtd, 0, c->mtd->size, &pointlen, 101 + (void **)&flashbuf, NULL); 101 102 if (!ret && pointlen < c->mtd->size) { 102 103 /* Don't muck about if it won't let us point to the whole flash */ 103 104 D1(printk(KERN_DEBUG "MTD point returned len too short: 0x%zx\n", pointlen)); 104 - c->mtd->unpoint(c->mtd, flashbuf, 0, pointlen); 105 + c->mtd->unpoint(c->mtd, 0, pointlen); 105 106 flashbuf = NULL; 106 107 } 107 108 if (ret) ··· 268 267 kfree(flashbuf); 269 268 #ifndef __ECOS 270 269 else 271 - c->mtd->unpoint(c->mtd, flashbuf, 0, c->mtd->size); 270 + c->mtd->unpoint(c->mtd, 0, c->mtd->size); 272 271 #endif 273 272 if (s) 274 273 kfree(s); ··· 941 940 ic->nodes = (void *)ic; 942 941 jffs2_add_ino_cache(c, ic); 943 942 if (ino == 1) 944 - ic->nlink = 1; 943 + ic->pino_nlink = 1; 945 944 return ic; 946 945 } 947 946
+8 -7
fs/jffs2/super.c
··· 31 31 32 32 static struct inode *jffs2_alloc_inode(struct super_block *sb) 33 33 { 34 - struct jffs2_inode_info *ei; 35 - ei = (struct jffs2_inode_info *)kmem_cache_alloc(jffs2_inode_cachep, GFP_KERNEL); 36 - if (!ei) 34 + struct jffs2_inode_info *f; 35 + 36 + f = kmem_cache_alloc(jffs2_inode_cachep, GFP_KERNEL); 37 + if (!f) 37 38 return NULL; 38 - return &ei->vfs_inode; 39 + return &f->vfs_inode; 39 40 } 40 41 41 42 static void jffs2_destroy_inode(struct inode *inode) ··· 46 45 47 46 static void jffs2_i_init_once(struct kmem_cache *cachep, void *foo) 48 47 { 49 - struct jffs2_inode_info *ei = (struct jffs2_inode_info *) foo; 48 + struct jffs2_inode_info *f = foo; 50 49 51 - mutex_init(&ei->sem); 52 - inode_init_once(&ei->vfs_inode); 50 + mutex_init(&f->sem); 51 + inode_init_once(&f->vfs_inode); 53 52 } 54 53 55 54 static int jffs2_sync_fs(struct super_block *sb, int wait)
+1 -1
fs/jffs2/wbuf.c
··· 494 494 /* If it's an in-core inode, then we have to adjust any 495 495 full_dirent or full_dnode structure to point to the 496 496 new version instead of the old */ 497 - f = jffs2_gc_fetch_inode(c, ic->ino, ic->nlink); 497 + f = jffs2_gc_fetch_inode(c, ic->ino, !ic->pino_nlink); 498 498 if (IS_ERR(f)) { 499 499 /* Should never happen; it _must_ be present */ 500 500 JFFS2_ERROR("Failed to iget() ino #%u, err %ld\n",
+9 -8
fs/jffs2/write.c
··· 19 19 #include "compr.h" 20 20 21 21 22 - int jffs2_do_new_inode(struct jffs2_sb_info *c, struct jffs2_inode_info *f, uint32_t mode, struct jffs2_raw_inode *ri) 22 + int jffs2_do_new_inode(struct jffs2_sb_info *c, struct jffs2_inode_info *f, 23 + uint32_t mode, struct jffs2_raw_inode *ri) 23 24 { 24 25 struct jffs2_inode_cache *ic; 25 26 ··· 32 31 memset(ic, 0, sizeof(*ic)); 33 32 34 33 f->inocache = ic; 35 - f->inocache->nlink = 1; 34 + f->inocache->pino_nlink = 1; /* Will be overwritten shortly for directories */ 36 35 f->inocache->nodes = (struct jffs2_raw_node_ref *)f->inocache; 37 36 f->inocache->state = INO_STATE_PRESENT; 38 37 ··· 439 438 ret = jffs2_reserve_space(c, sizeof(*ri), &alloclen, ALLOC_NORMAL, 440 439 JFFS2_SUMMARY_INODE_SIZE); 441 440 D1(printk(KERN_DEBUG "jffs2_do_create(): reserved 0x%x bytes\n", alloclen)); 442 - if (ret) { 443 - mutex_unlock(&f->sem); 441 + if (ret) 444 442 return ret; 445 - } 443 + 444 + mutex_lock(&f->sem); 446 445 447 446 ri->data_crc = cpu_to_je32(0); 448 447 ri->node_crc = cpu_to_je32(crc32(0, ri, sizeof(*ri)-8)); ··· 636 635 jffs2_mark_node_obsolete(c, fd->raw); 637 636 jffs2_free_full_dirent(fd); 638 637 } 639 - } 640 - 641 - dead_f->inocache->nlink--; 638 + dead_f->inocache->pino_nlink = 0; 639 + } else 640 + dead_f->inocache->pino_nlink--; 642 641 /* NB: Caller must set inode nlink if appropriate */ 643 642 mutex_unlock(&dead_f->sem); 644 643 }
+2 -2
fs/jffs2/xattr.c
··· 592 592 When an inode with XATTR is removed, those XATTRs must be removed. */ 593 593 struct jffs2_xattr_ref *ref, *_ref; 594 594 595 - if (!ic || ic->nlink > 0) 595 + if (!ic || ic->pino_nlink > 0) 596 596 return; 597 597 598 598 down_write(&c->xattr_sem); ··· 829 829 ref->xd and ref->ic are not valid yet. */ 830 830 xd = jffs2_find_xattr_datum(c, ref->xid); 831 831 ic = jffs2_get_ino_cache(c, ref->ino); 832 - if (!xd || !ic || !ic->nlink) { 832 + if (!xd || !ic || !ic->pino_nlink) { 833 833 dbg_xattr("xref(ino=%u, xid=%u, xseqno=%u) is orphan.\n", 834 834 ref->ino, ref->xid, ref->xseqno); 835 835 ref->xseqno |= XREF_DELETE_MARKER;
-66
include/linux/mtd/jedec.h
··· 1 - 2 - /* JEDEC Flash Interface. 3 - * This is an older type of interface for self programming flash. It is 4 - * commonly use in older AMD chips and is obsolete compared with CFI. 5 - * It is called JEDEC because the JEDEC association distributes the ID codes 6 - * for the chips. 7 - * 8 - * See the AMD flash databook for information on how to operate the interface. 9 - * 10 - * $Id: jedec.h,v 1.4 2005/11/07 11:14:54 gleixner Exp $ 11 - */ 12 - 13 - #ifndef __LINUX_MTD_JEDEC_H__ 14 - #define __LINUX_MTD_JEDEC_H__ 15 - 16 - #include <linux/types.h> 17 - 18 - #define MAX_JEDEC_CHIPS 16 19 - 20 - // Listing of all supported chips and their information 21 - struct JEDECTable 22 - { 23 - __u16 jedec; 24 - char *name; 25 - unsigned long size; 26 - unsigned long sectorsize; 27 - __u32 capabilities; 28 - }; 29 - 30 - // JEDEC being 0 is the end of the chip array 31 - struct jedec_flash_chip 32 - { 33 - __u16 jedec; 34 - unsigned long size; 35 - unsigned long sectorsize; 36 - 37 - // *(__u8*)(base + (adder << addrshift)) = data << datashift 38 - // Address size = size << addrshift 39 - unsigned long base; // Byte 0 of the flash, will be unaligned 40 - unsigned int datashift; // Useful for 32bit/16bit accesses 41 - unsigned int addrshift; 42 - unsigned long offset; // linerized start. base==offset for unbanked, uninterleaved flash 43 - 44 - __u32 capabilities; 45 - 46 - // These markers are filled in by the flash_chip_scan function 47 - unsigned long start; 48 - unsigned long length; 49 - }; 50 - 51 - struct jedec_private 52 - { 53 - unsigned long size; // Total size of all the devices 54 - 55 - /* Bank handling. If sum(bank_fill) == size then this is linear flash. 56 - Otherwise the mapping has holes in it. bank_fill may be used to 57 - find the holes, but in the common symetric case 58 - bank_fill[0] == bank_fill[*], thus addresses may be computed 59 - mathmatically. bank_fill must be powers of two */ 60 - unsigned is_banked; 61 - unsigned long bank_fill[MAX_JEDEC_CHIPS]; 62 - 63 - struct jedec_flash_chip chips[MAX_JEDEC_CHIPS]; 64 - }; 65 - 66 - #endif
+4 -2
include/linux/mtd/mtd.h
··· 143 143 int (*erase) (struct mtd_info *mtd, struct erase_info *instr); 144 144 145 145 /* This stuff for eXecute-In-Place */ 146 - int (*point) (struct mtd_info *mtd, loff_t from, size_t len, size_t *retlen, u_char **mtdbuf); 146 + /* phys is optional and may be set to NULL */ 147 + int (*point) (struct mtd_info *mtd, loff_t from, size_t len, 148 + size_t *retlen, void **virt, resource_size_t *phys); 147 149 148 150 /* We probably shouldn't allow XIP if the unpoint isn't a NULL */ 149 - void (*unpoint) (struct mtd_info *mtd, u_char * addr, loff_t from, size_t len); 151 + void (*unpoint) (struct mtd_info *mtd, loff_t from, size_t len); 150 152 151 153 152 154 int (*read) (struct mtd_info *mtd, loff_t from, size_t len, size_t *retlen, u_char *buf);
+3 -2
include/linux/mtd/pmc551.h
··· 36 36 * Function Prototypes 37 37 */ 38 38 static int pmc551_erase(struct mtd_info *, struct erase_info *); 39 - static void pmc551_unpoint(struct mtd_info *, u_char *, loff_t, size_t); 40 - static int pmc551_point (struct mtd_info *mtd, loff_t from, size_t len, size_t *retlen, u_char **mtdbuf); 39 + static void pmc551_unpoint(struct mtd_info *, loff_t, size_t); 40 + static int pmc551_point(struct mtd_info *mtd, loff_t from, size_t len, 41 + size_t *retlen, void **virt, resource_size_t *phys); 41 42 static int pmc551_read(struct mtd_info *, loff_t, size_t, size_t *, u_char *); 42 43 static int pmc551_write(struct mtd_info *, loff_t, size_t, size_t *, const u_char *); 43 44