On 2014-02-17 04:00, Ryusuke Konishi wrote: >> + if (end > nilfs->ns_nsegments) >> + end = nilfs->ns_nsegments; > > Yes, this adjustment is what we should do here, but 'end' segnum was > rounded down to segment alighment before. So, it should be: > > if (end >= nilfs->ns_nsegments) > end = nilfs->ns_nsegments - 1; > >> + if (end == segnum) >> + goto out; > > and > > if (end < segnum) > goto out; > >> + >> + down_read(&NILFS_MDT(sufile)->mi_sem); >> + >> + while (segnum < end) { > > and > > while (segnum <= end) { > >> + n = min_t(unsigned long, >> + segusages_per_block - >> + nilfs_sufile_get_offset(sufile, segnum), >> + end - segnum); > > Then, we can reuse nilfs_sufile_segment_usages_in_block() to calculate > 'n'. Actually I don't think that is correct. What if range->start = 0 and range->end = 8MB. Then segnum = 0 and end = 1. Your code would discard segment 0 and segment 1, whereas my version would discard only segment 0, which seems to be more reasonable. br, Andreas Rohner -- To unsubscribe from this list: send the line "unsubscribe linux-nilfs" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html