Thread (68 messages) 68 messages, 4 authors, 2021-01-27

Re: [PATCH v4 04/18] btrfs: make attach_extent_buffer_page() to handle subpage case

From: David Sterba <hidden>
Date: 2021-01-19 22:41:44

On Tue, Jan 19, 2021 at 04:54:28PM -0500, Josef Bacik wrote:
On 1/16/21 2:15 AM, Qu Wenruo wrote:
quoted
+/* For rare cases where we need to pre-allocate a btrfs_subpage structure */
+static inline int btrfs_alloc_subpage(struct btrfs_fs_info *fs_info,
+				      struct btrfs_subpage **ret)
+{
+	if (fs_info->sectorsize == PAGE_SIZE)
+		return 0;
+
+	*ret = kzalloc(sizeof(struct btrfs_subpage), GFP_NOFS);
+	if (!*ret)
+		return -ENOMEM;
+	return 0;
+}
We're allocating these for every metadata page, that deserves a dedicated 
kmem_cache.  Thanks,
I'm not opposed to that idea but for the first implementation I'm ok
with using the default slabs. As the subpage support depends on the
filesystem, creating the cache unconditionally would waste resources and
creating it on demand would need some care. Either way I'd rather see it
in a separate patch.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help