Re: [RFC] [PATCHv3 1/9] reiser4: block_alloc: add BA_SOME_SPACE flag for grabbing a fixed amount of space.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tuesday 21 October 2014 at 12:32:24, Edward Shishkin wrote:	
> 
> On 10/20/2014 12:36 PM, Ivan Shapovalov wrote:
> > On Monday 20 October 2014 at 00:04:39, Edward Shishkin wrote:	
> >> On 08/17/2014 11:52 PM, Ivan Shapovalov wrote:
> >>> This is used for FITRIM ioctl which will iteratively grab, allocate and trim disk space
> >>> bit by bit to avoid starving the rest of system.
> >>>
> >>> Signed-off-by: Ivan Shapovalov <intelfx100@xxxxxxxxx>
> >>> ---
> >>>    fs/reiser4/block_alloc.c | 5 +++++
> >>>    fs/reiser4/block_alloc.h | 5 ++++-
> >>>    2 files changed, 9 insertions(+), 1 deletion(-)
> >>>
> >>> diff --git a/fs/reiser4/block_alloc.c b/fs/reiser4/block_alloc.c
> >>> index d3d730c..9eed7fc 100644
> >>> --- a/fs/reiser4/block_alloc.c
> >>> +++ b/fs/reiser4/block_alloc.c
> >>> @@ -276,6 +276,11 @@ reiser4_grab(reiser4_context * ctx, __u64 count, reiser4_ba_flags_t flags)
> >>>    
> >>>    	free_blocks = sbinfo->blocks_free;
> >>>    
> >>> +	if (flags & BA_SOME_SPACE) {
> >>> +		/* Reserve 25% of all free space. */
> >> if (free_blocks == 0) {
> >>           /* nothing to trim */
> >>           ret= RETERR(-ENOSPC);
> >>           goto unlock_and_ret;
> >> }
> > Makes sense, but IMO without returning error. TRIM'ing a completely full
> > filesystem is a no-op (== all blocks busy, nothing to trim), not a failure.
> 
> 
> (sbinfo->blocks_free) is a rather bad estimation of free space amount,
> but we have nothing better. I suggest to return -ENOSPC here, and use
> reiser4_grab_space() with BA_CAN_COMMIT to make sure that FITRIM
> ioctl gets the "second soft ENOSPC".

Yeah, OK.

-- 
Ivan Shapovalov / intelfx /

Attachment: signature.asc
Description: This is a digitally signed message part.


[Index of Archives]     [Linux File System Development]     [Linux BTRFS]     [Linux NFS]     [Linux Filesystems]     [Ext4 Filesystem]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite Forum]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Device Mapper]     [Linux Resources]

  Powered by Linux