@@ -4421,39 +4421,32 @@ SYSCALL_DEFINE4(cachestat, unsigned int, fd,
4421
4421
struct cachestat_range __user * , cstat_range ,
4422
4422
struct cachestat __user * , cstat , unsigned int , flags )
4423
4423
{
4424
- struct fd f = fdget (fd );
4424
+ CLASS ( fd , f ) (fd );
4425
4425
struct address_space * mapping ;
4426
4426
struct cachestat_range csr ;
4427
4427
struct cachestat cs ;
4428
4428
pgoff_t first_index , last_index ;
4429
4429
4430
- if (! fd_file (f ))
4430
+ if (fd_empty (f ))
4431
4431
return - EBADF ;
4432
4432
4433
4433
if (copy_from_user (& csr , cstat_range ,
4434
- sizeof (struct cachestat_range ))) {
4435
- fdput (f );
4434
+ sizeof (struct cachestat_range )))
4436
4435
return - EFAULT ;
4437
- }
4438
4436
4439
4437
/* hugetlbfs is not supported */
4440
- if (is_file_hugepages (fd_file (f ))) {
4441
- fdput (f );
4438
+ if (is_file_hugepages (fd_file (f )))
4442
4439
return - EOPNOTSUPP ;
4443
- }
4444
4440
4445
- if (flags != 0 ) {
4446
- fdput (f );
4441
+ if (flags != 0 )
4447
4442
return - EINVAL ;
4448
- }
4449
4443
4450
4444
first_index = csr .off >> PAGE_SHIFT ;
4451
4445
last_index =
4452
4446
csr .len == 0 ? ULONG_MAX : (csr .off + csr .len - 1 ) >> PAGE_SHIFT ;
4453
4447
memset (& cs , 0 , sizeof (struct cachestat ));
4454
4448
mapping = fd_file (f )-> f_mapping ;
4455
4449
filemap_cachestat (mapping , first_index , last_index , & cs );
4456
- fdput (f );
4457
4450
4458
4451
if (copy_to_user (cstat , & cs , sizeof (struct cachestat )))
4459
4452
return - EFAULT ;
0 commit comments