Unmount time memory usage

Kernel (deactivate_sb()) calls the jffs2_kill_sb() to deactivate the sb of the filesystem.

If the filesystem is not in read only mode then jffs2_kill_sb() stops the GC thread. Then it calls generic_shutdown_super(). generic_shutdown_super() shuts down the sb (shrinks dcache, invalidates inodes, etc) and calls two filesystem specific functions if the fs implements those two functions.

The first is write_super() which sets the dirty flag of the superblock to 0 and if the fs is mounted as read only then returns otherwise it calls GC thread to do what it has to, calls jffs2_erase_pending_blocks() to erase the eraseblocks on the erase_pending list or mark the block as clean if it is on the erase_complete list. Finally it calls jffs2_flush_wbuf_gc() to trigger GC to flush the writebuffer.

The second is put_super() which flushes the writebuffer and pads it. Then it frees the summary structures, inode caches, raw_node references, the erase block array (c->blocks) and the inodecache lists. If the mtd driver implements the sync operation then syncs the device.

jffs2_kill_sb() calls put_mtd_device() and frees the superblock.

Havasi Ferenc 2005-12-22