2004-07-13 Miklos Szeredi <miklos@szeredi.hu>
* Add FUSE_HARD_REMOVE flag, and '-i' option to fuse main, which
- disable the "hide if open" behavior of unlink/rename.
+ disable the "hide if open" behavior of unlink/rename.
+
+ * If temporary buffer allocation fails in raw read, fall back to a
+ smaller buffer
2004-07-12 Miklos Szeredi <miklos@szeredi.hu>
char *tmpbuf;
ssize_t res = 0;
loff_t pos = *ppos;
+ unsigned int max_read = count < fc->max_read ? count : fc->max_read;
- tmpbuf = kmalloc(count < fc->max_read ? count : fc->max_read,
- GFP_KERNEL);
+ do {
+ tmpbuf = kmalloc(max_read, GFP_KERNEL);
+ if (tmpbuf)
+ break;
+
+ max_read /= 2;
+ } while (max_read > PAGE_CACHE_SIZE / 4);
if (!tmpbuf)
return -ENOMEM;
while (count) {
- size_t nbytes = count < fc->max_read ? count : fc->max_read;
+ size_t nbytes = count < max_read ? count : max_read;
ssize_t res1;
res1 = fuse_send_read(inode, tmpbuf, pos, nbytes);
if (res1 < 0) {