From: Akira Fujita <a-fujita@xxxxxxxxxxxxx> Change the error handling for ext4_iget() and some fixes. Signed-off-by: Akira Fujita <a-fujita@xxxxxxxxxxxxx> Signed-off-by: Takashi Sato <t-sato@xxxxxxxxxxxxx> -- ext4-online-defrag-defrag-command_ref.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) --- ext4-online-defrag-defrag-command.c 2008-03-04 17:28:26.000000000 +0900 +++ ext4-online-defrag-defrag-command_ref.c 2008-03-05 15:27:36.000000000 +0900 @@ -37,7 +37,7 @@ #define EXT4_IOC_EXTENTS_INFO _IOW('f', 13, struct ext4_extents_info) #define EXT4_IOC_RESERVE_BLOCK _IOW('f', 14, struct ext4_extents_info) #define EXT4_IOC_MOVE_VICTIM _IOW('f', 15, struct ext4_extents_info) -#define EXT4_IOC_BLOCK_RELEASE _IO('f', 16) +#define EXT4_IOC_BLOCK_RELEASE _IO('f', 8) #define DEFRAG_MAX_ENT 32 @@ -431,7 +431,8 @@ ftw_fn(const char *file, const struct st if (flag == FTW_F) { amount_cnt++; - if ((fd = open64(file, O_RDONLY)) < 0) { + fd = open64(file, O_RDWR); + if (fd < 0) { if (detail_flag) { perror(NGMSG_FILE_OPEN); PRINT_FILE_NAME(file); @@ -1382,7 +1383,7 @@ int get_used_extent(int fd, extent_t **e DEFRAG_MAX_ENT); ret = ioctl(fd, EXT4_IOC_EXTENTS_INFO, &extents_info); if (ret < 0) { - if (errno == ENOENT) { + if (errno == ENOENT || errno == ESTALE) { continue; } else { /* Without ENOENT case*/ @@ -1416,9 +1417,8 @@ int get_used_extent(int fd, extent_t **e } if (ret < 0) { - if (errno == ENOENT) { + if (errno == ENOENT || errno == ESTALE) return RETURN_OK; - } } return ret; } -- To unsubscribe from this list: send the line "unsubscribe linux-ext4" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html