[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <87eh1z4kus.fsf@devron.myhome.or.jp>
Date: Tue, 18 Mar 2014 23:55:39 +0900
From: OGAWA Hirofumi <hirofumi@...l.parknet.co.jp>
To: Namjae Jeon <linkinjeon@...il.com>
Cc: akpm@...ux-foundation.org, linux-fsdevel@...r.kernel.org,
linux-kernel@...r.kernel.org,
Namjae Jeon <namjae.jeon@...sung.com>,
Amit Sahrawat <a.sahrawat@...sung.com>
Subject: Re: [PATCH v4 2/6] fat: add fat_fallocate operation
Namjae Jeon <linkinjeon@...il.com> writes:
> + if (mode & FALLOC_FL_KEEP_SIZE) {
> + /* First compute the number of clusters to be allocated */
> + mm_bytes = offset + len - round_up(MSDOS_I(inode)->i_disksize,
> + sbi->cluster_size);
> + nr_cluster = (mm_bytes + (sbi->cluster_size - 1)) >>
> + sbi->cluster_bits;
> +
> + /* Start the allocation.We are not zeroing out the clusters */
> + while (nr_cluster-- > 0) {
> + err = fat_alloc_clusters(inode, &cluster, 1);
> + if (err) {
> + fat_msg(sb, KERN_ERR,
> + "fat_fallocate(): fat_alloc_clusters() error");
> + goto error;
> + }
> + err = fat_chain_add(inode, cluster, 1);
> + if (err) {
> + fat_free_clusters(inode, cluster);
> + goto error;
> + }
> + MSDOS_I(inode)->i_disksize += sbi->cluster_size;
> + }
Hm. This ->i_disksize calculation is right? Why do we use cluster align
here? My concern is, say blocksize == 512 and clustersize == 4096,
0 512 5120
| | |
+-------+-----------+------+
4096
Before fallocate(), ->i_disksize == 512. Then user called fallocate()
with offset == 512 and len == 4608.
After that, this sets ->i_disksize += 4096, == 4608? I think, we should
set ->i_disksize == 5120, finally. I can be missing something though.
--
OGAWA Hirofumi <hirofumi@...l.parknet.co.jp>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists