[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <87msr85dwg.fsf@doe.com>
Date: Sat, 09 Mar 2024 08:07:19 +0530
From: Ritesh Harjani (IBM) <ritesh.list@...il.com>
To: John Garry <john.g.garry@...cle.com>, linux-fsdevel@...r.kernel.org, linux-ext4@...r.kernel.org
Cc: Jan Kara <jack@...e.cz>, Theodore Ts'o <tytso@....edu>, Ojaswin Mujoo <ojaswin@...ux.ibm.com>, Matthew Wilcox <willy@...radead.org>, "Darrick J . Wong" <djwong@...nel.org>, Luis Chamberlain <mcgrof@...nel.org>, linux-kernel@...r.kernel.org, Dave Chinner <david@...morbit.com>
Subject: Re: [RFC] ext4: Add support for ext4_map_blocks_atomic()
"Ritesh Harjani (IBM)" <ritesh.list@...il.com> writes:
> +int ext4_map_blocks_atomic(handle_t *handle, struct inode *inode,
> + struct ext4_map_blocks *map, int flags)
> +{
> + unsigned int mapped_len = 0, m_len = map->m_len;
> + ext4_lblk_t m_lblk = map->m_lblk;
> + int ret;
> +
> + WARN_ON(!(flags & EXT4_GET_BLOCKS_CREATE));
> +
> + do {
> + ret = ext4_map_blocks(handle, inode, map, flags);
> + if (ret < 0)
> + return ret;
> + mapped_len += map->m_len;
> + map->m_lblk += map->m_len;
> + map->m_len = m_len - mapped_len;
> + } while (mapped_len < m_len);
> +
> + map->m_lblk = m_lblk;
> + map->m_len = mapped_len;
> + return mapped_len;
ouch!
1. I need to make sure map.m_pblk is updated properly.
2. I need to make sure above call only happens with bigalloc.
Sorry about that. Generally not a good idea to send something that late
at night.
But I guess this can be fixed easily. so hopefully the algorithm should
still remain, more or less the same for ext4_map_blocks_atomic().
-ritesh
Powered by blists - more mailing lists