fs/fat: reduce data size for FAT_WRITE
Allocated tmpbuf_cluster dynamically to reduce the data size added by compiling with CONFIG_FAT_WRITE. Reported-by: Tom Rini <trini@konsulko.com> Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
This commit is contained in:
parent
a27c78fddb
commit
5a8d1f60b2
|
@ -500,8 +500,6 @@ flush_dir(fat_itr *itr)
|
||||||
nsects * mydata->sect_size);
|
nsects * mydata->sect_size);
|
||||||
}
|
}
|
||||||
|
|
||||||
static __u8 tmpbuf_cluster[MAX_CLUSTSIZE] __aligned(ARCH_DMA_MINALIGN);
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Read and modify data on existing and consecutive cluster blocks
|
* Read and modify data on existing and consecutive cluster blocks
|
||||||
*/
|
*/
|
||||||
|
@ -509,6 +507,7 @@ static int
|
||||||
get_set_cluster(fsdata *mydata, __u32 clustnum, loff_t pos, __u8 *buffer,
|
get_set_cluster(fsdata *mydata, __u32 clustnum, loff_t pos, __u8 *buffer,
|
||||||
loff_t size, loff_t *gotsize)
|
loff_t size, loff_t *gotsize)
|
||||||
{
|
{
|
||||||
|
static u8 *tmpbuf_cluster;
|
||||||
unsigned int bytesperclust = mydata->clust_size * mydata->sect_size;
|
unsigned int bytesperclust = mydata->clust_size * mydata->sect_size;
|
||||||
__u32 startsect;
|
__u32 startsect;
|
||||||
loff_t wsize;
|
loff_t wsize;
|
||||||
|
@ -518,6 +517,12 @@ get_set_cluster(fsdata *mydata, __u32 clustnum, loff_t pos, __u8 *buffer,
|
||||||
if (!size)
|
if (!size)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
if (!tmpbuf_cluster) {
|
||||||
|
tmpbuf_cluster = memalign(ARCH_DMA_MINALIGN, MAX_CLUSTSIZE);
|
||||||
|
if (!tmpbuf_cluster)
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
assert(pos < bytesperclust);
|
assert(pos < bytesperclust);
|
||||||
startsect = clust_to_sect(mydata, clustnum);
|
startsect = clust_to_sect(mydata, clustnum);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue