@@ -2655,64 +2655,6 @@ struct cifs_writedata *cifs_writedata_alloc(work_func_t complete)
26552655 return wdata ;
26562656}
26572657
2658- static int cifs_partialpagewrite (struct page * page , unsigned from , unsigned to )
2659- {
2660- struct address_space * mapping = page -> mapping ;
2661- loff_t offset = (loff_t )page -> index << PAGE_SHIFT ;
2662- char * write_data ;
2663- int rc = - EFAULT ;
2664- int bytes_written = 0 ;
2665- struct inode * inode ;
2666- struct cifsFileInfo * open_file ;
2667-
2668- if (!mapping || !mapping -> host )
2669- return - EFAULT ;
2670-
2671- inode = page -> mapping -> host ;
2672-
2673- offset += (loff_t )from ;
2674- write_data = kmap (page );
2675- write_data += from ;
2676-
2677- if ((to > PAGE_SIZE ) || (from > to )) {
2678- kunmap (page );
2679- return - EIO ;
2680- }
2681-
2682- /* racing with truncate? */
2683- if (offset > mapping -> host -> i_size ) {
2684- kunmap (page );
2685- return 0 ; /* don't care */
2686- }
2687-
2688- /* check to make sure that we are not extending the file */
2689- if (mapping -> host -> i_size - offset < (loff_t )to )
2690- to = (unsigned )(mapping -> host -> i_size - offset );
2691-
2692- rc = cifs_get_writable_file (CIFS_I (mapping -> host ), FIND_WR_ANY ,
2693- & open_file );
2694- if (!rc ) {
2695- bytes_written = cifs_write (open_file , open_file -> pid ,
2696- write_data , to - from , & offset );
2697- cifsFileInfo_put (open_file );
2698- /* Does mm or vfs already set times? */
2699- simple_inode_init_ts (inode );
2700- if ((bytes_written > 0 ) && (offset ))
2701- rc = 0 ;
2702- else if (bytes_written < 0 )
2703- rc = bytes_written ;
2704- else
2705- rc = - EFAULT ;
2706- } else {
2707- cifs_dbg (FYI , "No writable handle for write page rc=%d\n" , rc );
2708- if (!is_retryable_error (rc ))
2709- rc = - EIO ;
2710- }
2711-
2712- kunmap (page );
2713- return rc ;
2714- }
2715-
27162658/*
27172659 * Extend the region to be written back to include subsequent contiguously
27182660 * dirty pages if possible, but don't sleep while doing so.
@@ -3126,47 +3068,6 @@ static int cifs_writepages(struct address_space *mapping,
31263068 return ret ;
31273069}
31283070
3129- static int
3130- cifs_writepage_locked (struct page * page , struct writeback_control * wbc )
3131- {
3132- int rc ;
3133- unsigned int xid ;
3134-
3135- xid = get_xid ();
3136- /* BB add check for wbc flags */
3137- get_page (page );
3138- if (!PageUptodate (page ))
3139- cifs_dbg (FYI , "ppw - page not up to date\n" );
3140-
3141- /*
3142- * Set the "writeback" flag, and clear "dirty" in the radix tree.
3143- *
3144- * A writepage() implementation always needs to do either this,
3145- * or re-dirty the page with "redirty_page_for_writepage()" in
3146- * the case of a failure.
3147- *
3148- * Just unlocking the page will cause the radix tree tag-bits
3149- * to fail to update with the state of the page correctly.
3150- */
3151- set_page_writeback (page );
3152- retry_write :
3153- rc = cifs_partialpagewrite (page , 0 , PAGE_SIZE );
3154- if (is_retryable_error (rc )) {
3155- if (wbc -> sync_mode == WB_SYNC_ALL && rc == - EAGAIN )
3156- goto retry_write ;
3157- redirty_page_for_writepage (wbc , page );
3158- } else if (rc != 0 ) {
3159- SetPageError (page );
3160- mapping_set_error (page -> mapping , rc );
3161- } else {
3162- SetPageUptodate (page );
3163- }
3164- end_page_writeback (page );
3165- put_page (page );
3166- free_xid (xid );
3167- return rc ;
3168- }
3169-
31703071static int cifs_write_end (struct file * file , struct address_space * mapping ,
31713072 loff_t pos , unsigned len , unsigned copied ,
31723073 struct page * page , void * fsdata )
@@ -4992,27 +4893,6 @@ static void cifs_invalidate_folio(struct folio *folio, size_t offset,
49924893 folio_wait_private_2 (folio ); /* [DEPRECATED] */
49934894}
49944895
4995- static int cifs_launder_folio (struct folio * folio )
4996- {
4997- int rc = 0 ;
4998- loff_t range_start = folio_pos (folio );
4999- loff_t range_end = range_start + folio_size (folio );
5000- struct writeback_control wbc = {
5001- .sync_mode = WB_SYNC_ALL ,
5002- .nr_to_write = 0 ,
5003- .range_start = range_start ,
5004- .range_end = range_end ,
5005- };
5006-
5007- cifs_dbg (FYI , "Launder page: %lu\n" , folio -> index );
5008-
5009- if (folio_clear_dirty_for_io (folio ))
5010- rc = cifs_writepage_locked (& folio -> page , & wbc );
5011-
5012- folio_wait_private_2 (folio ); /* [DEPRECATED] */
5013- return rc ;
5014- }
5015-
50164896void cifs_oplock_break (struct work_struct * work )
50174897{
50184898 struct cifsFileInfo * cfile = container_of (work , struct cifsFileInfo ,
@@ -5191,7 +5071,6 @@ const struct address_space_operations cifs_addr_ops = {
51915071 .release_folio = cifs_release_folio ,
51925072 .direct_IO = cifs_direct_io ,
51935073 .invalidate_folio = cifs_invalidate_folio ,
5194- .launder_folio = cifs_launder_folio ,
51955074 .migrate_folio = filemap_migrate_folio ,
51965075 /*
51975076 * TODO: investigate and if useful we could add an is_dirty_writeback
@@ -5214,6 +5093,5 @@ const struct address_space_operations cifs_addr_ops_smallbuf = {
52145093 .dirty_folio = netfs_dirty_folio ,
52155094 .release_folio = cifs_release_folio ,
52165095 .invalidate_folio = cifs_invalidate_folio ,
5217- .launder_folio = cifs_launder_folio ,
52185096 .migrate_folio = filemap_migrate_folio ,
52195097};
0 commit comments