]> git.kernelconcepts.de Git - karo-tx-linux.git/commit
f2fs: reorganize f2fs_map_blocks
authorChao Yu <chao2.yu@samsung.com>
Fri, 18 Sep 2015 08:51:51 +0000 (16:51 +0800)
committerJaegeuk Kim <jaegeuk@kernel.org>
Fri, 9 Oct 2015 23:20:51 +0000 (16:20 -0700)
commit973163fc0ce07761eae671e895dc6747a3410fe7
tree5485524e6202dff461af64a0a25ef6e21eff22e7
parent514053e4543b33bbd74d8900f368df663cb03325
f2fs: reorganize f2fs_map_blocks

In this patch, we try to reorganize f2fs_map_blocks to make block mapping
flow more clear by using following structure:

/* check status of mapping */

if (unmapped) {
/* blkaddr == NULL_ADDR || blkaddr == NEW_ADDR */

if (create) {
/* write path, handle dio write case here */
alloc_and_map;
} else {
/*
 * handle read cases from all call paths:
 *     1. generic read;
 *     2. dio read;
 *     3. fiemap;
 *     4. bmap
 */
}
}

/* map buffer_header */

Besides, this patch handles the missing case correctly for dio write:
When we fail in __allocate_data_blocks, then in f2fs_map_blocks, we will
not allocate blocks correctly for preallocated blocks, but returning with
an unmapped buffer head, which will result in failure of dio write.

Signed-off-by: Chao Yu <chao2.yu@samsung.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
fs/f2fs/data.c