Revert "USB: gadget: f_mass_storage: Flush writes after every 4 MB."
author黄涛 <huangtao@rock-chips.com>
Sat, 30 Jul 2011 14:17:00 +0000 (22:17 +0800)
committer黄涛 <huangtao@rock-chips.com>
Sat, 30 Jul 2011 14:17:00 +0000 (22:17 +0800)
This reverts commit 5cf1b82507ed24e0ee9f4f2f3ce6dbcb82b86fa0.

drivers/usb/gadget/f_mass_storage.c

index 6fccd710217bcce61c0400a9287c3138098edaf6..1dc72346b81b2214ff0972005896a1f73568c527 100755 (executable)
@@ -79,9 +79,6 @@
 
 #define BULK_BUFFER_SIZE           4096
 
-/* flush after every 4 meg of writes to avoid excessive block level caching */
-#define MAX_UNFLUSHED_BYTES (4 * 1024 * 1024)
-
 /*-------------------------------------------------------------------------*/
 
 #define DRIVER_NAME            "usb_mass_storage"
@@ -229,7 +226,6 @@ struct lun {
        struct file     *filp;
        loff_t          file_length;
        loff_t          num_sectors;
-       unsigned int unflushed_bytes;
 
        unsigned int    ro : 1;
        unsigned int    prevent_medium_removal : 1;
@@ -396,7 +392,7 @@ static struct fsg_dev                       *the_fsg;
 
 static void    close_backing_file(struct fsg_dev *fsg, struct lun *curlun);
 static void    close_all_backing_files(struct fsg_dev *fsg);
-static int fsync_sub(struct lun *curlun);
+
 
 /*-------------------------------------------------------------------------*/
 
@@ -1043,13 +1039,6 @@ static int do_write(struct fsg_dev *fsg)
                        amount_left_to_write -= nwritten;
                        fsg->residue -= nwritten;
 
-#ifdef MAX_UNFLUSHED_BYTES
-                       curlun->unflushed_bytes += nwritten;
-                       if (curlun->unflushed_bytes >= MAX_UNFLUSHED_BYTES) {
-                               fsync_sub(curlun);
-                               curlun->unflushed_bytes = 0;
-                       }
-#endif
                        /* If an error occurred, report it and its position */
                        if (nwritten < amount) {
                                curlun->sense_data = SS_WRITE_ERROR;
@@ -2526,7 +2515,6 @@ static int open_backing_file(struct fsg_dev *fsg, struct lun *curlun,
        curlun->ro = ro;
        curlun->filp = filp;
        curlun->file_length = size;
-       curlun->unflushed_bytes = 0;
        curlun->num_sectors = num_sectors;
        LDBG(curlun, "open backing file: %s size: %lld num_sectors: %lld\n",
                        filename, size, num_sectors);