@@ -742,17 +742,16 @@ static void fuse_aio_complete(struct fuse_io_priv *io, int err, ssize_t pos)
742
742
kref_put (& io -> refcnt , fuse_io_release );
743
743
}
744
744
745
- static struct fuse_io_args * fuse_io_folios_alloc (struct fuse_io_priv * io ,
745
+ static struct fuse_io_args * fuse_io_alloc (struct fuse_io_priv * io ,
746
746
unsigned int nfolios )
747
747
{
748
748
struct fuse_io_args * ia ;
749
749
750
750
ia = kzalloc (sizeof (* ia ), GFP_KERNEL );
751
751
if (ia ) {
752
752
ia -> io = io ;
753
- ia -> ap .uses_folios = true;
754
753
ia -> ap .folios = fuse_folios_alloc (nfolios , GFP_KERNEL ,
755
- & ia -> ap .folio_descs );
754
+ & ia -> ap .descs );
756
755
if (!ia -> ap .folios ) {
757
756
kfree (ia );
758
757
ia = NULL ;
@@ -761,7 +760,7 @@ static struct fuse_io_args *fuse_io_folios_alloc(struct fuse_io_priv *io,
761
760
return ia ;
762
761
}
763
762
764
- static void fuse_io_folios_free (struct fuse_io_args * ia )
763
+ static void fuse_io_free (struct fuse_io_args * ia )
765
764
{
766
765
kfree (ia -> ap .folios );
767
766
kfree (ia );
@@ -797,7 +796,7 @@ static void fuse_aio_complete_req(struct fuse_mount *fm, struct fuse_args *args,
797
796
fuse_release_user_pages (& ia -> ap , err ?: nres , io -> should_dirty );
798
797
799
798
fuse_aio_complete (io , err , pos );
800
- fuse_io_folios_free (ia );
799
+ fuse_io_free (ia );
801
800
}
802
801
803
802
static ssize_t fuse_async_req_send (struct fuse_mount * fm ,
@@ -880,10 +879,9 @@ static int fuse_do_readfolio(struct file *file, struct folio *folio)
880
879
struct fuse_io_args ia = {
881
880
.ap .args .page_zeroing = true,
882
881
.ap .args .out_pages = true,
883
- .ap .uses_folios = true,
884
882
.ap .num_folios = 1 ,
885
883
.ap .folios = & folio ,
886
- .ap .folio_descs = & desc ,
884
+ .ap .descs = & desc ,
887
885
};
888
886
ssize_t res ;
889
887
u64 attr_ver ;
@@ -962,7 +960,7 @@ static void fuse_readpages_end(struct fuse_mount *fm, struct fuse_args *args,
962
960
if (ia -> ff )
963
961
fuse_file_put (ia -> ff , false);
964
962
965
- fuse_io_folios_free (ia );
963
+ fuse_io_free (ia );
966
964
}
967
965
968
966
static void fuse_send_readpages (struct fuse_io_args * ia , struct file * file )
@@ -983,7 +981,7 @@ static void fuse_send_readpages(struct fuse_io_args *ia, struct file *file)
983
981
/* Don't overflow end offset */
984
982
if (pos + (count - 1 ) == LLONG_MAX ) {
985
983
count -- ;
986
- ap -> folio_descs [ap -> num_folios - 1 ].length -- ;
984
+ ap -> descs [ap -> num_folios - 1 ].length -- ;
987
985
}
988
986
WARN_ON ((loff_t ) (pos + count ) < 0 );
989
987
@@ -1044,15 +1042,15 @@ static void fuse_readahead(struct readahead_control *rac)
1044
1042
*/
1045
1043
break ;
1046
1044
1047
- ia = fuse_io_folios_alloc (NULL , cur_pages );
1045
+ ia = fuse_io_alloc (NULL , cur_pages );
1048
1046
if (!ia )
1049
1047
return ;
1050
1048
ap = & ia -> ap ;
1051
1049
1052
1050
while (ap -> num_folios < cur_pages ) {
1053
1051
folio = readahead_folio (rac );
1054
1052
ap -> folios [ap -> num_folios ] = folio ;
1055
- ap -> folio_descs [ap -> num_folios ].length = folio_size (folio );
1053
+ ap -> descs [ap -> num_folios ].length = folio_size (folio );
1056
1054
ap -> num_folios ++ ;
1057
1055
}
1058
1056
fuse_send_readpages (ia , rac -> file );
@@ -1186,7 +1184,7 @@ static ssize_t fuse_send_write_pages(struct fuse_io_args *ia,
1186
1184
err = - EIO ;
1187
1185
1188
1186
short_write = ia -> write .out .size < count ;
1189
- offset = ap -> folio_descs [0 ].offset ;
1187
+ offset = ap -> descs [0 ].offset ;
1190
1188
count = ia -> write .out .size ;
1191
1189
for (i = 0 ; i < ap -> num_folios ; i ++ ) {
1192
1190
struct folio * folio = ap -> folios [i ];
@@ -1224,7 +1222,7 @@ static ssize_t fuse_fill_write_pages(struct fuse_io_args *ia,
1224
1222
int err ;
1225
1223
1226
1224
ap -> args .in_pages = true;
1227
- ap -> folio_descs [0 ].offset = offset ;
1225
+ ap -> descs [0 ].offset = offset ;
1228
1226
1229
1227
do {
1230
1228
size_t tmp ;
@@ -1261,7 +1259,7 @@ static ssize_t fuse_fill_write_pages(struct fuse_io_args *ia,
1261
1259
1262
1260
err = 0 ;
1263
1261
ap -> folios [ap -> num_folios ] = folio ;
1264
- ap -> folio_descs [ap -> num_folios ].length = tmp ;
1262
+ ap -> descs [ap -> num_folios ].length = tmp ;
1265
1263
ap -> num_folios ++ ;
1266
1264
nr_pages ++ ;
1267
1265
@@ -1318,8 +1316,7 @@ static ssize_t fuse_perform_write(struct kiocb *iocb, struct iov_iter *ii)
1318
1316
unsigned int nr_pages = fuse_wr_pages (pos , iov_iter_count (ii ),
1319
1317
fc -> max_pages );
1320
1318
1321
- ap -> uses_folios = true;
1322
- ap -> folios = fuse_folios_alloc (nr_pages , GFP_KERNEL , & ap -> folio_descs );
1319
+ ap -> folios = fuse_folios_alloc (nr_pages , GFP_KERNEL , & ap -> descs );
1323
1320
if (!ap -> folios ) {
1324
1321
err = - ENOMEM ;
1325
1322
break ;
@@ -1564,13 +1561,13 @@ static int fuse_get_user_pages(struct fuse_args_pages *ap, struct iov_iter *ii,
1564
1561
/* Currently, all folios in FUSE are one page */
1565
1562
nfolios = DIV_ROUND_UP (ret , PAGE_SIZE );
1566
1563
1567
- ap -> folio_descs [ap -> num_folios ].offset = start ;
1568
- fuse_folio_descs_length_init (ap -> folio_descs , ap -> num_folios , nfolios );
1564
+ ap -> descs [ap -> num_folios ].offset = start ;
1565
+ fuse_folio_descs_length_init (ap -> descs , ap -> num_folios , nfolios );
1569
1566
for (i = 0 ; i < nfolios ; i ++ )
1570
1567
ap -> folios [i + ap -> num_folios ] = page_folio (pages [i ]);
1571
1568
1572
1569
ap -> num_folios += nfolios ;
1573
- ap -> folio_descs [ap -> num_folios - 1 ].length -=
1570
+ ap -> descs [ap -> num_folios - 1 ].length -=
1574
1571
(PAGE_SIZE - ret ) & (PAGE_SIZE - 1 );
1575
1572
nr_pages += nfolios ;
1576
1573
}
@@ -1614,14 +1611,14 @@ ssize_t fuse_direct_io(struct fuse_io_priv *io, struct iov_iter *iter,
1614
1611
bool fopen_direct_io = ff -> open_flags & FOPEN_DIRECT_IO ;
1615
1612
1616
1613
max_pages = iov_iter_npages (iter , fc -> max_pages );
1617
- ia = fuse_io_folios_alloc (io , max_pages );
1614
+ ia = fuse_io_alloc (io , max_pages );
1618
1615
if (!ia )
1619
1616
return - ENOMEM ;
1620
1617
1621
1618
if (fopen_direct_io && fc -> direct_io_allow_mmap ) {
1622
1619
res = filemap_write_and_wait_range (mapping , pos , pos + count - 1 );
1623
1620
if (res ) {
1624
- fuse_io_folios_free (ia );
1621
+ fuse_io_free (ia );
1625
1622
return res ;
1626
1623
}
1627
1624
}
@@ -1636,7 +1633,7 @@ ssize_t fuse_direct_io(struct fuse_io_priv *io, struct iov_iter *iter,
1636
1633
if (fopen_direct_io && write ) {
1637
1634
res = invalidate_inode_pages2_range (mapping , idx_from , idx_to );
1638
1635
if (res ) {
1639
- fuse_io_folios_free (ia );
1636
+ fuse_io_free (ia );
1640
1637
return res ;
1641
1638
}
1642
1639
}
@@ -1663,7 +1660,7 @@ ssize_t fuse_direct_io(struct fuse_io_priv *io, struct iov_iter *iter,
1663
1660
1664
1661
if (!io -> async || nres < 0 ) {
1665
1662
fuse_release_user_pages (& ia -> ap , nres , io -> should_dirty );
1666
- fuse_io_folios_free (ia );
1663
+ fuse_io_free (ia );
1667
1664
}
1668
1665
ia = NULL ;
1669
1666
if (nres < 0 ) {
@@ -1682,13 +1679,13 @@ ssize_t fuse_direct_io(struct fuse_io_priv *io, struct iov_iter *iter,
1682
1679
}
1683
1680
if (count ) {
1684
1681
max_pages = iov_iter_npages (iter , fc -> max_pages );
1685
- ia = fuse_io_folios_alloc (io , max_pages );
1682
+ ia = fuse_io_alloc (io , max_pages );
1686
1683
if (!ia )
1687
1684
break ;
1688
1685
}
1689
1686
}
1690
1687
if (ia )
1691
- fuse_io_folios_free (ia );
1688
+ fuse_io_free (ia );
1692
1689
if (res > 0 )
1693
1690
* ppos = pos ;
1694
1691
@@ -2093,8 +2090,7 @@ static struct fuse_writepage_args *fuse_writepage_args_alloc(void)
2093
2090
if (wpa ) {
2094
2091
ap = & wpa -> ia .ap ;
2095
2092
ap -> num_folios = 0 ;
2096
- ap -> uses_folios = true;
2097
- ap -> folios = fuse_folios_alloc (1 , GFP_NOFS , & ap -> folio_descs );
2093
+ ap -> folios = fuse_folios_alloc (1 , GFP_NOFS , & ap -> descs );
2098
2094
if (!ap -> folios ) {
2099
2095
kfree (wpa );
2100
2096
wpa = NULL ;
@@ -2127,8 +2123,8 @@ static void fuse_writepage_args_page_fill(struct fuse_writepage_args *wpa, struc
2127
2123
folio_copy (tmp_folio , folio );
2128
2124
2129
2125
ap -> folios [folio_index ] = tmp_folio ;
2130
- ap -> folio_descs [folio_index ].offset = 0 ;
2131
- ap -> folio_descs [folio_index ].length = PAGE_SIZE ;
2126
+ ap -> descs [folio_index ].offset = 0 ;
2127
+ ap -> descs [folio_index ].length = PAGE_SIZE ;
2132
2128
2133
2129
inc_wb_stat (& inode_to_bdi (inode )-> wb , WB_WRITEBACK );
2134
2130
node_stat_add_folio (tmp_folio , NR_WRITEBACK_TEMP );
@@ -2234,10 +2230,10 @@ static bool fuse_pages_realloc(struct fuse_fill_wb_data *data)
2234
2230
return false;
2235
2231
2236
2232
memcpy (folios , ap -> folios , sizeof (struct folio * ) * ap -> num_folios );
2237
- memcpy (descs , ap -> folio_descs , sizeof (struct fuse_folio_desc ) * ap -> num_folios );
2233
+ memcpy (descs , ap -> descs , sizeof (struct fuse_folio_desc ) * ap -> num_folios );
2238
2234
kfree (ap -> folios );
2239
2235
ap -> folios = folios ;
2240
- ap -> folio_descs = descs ;
2236
+ ap -> descs = descs ;
2241
2237
data -> max_folios = nfolios ;
2242
2238
2243
2239
return true;
0 commit comments