VirtualBox

Changeset 77444 in vbox


Ignore:
Timestamp:
Feb 23, 2019 1:58:10 AM (6 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
129014
Message:

linux/vboxsf: I cannot see why we would ever need write_begin/write_end since we shouldn't be doing any writes thru the page cache (other than mmap writepage() style). Put back the simple_write_end() code and added warnings for the first 16 calls. bugref:9172

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Additions/linux/sharedfolders/regops.c

    r77443 r77444  
    7474
    7575
    76 /* fops */
    77 
    78 static int sf_reg_write_aux(const char *caller, struct sf_glob_info *sf_g,
    79                             struct sf_reg_info *sf_r, void *buf,
    80                             uint32_t * nwritten, uint64_t pos)
    81 {
    82     /** @todo bird: yes, kmap() and kmalloc() input only. Since the buffer is
    83      *        contiguous in physical memory (kmalloc or single page), we should
    84      *        use a physical address here to speed things up. */
    85         int rc = VbglR0SfWrite(&client_handle, &sf_g->map, sf_r->handle,
    86                                pos, nwritten, buf,
    87                                false /* already locked? */ );
    88         if (RT_FAILURE(rc)) {
    89                 LogFunc(("VbglR0SfWrite failed. caller=%s, rc=%Rrc\n",
    90                          caller, rc));
    91                 return -EPROTO;
    92         }
    93         return 0;
    94 }
    9576
    9677#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 23) \
     
    12551236# if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 24)
    12561237
     1238#  if 0 /* unused - see below */
     1239static int sf_reg_write_aux(const char *caller, struct sf_glob_info *sf_g,
     1240                            struct sf_reg_info *sf_r, void *buf,
     1241                            uint32_t * nwritten, uint64_t pos)
     1242{
     1243    /** @todo bird: yes, kmap() and kmalloc() input only. Since the buffer is
     1244     *        contiguous in physical memory (kmalloc or single page), we should
     1245     *        use a physical address here to speed things up. */
     1246        int rc = VbglR0SfWrite(&client_handle, &sf_g->map, sf_r->handle,
     1247                               pos, nwritten, buf,
     1248                               false /* already locked? */ );
     1249        if (RT_FAILURE(rc)) {
     1250                LogFunc(("VbglR0SfWrite failed. caller=%s, rc=%Rrc\n",
     1251                         caller, rc));
     1252                return -EPROTO;
     1253        }
     1254        return 0;
     1255}
     1256#  endif
     1257
     1258/**
     1259 * Called when writing thru the page cache (which we shouldn't be doing).
     1260 */
    12571261int sf_write_begin(struct file *file, struct address_space *mapping, loff_t pos,
    12581262                   unsigned len, unsigned flags, struct page **pagep,
    12591263                   void **fsdata)
    12601264{
    1261         TRACE();
    1262 #if 0
    1263         printk("sf_write_begin: pos=%#llx len=%#x flags=%#x\n", pos, len, flags);
    1264         RTLogBackdoorPrintf("sf_write_begin: pos=%#llx len=%#x flags=%#x\n", pos, len, flags);
    1265 #endif
    1266 /** @todo rig up a FsPerf testcase for this code! */
    1267 
    1268         return simple_write_begin(file, mapping, pos, len, flags, pagep,
    1269                                   fsdata);
    1270 }
    1271 
     1265        /** @todo r=bird: We shouldn't ever get here, should we?  Because we don't use
     1266         *        the page cache for any writes AFAIK.  We could just as well use
     1267         *        simple_write_begin & simple_write_end here if we think we really
     1268         *        need to have non-NULL function pointers in the table... */
     1269        static uint64_t volatile s_cCalls = 0;
     1270        if (s_cCalls++ < 16) {
     1271                printk("vboxsf: Unexpected call to sf_write_begin(pos=%#llx len=%#x flags=%#x)! Please report.\n",
     1272                       (unsigned long long)pos, len, flags);
     1273                RTLogBackdoorPrintf("vboxsf: Unexpected call to sf_write_begin(pos=%#llx len=%#x flags=%#x)!  Please report.\n",
     1274                                    (unsigned long long)pos, len, flags);
     1275#  ifdef WARN_ON
     1276                WARN_ON(1);
     1277#  endif
     1278        }
     1279        return simple_write_begin(file, mapping, pos, len, flags, pagep, fsdata);
     1280}
     1281
     1282/**
     1283 * Called to complete a write thru the page cache (which we shouldn't be doing).
     1284 */
    12721285int sf_write_end(struct file *file, struct address_space *mapping, loff_t pos,
    12731286                 unsigned len, unsigned copied, struct page *page, void *fsdata)
    12741287{
     1288#  if 0 /** @todo r=bird: See sf_write_begin. */
    12751289        struct inode *inode = mapping->host;
    12761290        struct sf_glob_info *sf_g = GET_GLOB_INFO(inode->i_sb);
     
    12821296
    12831297        TRACE();
    1284 /** @todo rig up a FsPerf testcase for this code! */
    12851298
    12861299        buf = kmap(page);
     
    12981311
    12991312        unlock_page(page);
    1300 if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 6, 0)
     1313 if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 6, 0)
    13011314        put_page(page);
     1315#   else
     1316        page_cache_release(page);
     1317#   endif
     1318        return nwritten;
    13021319#  else
    1303         page_cache_release(page);
     1320        return simple_write_end(file, mapping, pos, len, copied, page, fsdata);
    13041321#  endif
    1305 
    1306         return nwritten;
    13071322}
    13081323
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette